[Libreoffice-commits] core.git: vcl/unx
Caolán McNamara
caolanm at redhat.com
Thu Apr 25 07:15:12 PDT 2013
vcl/unx/gtk/window/gtksalframe.cxx | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
New commits:
commit 21fb092398fb21256b0e546e7f38c5e6de4654f2
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Apr 25 15:11:42 2013 +0100
Related: fdo#63802
let si-phonetic-dynamic survive libreoffice losing focus and regain it cycle
and still use surrounding text. It should be safe to report that we can provide
surrounding text but there isn't any during the time window when there is no
focus window, because the focus in event was received but it hasn't arrived yet
because that happens on a postuserevent.
Change-Id: I0481c42208953f2a0618aaed7b0d9e9f3e7bda07
diff --git a/vcl/unx/gtk/window/gtksalframe.cxx b/vcl/unx/gtk/window/gtksalframe.cxx
index 3202e5e..d20e3c6 100644
--- a/vcl/unx/gtk/window/gtksalframe.cxx
+++ b/vcl/unx/gtk/window/gtksalframe.cxx
@@ -4149,13 +4149,9 @@ uno::Reference<accessibility::XAccessibleEditableText>
return uno::Reference< accessibility::XAccessibleEditableText >();
}
-static uno::Reference<accessibility::XAccessibleEditableText> lcl_GetxText()
+static uno::Reference<accessibility::XAccessibleEditableText> lcl_GetxText(Window *pFocusWin)
{
uno::Reference<accessibility::XAccessibleEditableText> xText;
- Window* pFocusWin = ImplGetSVData()->maWinData.mpFocusWin;
- if (!pFocusWin)
- return xText;
-
try
{
uno::Reference< accessibility::XAccessible > xAccessible( pFocusWin->GetAccessible( true ) );
@@ -4165,14 +4161,18 @@ static uno::Reference<accessibility::XAccessibleEditableText> lcl_GetxText()
catch(const uno::Exception& e)
{
g_warning( "Exception in getting input method surrounding text" );
+ SAL_WARN( "vcl.gtk", "Exception in getting input method surrounding text: " << e.Message);
}
return xText;
}
gboolean GtkSalFrame::IMHandler::signalIMRetrieveSurrounding( GtkIMContext* pContext, gpointer /*im_handler*/ )
{
- uno::Reference<accessibility::XAccessibleEditableText> xText = lcl_GetxText();
+ Window *pFocusWin = Application::GetFocusWindow();
+ if (!pFocusWin)
+ return true;
+ uno::Reference<accessibility::XAccessibleEditableText> xText = lcl_GetxText(pFocusWin);
if (xText.is())
{
sal_uInt32 nPosition = xText->getCaretPosition();
@@ -4181,17 +4181,20 @@ gboolean GtkSalFrame::IMHandler::signalIMRetrieveSurrounding( GtkIMContext* pCon
OUString sCursorText(sAllText.copy(0, nPosition));
gtk_im_context_set_surrounding(pContext, sUTF.getStr(), sUTF.getLength(),
OUStringToOString(sCursorText, RTL_TEXTENCODING_UTF8).getLength());
- return sal_True;
+ return true;
}
- return sal_False;
+ return false;
}
gboolean GtkSalFrame::IMHandler::signalIMDeleteSurrounding( GtkIMContext*, gint offset, gint nchars,
gpointer /*im_handler*/ )
{
- uno::Reference<accessibility::XAccessibleEditableText> xText = lcl_GetxText();
+ Window *pFocusWin = Application::GetFocusWindow();
+ if (!pFocusWin)
+ return true;
+ uno::Reference<accessibility::XAccessibleEditableText> xText = lcl_GetxText(pFocusWin);
if (xText.is())
{
sal_uInt32 nPosition = xText->getCaretPosition();
More information about the Libreoffice-commits
mailing list