After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 103549 - Incorrect input style
Incorrect input style
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Input Methods
unspecified
Other Solaris
: Normal normal
: ---
Assigned To: Hidetoshi Tajima
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2003-01-15 05:11 UTC by Hidetoshi Tajima
Modified: 2011-02-04 16:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
initilize info->style to zero (708 bytes, patch)
2003-01-15 05:13 UTC, Hidetoshi Tajima
none Details | Review
2nd patch to fix a uninitialized inputstyle value (632 bytes, patch)
2003-01-23 00:15 UTC, Hidetoshi Tajima
none Details | Review
3rd patch handle input method's supported styles properly (1.73 KB, patch)
2003-01-23 01:42 UTC, Hidetoshi Tajima
none Details | Review

Description Hidetoshi Tajima 2003-01-15 05:11:23 UTC
When none of the input styles sent by XIM matches to gtk's setting style,
the choosen input style can be invalid value due to memory uninitialzation.
Actually, the problem happens on hebrew and Arabic locales on Solaris.
Comment 1 Hidetoshi Tajima 2003-01-15 05:13:22 UTC
Created attachment 13573 [details] [review]
initilize info->style to zero
Comment 2 Hidetoshi Tajima 2003-01-15 05:17:06 UTC
Tue Jan 14 21:19:13 2003    <hidetoshi.tajima@sun.com>

	* modules/input/gtkimcontextxim.c (setup_styles):
	initialize info->style to 0 (#103549)

Please review and approve a commit to the HEAD.
Comment 3 Owen Taylor 2003-01-22 21:18:31 UTC
Wouldn't 

 XIMPreeditNothing | XIMStatusNothing

be a better initialization value than 0?

Also, shouldn't we print out a warning, since if the
input method can't either work with Callbacks or Nothing,
then we are't going to have correct operation.

What is the list of supported styles for these input methods?
Comment 4 Hidetoshi Tajima 2003-01-22 22:49:44 UTC
They support 2 x 3 styles - combinations of XIMPreeditNothing or
XIMPreeditNone, and XIMStatusArea, XIMStatusNothing or XIMStatusNone.

I was not sure if using XIMPreeditNothing|XIMStatusNothing would work
or not if it is not in xim's supported input styles, so used 0 to make
the 1st choose_better_style()
call return the style2 value.

As to the warning message, print it when neither style
can be supported, or when XCreateIC() fails? XCreateIC()
calls anyway with XIMPreeditNothing|XIMStatusNothing.
Comment 5 Owen Taylor 2003-01-22 23:09:34 UTC
Ah, I misunderstood what you were saying, I thought you
were talking about the case when none of the styles
passed:

 	if ((xim_styles->supported_styles[i] & ALLOWED_MASK) ==
xim_styles->supported_styles[i])

This is the case where I was talking about printing a warning.

My idea to be using Nothing|Nothing is that it should be
worse than any real value, by choose_better_style(), but
still a legitimate value for a return.

Note 1: It looks like to me that choose_better_style() doesn't
   handle XIMPreeditNone correctly.

Note 2: The distinction between Nothing and None is not entirely
   clear to me.

 
Comment 6 Hidetoshi Tajima 2003-01-22 23:45:47 UTC
Yep, I should have said "gtk's setting style does not match
any of the styles XIM supports" :-) 

For the case none of the style was passed, setup_styles()
does nothing now, so info_im->style is left uninialized.
better to initialize info_im->style o Nothing|Nothing for 
this case as well.

To my understanding, Nothing|Nothing is to let XIM do
whatever way(mostly window location) it wants to show 
preedit/status GUI, so there are still feedbacks to users,
while None|None is for no preedit/status feeback,
but only commit string is sent. [so None|None is not use case after all.]

A new patch is followed.
Comment 7 Hidetoshi Tajima 2003-01-23 00:15:23 UTC
Created attachment 13763 [details] [review]
2nd patch to fix a uninitialized inputstyle value
Comment 8 Owen Taylor 2003-01-23 00:24:49 UTC
Hmmm, if a input method only listed:
 
 PreeditNone|StatusNone

in its list of input methods, wouldn't this patch select
PreeditNothing|StatusNothing, since Nothing is better
than None?

Perhaps we should set it to 0 as your first patch did,
and then if it's still 0 at the end, change it to
Nothing|Nothing?

I think we also need to fix select_better_style() to
handle PreeditNone.

Comment 9 Hidetoshi Tajima 2003-01-23 01:35:34 UTC
I've made the 3rd patch. I did:
  - handle PreeditNone case in choose_better_style()
  - set info->style to 0 first, and set it to Nothing|Nothing
     if it is still 0 at the end.
  - use XIMPreeditNone or XIMStatusNone if the input method 
    supports them but don't support XIMPreeditNothing or 
    XIMStatusNothing.

I intended we should still prefer to use Nothing rather than None
if the input method support both, samely as we prefer Callback to 
Nothing [unless use_preedit is set to false].



 
Comment 10 Hidetoshi Tajima 2003-01-23 01:42:13 UTC
Created attachment 13765 [details] [review]
3rd patch handle input method's supported styles properly
Comment 11 Owen Taylor 2003-01-29 21:01:00 UTC
Looks fine to commit to me (HEAD and gtk-2-2)
Comment 12 Hidetoshi Tajima 2003-01-29 22:01:01 UTC
Thanks, will commit the patch to both branches from now.

	* modules/input/gtkimcontextxim.c (setup_styles): fix uninitialization
	error when selecting input style (#103549).