From 7163221702d2995cb93d4478a4ab897cce72b9a5 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: May 23 2013 09:11:35 +0000 Subject: Resolves: rhbz#890474 loss of IM support on losing focus --- diff --git a/0001-Resolves-fdo-63802-return-true-if-we-have-known-empt.patch b/0001-Resolves-fdo-63802-return-true-if-we-have-known-empt.patch new file mode 100644 index 0000000..8ccc91d --- /dev/null +++ b/0001-Resolves-fdo-63802-return-true-if-we-have-known-empt.patch @@ -0,0 +1,119 @@ +From 6264733282ff93d8bbb561f67b880424f31a1f7d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= +Date: Thu, 25 Apr 2013 14:04:56 +0100 +Subject: [PATCH] Resolves: fdo#63802 return true if we have known empty + context + +i.e. false for "we can't provide context", and true for +"we can provide context, even if there isn't any" + +Still looks to me that there's a bug in the si-phonetic-dynamic +im (or something in the stack) that assumes that returning +false once means it will always return false and give up +for ever + +fix indent while I'm at it + +also 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. + +(cherry picked from commit 21fb092398fb21256b0e546e7f38c5e6de4654f2) + +Change-Id: I0481c42208953f2a0618aaed7b0d9e9f3e7bda07 +Reviewed-on: https://gerrit.libreoffice.org/3608 +Reviewed-by: Miklos Vajna +Tested-by: Miklos Vajna +--- + vcl/unx/gtk/window/gtkframe.cxx | 38 +++++++++++++++++++------------------- + 1 file changed, 19 insertions(+), 19 deletions(-) + +diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx +index 03f8c59..eb87e74 100644 +--- a/vcl/unx/gtk/window/gtkframe.cxx ++++ b/vcl/unx/gtk/window/gtkframe.cxx +@@ -4223,13 +4223,9 @@ uno::Reference + return uno::Reference< accessibility::XAccessibleEditableText >(); + } + +-static uno::Reference lcl_GetxText() ++static uno::Reference lcl_GetxText(Window *pFocusWin) + { + uno::Reference xText; +- Window* pFocusWin = ImplGetSVData()->maWinData.mpFocusWin; +- if (!pFocusWin) +- return xText; +- + try + { + uno::Reference< accessibility::XAccessible > xAccessible( pFocusWin->GetAccessible( true ) ); +@@ -4238,36 +4234,39 @@ static uno::Reference lcl_GetxText() + } + catch(const uno::Exception& e) + { +- g_warning( "Exception in getting input method surrounding text" ); + } + return xText; + } + + gboolean GtkSalFrame::IMHandler::signalIMRetrieveSurrounding( GtkIMContext* pContext, gpointer /*im_handler*/ ) + { +- uno::Reference xText = lcl_GetxText(); ++ Window *pFocusWin = Application::GetFocusWindow(); ++ if (!pFocusWin) ++ return true; + ++ uno::Reference xText = lcl_GetxText(pFocusWin); + if (xText.is()) + { + sal_uInt32 nPosition = xText->getCaretPosition(); +- rtl::OUString sAllText = xText->getText(); +- if (sAllText.isEmpty()) +- return sal_False; +- rtl::OString sUTF = rtl::OUStringToOString(sAllText, RTL_TEXTENCODING_UTF8); +- rtl::OUString sCursorText(sAllText.copy(0, nPosition)); +- gtk_im_context_set_surrounding(pContext, sUTF.getStr(), sUTF.getLength(), +- rtl::OUStringToOString(sCursorText, RTL_TEXTENCODING_UTF8).getLength()); +- return sal_True; ++ OUString sAllText = xText->getText(); ++ OString sUTF = OUStringToOString(sAllText, RTL_TEXTENCODING_UTF8); ++ OUString sCursorText(sAllText.copy(0, nPosition)); ++ gtk_im_context_set_surrounding(pContext, sUTF.getStr(), sUTF.getLength(), ++ OUStringToOString(sCursorText, RTL_TEXTENCODING_UTF8).getLength()); ++ return true; + } + +- return sal_False; ++ return false; + } + + gboolean GtkSalFrame::IMHandler::signalIMDeleteSurrounding( GtkIMContext*, gint offset, gint nchars, + gpointer /*im_handler*/ ) + { +- uno::Reference xText = lcl_GetxText(); ++ Window *pFocusWin = Application::GetFocusWindow(); ++ if (!pFocusWin) ++ return true; + ++ uno::Reference xText = lcl_GetxText(pFocusWin); + if (xText.is()) + { + sal_uInt32 nPosition = xText->getCaretPosition(); +@@ -4282,10 +4282,10 @@ gboolean GtkSalFrame::IMHandler::signalIMDeleteSurrounding( GtkIMContext*, gint + nDeleteEnd = xText->getCharacterCount(); + + xText->deleteText(nDeletePos, nDeleteEnd); +- return sal_True; ++ return true; + } + +- return sal_False; ++ return false; + } + + Size GtkSalDisplay::GetScreenSize( int nDisplayScreen ) +-- +1.8.1.2 + diff --git a/libreoffice.spec b/libreoffice.spec index 67cc105..c246778 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -44,7 +44,7 @@ Summary: Free Software Productivity Suite Name: libreoffice Epoch: 1 Version: %{libo_version}.2 -Release: 6%{?libo_prerelease}%{?dist} +Release: 7%{?libo_prerelease}%{?dist} License: (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and Artistic and MPLv2.0 Group: Applications/Productivity URL: http://www.documentfoundation.org/develop @@ -264,6 +264,7 @@ Patch42: 0001-rhbz-954991-Avoid-static-data-causing-trouble-at-exi.patch Patch43: 0001-resolved-rhbz-919020-Basic-CDbl-and-CSng-scan-locali.patch Patch44: 0001-resolved-rhbz-918544-do-not-attempt-to-access-non-ex.patch Patch45: 0001-Related-rhbz-761009-lp-766153-lp-892904-HandleFontOp.patch +Patch46: 0001-Resolves-fdo-63802-return-true-if-we-have-known-empt.patch %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} %define instdir %{_libdir} @@ -1021,6 +1022,7 @@ mv -f redhat.soc extras/source/palettes/standard.soc %patch43 -p1 -b .rhbz-919020-Basic-CDbl-and-CSng-scan-locali.patch %patch44 -p1 -b .rhbz-918544-do-not-attempt-to-access-non-ex.patch %patch45 -p1 -b .rhbz-761009-lp-766153-lp-892904-HandleFontOp.patch +%patch46 -p1 -b .fdo-63802-return-true-if-we-have-known-empt.patch # TODO: check this # these are horribly incomplete--empty translations and copied english @@ -2290,6 +2292,11 @@ update-desktop-database %{_datadir}/applications &> /dev/null || : %endif %changelog +* Thu May 23 2013 Caolán McNamara - 1:3.6.6.2-7 +- Resolves: rhbz#890474 some IMs take a ret of false to mean "no + support for surrounding text" rather than "no surrounding text + at this point" + * Thu May 16 2013 Caolán McNamara - 1:3.6.6.2-6 - Resolves: rhbz#963276 font options cache crash