Issue 45768 - Further GTK+ vclplug IIIMF input improvements
Summary: Further GTK+ vclplug IIIMF input improvements
Status: CLOSED FIXED
Alias: None
Product: gsl
Classification: Code
Component: code (show other issues)
Version: OOo 2.0 Beta
Hardware: All All
: P3 Trivial (vote)
Target Milestone: OOo 2.0
Assignee: ulf.stroehler
QA Contact: issues@gsl
URL:
Keywords:
: 29878 (view as issue list)
Depends on:
Blocks:
 
Reported: 2005-03-22 14:43 UTC by fa
Modified: 2005-08-01 18:17 UTC (History)
4 users (show)

See Also:
Issue Type: PATCH
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
patch for correct function with gtk_im_context_reset() (7.06 KB, patch)
2005-03-22 14:46 UTC, fa
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description fa 2005-03-22 14:43:14 UTC
This patch is necessary for the GTK vclplug to work with input methods that
support gtk_im_context_reset().
Comment 1 fa 2005-03-22 14:46:12 UTC
Created attachment 24160 [details]
patch for correct function with gtk_im_context_reset()
Comment 2 fa 2005-03-22 14:53:08 UTC
Ok, some explanation here...

1) resetIMContext(): gtk widgets that take input and call gtk_im_context_reset()
(like the editing widget) must protect their calls to gtk_im_context_reset() to
avoid recursion overflow.  We have to do that too, because at any time the LE
could call any of our i18n functions during the reset.  So we only allow
gtk_im_context_reset() to be called when we call
gtk_im_context_filter_keypress(), like GTK widgets do.

2) Tab key stuff: we have to special-case the tab key so that it can explicitly
end the exttextinput and clear the preedit buffer, otherwise you'll get the
previous cell's preedit string showing up in the new cell.

3) gtkEndExtTextInput(): this may also get called more than once in a call
chain.  For example, if we end the exttextinput at some time, we then usually
call gtk_im_context_reset() to make sure the LE forgets the preedit string. 
However, the LE might call our commmit or preedit-changed handlers, which may
again call this function.  Therefore, we need to ensure that it too does nto get
called more than once in a call chain.

4) signalIMPreeditStart/signalIMPreeditEnd: I guess we haven't had problems with
these before, but I put in token implementations and they work for us with
IIIMF.  If you don't want to consider them, dont' bother applying these parts.
Comment 3 fa 2005-03-22 15:01:38 UTC
Also, we don't want to call gtk_im_context_reset() every time we want to
EndExtTextInput either, since that clears the preedit buffer.  Some languages,
however, (like Sun LE Korean) commit only a _portion_ of their held text (which
is acceptable behavior), so if you call reset() you clear the whole thing and
get malformed words.

See https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=137398
Comment 4 philipp.lohmann 2005-03-22 15:07:19 UTC
I wonder how this works together with the fixes in CWS vcl36 ?
Comment 5 philipp.lohmann 2005-03-22 15:13:44 UTC
Actually commiting and then clearing the preedit buffer is exactly what we want
EndExtTextInput to do. At least this is how it is supposed to behave currently.
What do you want with half a word in another control (or another calc cell) ?
Comment 6 fa 2005-03-22 15:26:58 UTC
The problem with korean is that the LE only knows when to break words based on
what you type.  So, if you type "qkfrkd" in korean, the LE sees "qkf", which is
fine.  When you then type "r", it now knows that it has to break the word.  So
it stores the "r" around (so you don't have to type it again) and "commits" the
"qkf" that composes the first word.

But, if we call gtk_im_context_reset() during the EndExtTextInput, that "r" gets
lost because we've force-cleared the IM's buffer.  Therefore, when you continue
to type "kd", the LE doesn't know how to compose the word since you've cleared
the "r" already.
Comment 7 fa 2005-03-22 15:28:12 UTC
pl: see Comment #6 in the bug above:

https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=137398#c6
Comment 8 philipp.lohmann 2005-03-22 16:12:06 UTC
Aaah, the wonderful world of IME; every IME is different and none conforms to
any standard. And they wonder that nothing works. Oh well.
Comment 9 fa 2005-03-22 16:43:22 UTC
yeah, it rather sucks doesn't it :(
Comment 10 philipp.lohmann 2005-06-07 12:07:39 UTC
all: i think all the workarounds that lead to hacks to other workarounds finally
convinced me that we (well, i) should redo the whole IM stuff in GtkSalFrame; no
more reset_ic, no more deleting input context and creating it again, just
decouple the vcl methods and gtk methods and put in another mediating object.
This will probably make OOo behave more like gedit (e.g. clicking around will
probably move the preedit text around), which is a bit sad, but considering the
huge problems that continue to arise with resetting the IC i think i have no
other choice.

What are your thoughts on this ?
Comment 11 mmeeks 2005-06-07 15:03:01 UTC
I personally would love to test the reset functionality (somehow, XTest?) on
startup, and throw up a large & extremely rude message: "Your IM is badly broken
-   XYZ IM is known to work well, please use that instead" type thing. That
would perhaps concentrate mind in the IM community.

It's pathetic not being able to rely on IMs to correctly implement the minimal
subset that is required.
Comment 12 philipp.lohmann 2005-06-07 15:27:55 UTC
Yes, but given the multitude of IMs we have to cope with, i think we cannot rely
on reset_ic to work. Besides there are other issues: it has occured on some
systems that you can switch IM capabilites in a different window (e.g. one
inside the Gnome status bar). Clicking in there leads of course to OOo losing
focus, triggering a reset_ic. As of now this effects destruction of the current
IC and construction of a new one as soon as OOo gets the focus back - which
results in loss of the changes the user just made. This would probably also
happen if we did not create a new IC but did a reset_ic (assuming an IM where
that works), so i think we'll need to skip resetting the IC altogether since
there are too many case where this is simply not the right thing to do.

This leaves us with what you wanted in the first place: if we cannot reset the
preedit buffer, then we can at least move it around like gedit does.
Comment 13 mmeeks 2005-06-07 15:45:51 UTC
well - the destroy/re-create thing always seemed like a bad idea to me :-) much
worse than re-setting it. Of course - we could do that only for IM's that we
know to be broken [ ie. not emitting preedit-changed to '' on reset [ & warning
about them in a dialog? ] ] but to be honest I completely forget all the details
here ;-)
Comment 14 philipp.lohmann 2005-06-09 09:50:54 UTC
fixed in CWS pl04, no more resets at all. I hope this solves a lot of problems,
but needs to be tested on various platforms.
Comment 15 philipp.lohmann 2005-06-14 14:13:36 UTC
please verify in CWS pl04

re-open issue and reassign to us@openoffice.org
Comment 16 philipp.lohmann 2005-06-14 14:13:47 UTC
reassign to us@openoffice.org
Comment 17 philipp.lohmann 2005-06-14 14:13:56 UTC
reset resolution to FIXED
Comment 18 philipp.lohmann 2005-06-24 13:08:19 UTC
adjust target
Comment 19 ulf.stroehler 2005-06-24 17:52:38 UTC
verified in cws 'pl04'.
Comment 20 ulf.stroehler 2005-07-26 10:33:40 UTC
Verified on MWS m121.
Comment 21 philipp.lohmann 2005-08-01 18:17:17 UTC
*** Issue 29878 has been marked as a duplicate of this issue. ***