diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-04-25 15:11:42 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-04-25 15:14:51 +0100 |
commit | 21fb092398fb21256b0e546e7f38c5e6de4654f2 (patch) | |
tree | 20712bc2e360c0f0b4f00f77bbdfe1fa1d6559ec /vcl | |
parent | 78a20557601d9ca7b446df0cffa72398576741ed (diff) |
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
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/unx/gtk/window/gtksalframe.cxx | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/vcl/unx/gtk/window/gtksalframe.cxx b/vcl/unx/gtk/window/gtksalframe.cxx index 3202e5e6d38f..d20e3c6e3836 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(); |