Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/3608
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/08/3608/1
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
---
M vcl/unx/gtk/window/gtkframe.cxx
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 @@
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 )
);
@@ -4238,36 +4234,40 @@
}
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();
- 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<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();
@@ -4282,10 +4282,10 @@
nDeleteEnd = xText->getCharacterCount();
xText->deleteText(nDeletePos, nDeleteEnd);
- return sal_True;
+ return true;
}
- return sal_False;
+ return false;
}
Size GtkSalDisplay::GetScreenSize( int nDisplayScreen )
--
To view, visit https://gerrit.libreoffice.org/3608
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0481c42208953f2a0618aaed7b0d9e9f3e7bda07
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Caolán McNamara <caolanm@redhat.com>
Context
- [PATCH libreoffice-4-0] Resolves: fdo#63802 return true if we have known empty conte... · via Code Review
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.