diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2016-10-12 08:32:04 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2016-10-12 08:32:04 +0200 |
commit | 051d521f6e20761ba6831cecd91883da960fa931 (patch) | |
tree | b28abba7818115d2fed80eb360a79a0f9183948e /nx-X11/lib/X11/imRm.c | |
parent | 6dce607bad8711dd06a5a7b69ad1930386b4123b (diff) | |
parent | b8de7bf654929c823080b211aeac56cd213f5a32 (diff) | |
download | nx-libs-051d521f6e20761ba6831cecd91883da960fa931.tar.gz nx-libs-051d521f6e20761ba6831cecd91883da960fa931.tar.bz2 nx-libs-051d521f6e20761ba6831cecd91883da960fa931.zip |
Merge branch 'uli42-pr/upgrade_libX11' into 3.6.x
Attributes GH PR #214: https://github.com/ArcticaProject/nx-libs/pull/214
Fixes ArcticaProject/nx-libs#157.
Diffstat (limited to 'nx-X11/lib/X11/imRm.c')
-rw-r--r-- | nx-X11/lib/X11/imRm.c | 486 |
1 files changed, 280 insertions, 206 deletions
diff --git a/nx-X11/lib/X11/imRm.c b/nx-X11/lib/X11/imRm.c index fa5a57021..7f79765e1 100644 --- a/nx-X11/lib/X11/imRm.c +++ b/nx-X11/lib/X11/imRm.c @@ -23,7 +23,7 @@ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - Author: Takashi Fujiwara FUJITSU LIMITED + Author: Takashi Fujiwara FUJITSU LIMITED fujiwara@a80.tech.yk.fujitsu.co.jp Modifier: Makoto Wakamatsu Sony Corporation makoto@sm.sony.co.jp @@ -40,8 +40,10 @@ PERFORMANCE OF THIS SOFTWARE. #include "Ximint.h" #include "Xresource.h" +#define GET_NAME(x) name_table + x.name_offset + typedef struct _XimValueOffsetInfo { - char *name; + unsigned short name_offset; XrmQuark quark; unsigned int offset; Bool (*defaults)( @@ -94,11 +96,11 @@ _XimSetProtoResource(im) else res_class = Xmalloc (strlen (im->core.res_class) + 50); /* pretend malloc always works */ - (void) sprintf (res_name, "%s%s%s", + (void) sprintf (res_name, "%s%s%s", im->core.res_name != NULL ? im->core.res_name : "*", im->core.res_name != NULL ? dotximdot : ximdot, "useAuth"); - (void) sprintf (res_class, "%s%s%s", + (void) sprintf (res_class, "%s%s%s", im->core.res_class != NULL ? im->core.res_class : "*", im->core.res_class != NULL ? dotXimdot : Ximdot, "UseAuth"); @@ -109,11 +111,11 @@ _XimSetProtoResource(im) } } - (void) sprintf (res_name, "%s%s%s", + (void) sprintf (res_name, "%s%s%s", im->core.res_name != NULL ? im->core.res_name : "*", im->core.res_name != NULL ? dotximdot : ximdot, "delaybinding"); - (void) sprintf (res_class, "%s%s%s", + (void) sprintf (res_class, "%s%s%s", im->core.res_class != NULL ? im->core.res_class : "*", im->core.res_class != NULL ? dotXimdot : Ximdot, "Delaybinding"); @@ -124,11 +126,11 @@ _XimSetProtoResource(im) } } - (void) sprintf (res_name, "%s%s%s", + (void) sprintf (res_name, "%s%s%s", im->core.res_name != NULL ? im->core.res_name : "*", im->core.res_name != NULL ? dotximdot : ximdot, "reconnect"); - (void) sprintf (res_class, "%s%s%s", + (void) sprintf (res_class, "%s%s%s", im->core.res_class != NULL ? im->core.res_class : "*", im->core.res_class != NULL ? dotXimdot : Ximdot, "Reconnect"); @@ -145,11 +147,11 @@ _XimSetProtoResource(im) return; } - (void) sprintf (res_name, "%s%s%s", + (void) sprintf (res_name, "%s%s%s", im->core.res_name != NULL ? im->core.res_name : "*", im->core.res_name != NULL ? dotximdot : ximdot, "preeditDefaultStyle"); - (void) sprintf (res_class, "%s%s%s", + (void) sprintf (res_class, "%s%s%s", im->core.res_class != NULL ? im->core.res_class : "*", im->core.res_class != NULL ? dotXimdot : Ximdot, "PreeditDefaultStyle"); @@ -168,11 +170,11 @@ _XimSetProtoResource(im) if(!preedit_style) preedit_style = XIMPreeditNothing; - (void) sprintf (res_name, "%s%s%s", + (void) sprintf (res_name, "%s%s%s", im->core.res_name != NULL ? im->core.res_name : "*", im->core.res_name != NULL ? dotximdot : ximdot, "statusDefaultStyle"); - (void) sprintf (res_class, "%s%s%s", + (void) sprintf (res_class, "%s%s%s", im->core.res_class != NULL ? im->core.res_class : "*", im->core.res_class != NULL ? dotXimdot : Ximdot, "StatusDefaultStyle"); @@ -204,54 +206,136 @@ _XimSetProtoResource(im) } #endif /* XIM_CONNECTABLE */ -static char *supported_local_im_values_list[] = { - XNQueryInputStyle, - XNResourceName, - XNResourceClass, - XNDestroyCallback, - XNQueryIMValuesList, - XNQueryICValuesList, - XNVisiblePosition, - (char *)NULL +static const char name_table[] = + /* 0 */ XNQueryInputStyle"\0" + /* 16 */ XNClientWindow"\0" + /* 29 */ XNInputStyle"\0" + /* 40 */ XNFocusWindow"\0" + /* 52 */ XNResourceName"\0" + /* 65 */ XNResourceClass"\0" + /* 79 */ XNGeometryCallback"\0" + /* 96 */ XNDestroyCallback"\0" + /* 112 */ XNFilterEvents"\0" + /* 125 */ XNPreeditStartCallback"\0" + /* 146 */ XNPreeditDoneCallback"\0" + /* 166 */ XNPreeditDrawCallback"\0" + /* 186 */ XNPreeditCaretCallback"\0" + /* 207 */ XNPreeditStateNotifyCallback"\0" + /* 234 */ XNPreeditAttributes"\0" + /* 252 */ XNStatusStartCallback"\0" + /* 272 */ XNStatusDoneCallback"\0" + /* 291 */ XNStatusDrawCallback"\0" + /* 310 */ XNStatusAttributes"\0" + /* 327 */ XNArea"\0" + /* 332 */ XNAreaNeeded"\0" + /* 343 */ XNSpotLocation"\0" + /* 356 */ XNColormap"\0" + /* 365 */ XNStdColormap"\0" + /* 377 */ XNForeground"\0" + /* 388 */ XNBackground"\0" + /* 399 */ XNBackgroundPixmap"\0" + /* 416 */ XNFontSet"\0" + /* 424 */ XNLineSpace"\0" + /* 434 */ XNCursor"\0" + /* 441 */ XNQueryIMValuesList"\0" + /* 459 */ XNQueryICValuesList"\0" + /* 477 */ XNVisiblePosition"\0" + /* 493 */ XNStringConversionCallback"\0" + /* 518 */ XNStringConversion"\0" + /* 535 */ XNResetState"\0" + /* 546 */ XNHotKey"\0" + /* 553 */ XNHotKeyState"\0" + /* 565 */ XNPreeditState +; + +#define OFFSET_XNQUERYINPUTSTYLE 0 +#define OFFSET_XNCLIENTWINDOW 16 +#define OFFSET_XNINPUTSTYLE 29 +#define OFFSET_XNFOCUSWINDOW 40 +#define OFFSET_XNRESOURCENAME 52 +#define OFFSET_XNRESOURCECLASS 65 +#define OFFSET_XNGEOMETRYCALLBACK 79 +#define OFFSET_XNDESTROYCALLBACK 96 +#define OFFSET_XNFILTEREVENTS 112 +#define OFFSET_XNPREEDITSTARTCALLBACK 125 +#define OFFSET_XNPREEDITDONECALLBACK 146 +#define OFFSET_XNPREEDITDRAWCALLBACK 166 +#define OFFSET_XNPREEDITCARETCALLBACK 186 +#define OFFSET_XNPREEDITSTATENOTIFYCALLBACK 207 +#define OFFSET_XNPREEDITATTRIBUTES 234 +#define OFFSET_XNSTATUSSTARTCALLBACK 252 +#define OFFSET_XNSTATUSDONECALLBACK 272 +#define OFFSET_XNSTATUSDRAWCALLBACK 291 +#define OFFSET_XNSTATUSATTRIBUTES 310 +#define OFFSET_XNAREA 327 +#define OFFSET_XNAREANEEDED 332 +#define OFFSET_XNSPOTLOCATION 343 +#define OFFSET_XNCOLORMAP 356 +#define OFFSET_XNSTDCOLORMAP 365 +#define OFFSET_XNFOREGROUND 377 +#define OFFSET_XNBACKGROUND 388 +#define OFFSET_XNBACKGROUNDPIXMAP 399 +#define OFFSET_XNFONTSET 416 +#define OFFSET_XNLINESPACE 424 +#define OFFSET_XNCURSOR 434 +#define OFFSET_XNQUERYIMVALUESLIST 441 +#define OFFSET_XNQUERYICVALUESLIST 459 +#define OFFSET_XNVISIBLEPOSITION 477 +#define OFFSET_XNSTRINGCONVERSIONCALLBACK 493 +#define OFFSET_XNSTRINGCONVERSION 518 +#define OFFSET_XNRESETSTATE 535 +#define OFFSET_XNHOTKEY 546 +#define OFFSET_XNHOTKEYSTATE 553 +#define OFFSET_XNPREEDITSTATE 565 + +/* offsets into name_table */ +static const unsigned short supported_local_im_values_list[] = { + OFFSET_XNQUERYINPUTSTYLE, + OFFSET_XNRESOURCENAME, + OFFSET_XNRESOURCECLASS, + OFFSET_XNDESTROYCALLBACK, + OFFSET_XNQUERYIMVALUESLIST, + OFFSET_XNQUERYICVALUESLIST, + OFFSET_XNVISIBLEPOSITION }; -static char *supported_local_ic_values_list[] = { - XNInputStyle, - XNClientWindow, - XNFocusWindow, - XNResourceName, - XNResourceClass, - XNGeometryCallback, - XNFilterEvents, - XNDestroyCallback, - XNStringConversionCallback, - XNStringConversion, - XNResetState, - XNHotKey, - XNHotKeyState, - XNPreeditAttributes, - XNStatusAttributes, - XNArea, - XNAreaNeeded, - XNSpotLocation, - XNColormap, - XNStdColormap, - XNForeground, - XNBackground, - XNBackgroundPixmap, - XNFontSet, - XNLineSpace, - XNCursor, - XNPreeditStartCallback, - XNPreeditDoneCallback, - XNPreeditDrawCallback, - XNPreeditCaretCallback, - XNStatusStartCallback, - XNStatusDoneCallback, - XNStatusDrawCallback, - XNPreeditState, - XNPreeditStateNotifyCallback, - (char *)NULL +/* offsets into name_table */ +static const unsigned short supported_local_ic_values_list[] = { + OFFSET_XNINPUTSTYLE, + OFFSET_XNCLIENTWINDOW, + OFFSET_XNFOCUSWINDOW, + OFFSET_XNRESOURCENAME, + OFFSET_XNRESOURCECLASS, + OFFSET_XNGEOMETRYCALLBACK, + OFFSET_XNFILTEREVENTS, + OFFSET_XNDESTROYCALLBACK, + OFFSET_XNSTRINGCONVERSIONCALLBACK, + OFFSET_XNSTRINGCONVERSIONCALLBACK, + OFFSET_XNRESETSTATE, + OFFSET_XNHOTKEY, + OFFSET_XNHOTKEYSTATE, + OFFSET_XNPREEDITATTRIBUTES, + OFFSET_XNSTATUSATTRIBUTES, + OFFSET_XNAREA, + OFFSET_XNAREANEEDED, + OFFSET_XNSPOTLOCATION, + OFFSET_XNCOLORMAP, + OFFSET_XNSTDCOLORMAP, + OFFSET_XNFOREGROUND, + OFFSET_XNBACKGROUND, + OFFSET_XNBACKGROUNDPIXMAP, + OFFSET_XNFONTSET, + OFFSET_XNLINESPACE, + OFFSET_XNCURSOR, + OFFSET_XNPREEDITSTARTCALLBACK, + OFFSET_XNPREEDITDONECALLBACK, + OFFSET_XNPREEDITDRAWCALLBACK, + OFFSET_XNPREEDITCARETCALLBACK, + OFFSET_XNSTATUSSTARTCALLBACK, + OFFSET_XNSTATUSDONECALLBACK, + OFFSET_XNSTATUSDRAWCALLBACK, + OFFSET_XNPREEDITSTATE, + OFFSET_XNPREEDITSTATENOTIFYCALLBACK }; static XIMStyle const supported_local_styles[] = { @@ -310,7 +394,7 @@ _XimDefaultIMValues( int len; XPointer tmp; - n = XIMNumber(supported_local_im_values_list) - 1; + n = XIMNumber(supported_local_im_values_list); len = sizeof(XIMValuesList) + sizeof(char **) * n; if(!(tmp = (XPointer)Xmalloc(len))) { return False; @@ -323,8 +407,8 @@ _XimDefaultIMValues( values_list->supported_values = (char **)((char *)tmp + sizeof(XIMValuesList)); for(i = 0; i < n; i++) { - values_list->supported_values[i] - = supported_local_im_values_list[i]; + values_list->supported_values[i] = + (char *)name_table + supported_local_im_values_list[i]; } } @@ -347,7 +431,7 @@ _XimDefaultICValues( int len; XPointer tmp; - n = XIMNumber(supported_local_ic_values_list) - 1; + n = XIMNumber(supported_local_ic_values_list); len = sizeof(XIMValuesList) + sizeof(char **) * n; if(!(tmp = (XPointer)Xmalloc(len))) { return False; @@ -360,8 +444,8 @@ _XimDefaultICValues( values_list->supported_values = (char **)((char *)tmp + sizeof(XIMValuesList)); for(i = 0; i < n; i++) { - values_list->supported_values[i] - = supported_local_ic_values_list[i]; + values_list->supported_values[i] = + (char *)name_table + supported_local_ic_values_list[i]; } } @@ -510,7 +594,7 @@ _XimDefaultArea( if(XGetGeometry(im->core.display, (Drawable)ic->core.focus_window, &root_return, &x_return, &y_return, &width_return, &height_return, &border_width_return, &depth_return) - == (Status)NULL) { + == (Status)Success) { return True; } area.x = 0; @@ -539,10 +623,10 @@ _XimDefaultColormap( return True; } if(XGetWindowAttributes(im->core.display, ic->core.client_window, - &win_attr) == (Status)NULL) { + &win_attr) == (Status)Success) { return True; } - + out = (Colormap *)((char *)top + info->offset); *out = win_attr.colormap; return True; @@ -1010,7 +1094,7 @@ _XimDecodeStyles( if(num >0) { out->count_styles = (unsigned short)num; out->supported_styles = (XIMStyle *)((char *)tmp + sizeof(XIMStyles)); - + for(i = 0; i < num; i++) { out->supported_styles[i] = styles->supported_styles[i]; } @@ -1049,7 +1133,7 @@ _XimDecodeValues( if(num) { out->count_values = (unsigned short)num; out->supported_values = (char **)((char *)tmp + sizeof(XIMValuesList)); - + for(i = 0; i < num; i++) { out->supported_values[i] = values_list->supported_values[i]; } @@ -1437,247 +1521,245 @@ static XIMResource ic_inner_resources[] = { }; static XimValueOffsetInfoRec im_attr_info[] = { - {XNQueryInputStyle, 0, + {OFFSET_XNQUERYINPUTSTYLE, 0, XOffsetOf(XimDefIMValues, styles), _XimDefaultStyles, NULL, _XimDecodeStyles}, - {XNDestroyCallback, 0, + {OFFSET_XNDESTROYCALLBACK, 0, XOffsetOf(XimDefIMValues, destroy_callback), NULL, _XimEncodeCallback, _XimDecodeCallback}, - {XNResourceName, 0, + {OFFSET_XNRESOURCENAME, 0, XOffsetOf(XimDefIMValues, res_name), NULL, _XimEncodeString, _XimDecodeString}, - {XNResourceClass, 0, + {OFFSET_XNRESOURCECLASS, 0, XOffsetOf(XimDefIMValues, res_class), NULL, _XimEncodeString, _XimDecodeString}, - {XNQueryIMValuesList, 0, + {OFFSET_XNQUERYIMVALUESLIST, 0, XOffsetOf(XimDefIMValues, im_values_list), _XimDefaultIMValues, NULL, _XimDecodeValues}, - {XNQueryICValuesList, 0, + {OFFSET_XNQUERYICVALUESLIST, 0, XOffsetOf(XimDefIMValues, ic_values_list), _XimDefaultICValues, NULL, _XimDecodeValues}, - {XNVisiblePosition, 0, + {OFFSET_XNVISIBLEPOSITION, 0, XOffsetOf(XimDefIMValues, visible_position), _XimDefaultVisiblePos, NULL, _XimDecodeBool} }; static XimValueOffsetInfoRec ic_attr_info[] = { - {XNInputStyle, 0, + {OFFSET_XNINPUTSTYLE, 0, XOffsetOf(XimDefICValues, input_style), NULL, _XimEncodeStyle, _XimDecodeStyle}, - {XNClientWindow, 0, + {OFFSET_XNCLIENTWINDOW, 0, XOffsetOf(XimDefICValues, client_window), NULL, _XimEncodeWindow, _XimDecodeWindow}, - {XNFocusWindow, 0, + {OFFSET_XNFOCUSWINDOW, 0, XOffsetOf(XimDefICValues, focus_window), _XimDefaultFocusWindow, _XimEncodeWindow, _XimDecodeWindow}, - {XNResourceName, 0, + {OFFSET_XNRESOURCENAME, 0, XOffsetOf(XimDefICValues, res_name), _XimDefaultResName, _XimEncodeString, _XimDecodeString}, - {XNResourceClass, 0, + {OFFSET_XNRESOURCECLASS, 0, XOffsetOf(XimDefICValues, res_class), _XimDefaultResClass, _XimEncodeString, _XimDecodeString}, - {XNGeometryCallback, 0, + {OFFSET_XNGEOMETRYCALLBACK, 0, XOffsetOf(XimDefICValues, geometry_callback), NULL, _XimEncodeCallback, _XimDecodeCallback}, - {XNFilterEvents, 0, + {OFFSET_XNFILTEREVENTS, 0, XOffsetOf(XimDefICValues, filter_events), NULL, NULL, _XimDecodeLong}, - {XNDestroyCallback, 0, + {OFFSET_XNDESTROYCALLBACK, 0, XOffsetOf(XimDefICValues, destroy_callback), _XimDefaultDestroyCB, _XimEncodeCallback, _XimDecodeCallback}, - {XNStringConversionCallback, 0, + {OFFSET_XNSTRINGCONVERSIONCALLBACK, 0, XOffsetOf(XimDefICValues, string_conversion_callback), NULL, _XimEncodeCallback, _XimDecodeCallback}, - {XNStringConversion, 0, + {OFFSET_XNSTRINGCONVERSION, 0, XOffsetOf(XimDefICValues, string_conversion), NULL, _XimEncodeStringConv, _XimDecodeStringConv}, - {XNResetState, 0, + {OFFSET_XNRESETSTATE, 0, XOffsetOf(XimDefICValues, reset_state), _XimDefaultResetState, _XimEncodeResetState, _XimDecodeResetState}, - {XNHotKey, 0, + {OFFSET_XNHOTKEY, 0, XOffsetOf(XimDefICValues, hotkey), NULL, _XimEncodeHotKey, _XimDecodeHotKey}, - {XNHotKeyState, 0, + {OFFSET_XNHOTKEYSTATE, 0, XOffsetOf(XimDefICValues, hotkey_state), _XimDefaultHotKeyState, _XimEncodeHotKetState, _XimDecodeHotKetState}, - {XNPreeditAttributes, 0, + {OFFSET_XNPREEDITATTRIBUTES, 0, XOffsetOf(XimDefICValues, preedit_attr), _XimDefaultNest, _XimEncodeNest, _XimDecodeNest}, - {XNStatusAttributes, 0, + {OFFSET_XNSTATUSATTRIBUTES, 0, XOffsetOf(XimDefICValues, status_attr), _XimDefaultNest, _XimEncodeNest, _XimDecodeNest}, }; static XimValueOffsetInfoRec ic_pre_attr_info[] = { - {XNArea, 0, + {OFFSET_XNAREA, 0, XOffsetOf(ICPreeditAttributes, area), _XimDefaultArea, _XimEncodeRectangle, _XimDecodeRectangle}, - {XNAreaNeeded, 0, + {OFFSET_XNAREANEEDED, 0, XOffsetOf(ICPreeditAttributes, area_needed), NULL, _XimEncodeRectangle, _XimDecodeRectangle}, - {XNSpotLocation, 0, + {OFFSET_XNSPOTLOCATION, 0, XOffsetOf(ICPreeditAttributes, spot_location), NULL, _XimEncodeSpot, _XimDecodeSpot}, - {XNColormap, 0, + {OFFSET_XNCOLORMAP, 0, XOffsetOf(ICPreeditAttributes, colormap), _XimDefaultColormap, _XimEncodeColormap, _XimDecodeColormap}, - {XNStdColormap, 0, + {OFFSET_XNSTDCOLORMAP, 0, XOffsetOf(ICPreeditAttributes, std_colormap), _XimDefaultStdColormap, _XimEncodeStdColormap, _XimDecodeStdColormap}, - {XNForeground, 0, + {OFFSET_XNFOREGROUND, 0, XOffsetOf(ICPreeditAttributes, foreground), _XimDefaultFg, _XimEncodeLong, _XimDecodeLong}, - {XNBackground, 0, + {OFFSET_XNBACKGROUND, 0, XOffsetOf(ICPreeditAttributes, background), _XimDefaultBg, _XimEncodeLong, _XimDecodeLong}, - {XNBackgroundPixmap, 0, + {OFFSET_XNBACKGROUNDPIXMAP, 0, XOffsetOf(ICPreeditAttributes, background_pixmap), _XimDefaultBgPixmap, _XimEncodeBgPixmap, _XimDecodeBgPixmap}, - {XNFontSet, 0, + {OFFSET_XNFONTSET, 0, XOffsetOf(ICPreeditAttributes, fontset), _XimDefaultFontSet, _XimEncodeFontSet, _XimDecodeFontSet}, - {XNLineSpace, 0, + {OFFSET_XNLINESPACE, 0, XOffsetOf(ICPreeditAttributes, line_spacing), _XimDefaultLineSpace, _XimEncodeLineSpace, _XimDecodeLineSpace}, - {XNCursor, 0, + {OFFSET_XNCURSOR, 0, XOffsetOf(ICPreeditAttributes, cursor), _XimDefaultCursor, _XimEncodeCursor, _XimDecodeCursor}, - {XNPreeditStartCallback, 0, + {OFFSET_XNPREEDITSTARTCALLBACK, 0, XOffsetOf(ICPreeditAttributes, start_callback), NULL, _XimEncodeCallback, _XimDecodeCallback}, - {XNPreeditDoneCallback, 0, + {OFFSET_XNPREEDITDONECALLBACK, 0, XOffsetOf(ICPreeditAttributes, done_callback), NULL, _XimEncodeCallback, _XimDecodeCallback}, - {XNPreeditDrawCallback, 0, + {OFFSET_XNPREEDITDRAWCALLBACK, 0, XOffsetOf(ICPreeditAttributes, draw_callback), NULL, _XimEncodeCallback, _XimDecodeCallback}, - {XNPreeditCaretCallback, 0, + {OFFSET_XNPREEDITCARETCALLBACK, 0, XOffsetOf(ICPreeditAttributes, caret_callback), NULL, _XimEncodeCallback, _XimDecodeCallback}, - {XNPreeditState, 0, + {OFFSET_XNPREEDITSTATE, 0, XOffsetOf(ICPreeditAttributes, preedit_state), _XimDefaultPreeditState, _XimEncodePreeditState,_XimDecodePreeditState}, - {XNPreeditStateNotifyCallback, 0, + {OFFSET_XNPREEDITSTATENOTIFYCALLBACK, 0, XOffsetOf(ICPreeditAttributes, state_notify_callback), NULL, _XimEncodeCallback, _XimDecodeCallback}, }; static XimValueOffsetInfoRec ic_sts_attr_info[] = { - {XNArea, 0, + {OFFSET_XNAREA, 0, XOffsetOf(ICStatusAttributes, area), _XimDefaultArea, _XimEncodeRectangle, _XimDecodeRectangle}, - {XNAreaNeeded, 0, + {OFFSET_XNAREANEEDED, 0, XOffsetOf(ICStatusAttributes, area_needed), NULL, _XimEncodeRectangle, _XimDecodeRectangle}, - {XNColormap, 0, + {OFFSET_XNCOLORMAP, 0, XOffsetOf(ICStatusAttributes, colormap), _XimDefaultColormap, _XimEncodeColormap, _XimDecodeColormap}, - {XNStdColormap, 0, + {OFFSET_XNSTDCOLORMAP, 0, XOffsetOf(ICStatusAttributes, std_colormap), _XimDefaultStdColormap, _XimEncodeStdColormap, _XimDecodeStdColormap}, - {XNForeground, 0, + {OFFSET_XNFOREGROUND, 0, XOffsetOf(ICStatusAttributes, foreground), _XimDefaultFg, _XimEncodeLong, _XimDecodeLong}, - {XNBackground, 0, + {OFFSET_XNBACKGROUND, 0, XOffsetOf(ICStatusAttributes, background), _XimDefaultBg, _XimEncodeLong, _XimDecodeLong}, - {XNBackgroundPixmap, 0, + {OFFSET_XNBACKGROUNDPIXMAP, 0, XOffsetOf(ICStatusAttributes, background_pixmap), _XimDefaultBgPixmap, _XimEncodeBgPixmap, _XimDecodeBgPixmap}, - {XNFontSet, 0, + {OFFSET_XNFONTSET, 0, XOffsetOf(ICStatusAttributes, fontset), _XimDefaultFontSet, _XimEncodeFontSet, _XimDecodeFontSet}, - {XNLineSpace, 0, + {OFFSET_XNLINESPACE, 0, XOffsetOf(ICStatusAttributes, line_spacing), _XimDefaultLineSpace, _XimEncodeLineSpace, _XimDecodeLineSpace}, - {XNCursor, 0, + {OFFSET_XNCURSOR, 0, XOffsetOf(ICStatusAttributes, cursor), _XimDefaultCursor, _XimEncodeCursor, _XimDecodeCursor}, - {XNStatusStartCallback, 0, + {OFFSET_XNSTATUSSTARTCALLBACK, 0, XOffsetOf(ICStatusAttributes, start_callback), NULL, _XimEncodeCallback, _XimDecodeCallback}, - {XNStatusDoneCallback, 0, + {OFFSET_XNSTATUSDONECALLBACK, 0, XOffsetOf(ICStatusAttributes, done_callback), NULL, _XimEncodeCallback, _XimDecodeCallback}, - {XNStatusDrawCallback, 0, + {OFFSET_XNSTATUSDRAWCALLBACK, 0, XOffsetOf(ICStatusAttributes, draw_callback), NULL, _XimEncodeCallback, _XimDecodeCallback} }; typedef struct _XimIMMode { - char *name; - XrmQuark quark; + unsigned short name_offset; unsigned short mode; } XimIMMode; -static XimIMMode im_mode[] = { - {XNQueryInputStyle, 0, +static const XimIMMode im_mode[] = { + {OFFSET_XNQUERYINPUTSTYLE, (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_GET)}, - {XNDestroyCallback, 0, + {OFFSET_XNDESTROYCALLBACK, (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_SET | XIM_MODE_IM_GET)}, - {XNResourceName, 0, + {OFFSET_XNRESOURCENAME, (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_SET | XIM_MODE_IM_GET)}, - {XNResourceClass, 0, + {OFFSET_XNRESOURCECLASS, (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_SET | XIM_MODE_IM_GET)}, - {XNQueryIMValuesList, 0, + {OFFSET_XNQUERYIMVALUESLIST, (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_GET)}, - {XNQueryICValuesList, 0, + {OFFSET_XNQUERYICVALUESLIST, (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_GET)}, - {XNVisiblePosition, 0, + {OFFSET_XNVISIBLEPOSITION, (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_GET)} }; typedef struct _XimICMode { - char *name; - XrmQuark quark; + unsigned short name_offset; unsigned short preedit_callback_mode; unsigned short preedit_position_mode; unsigned short preedit_area_mode; @@ -1689,8 +1771,8 @@ typedef struct _XimICMode { unsigned short status_none_mode; } XimICMode; -static XimICMode ic_mode[] = { - {XNInputStyle, 0, +static const XimICMode ic_mode[] = { + {OFFSET_XNINPUTSTYLE, (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_GET), (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_GET), (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_GET), @@ -1700,7 +1782,7 @@ static XimICMode ic_mode[] = { (XIM_MODE_STS_CREATE | XIM_MODE_STS_GET), (XIM_MODE_STS_CREATE | XIM_MODE_STS_GET), (XIM_MODE_STS_CREATE | XIM_MODE_STS_GET)}, - {XNClientWindow, 0, + {OFFSET_XNCLIENTWINDOW, (XIM_MODE_PRE_ONCE | XIM_MODE_PRE_GET), (XIM_MODE_PRE_ONCE | XIM_MODE_PRE_GET), (XIM_MODE_PRE_ONCE | XIM_MODE_PRE_GET), @@ -1710,7 +1792,7 @@ static XimICMode ic_mode[] = { (XIM_MODE_STS_ONCE | XIM_MODE_STS_GET), (XIM_MODE_STS_ONCE | XIM_MODE_STS_GET), 0}, - {XNFocusWindow, 0, + {OFFSET_XNFOCUSWINDOW, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), @@ -1720,7 +1802,7 @@ static XimICMode ic_mode[] = { (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), 0}, - {XNResourceName, 0, + {OFFSET_XNRESOURCENAME, 0, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), @@ -1730,7 +1812,7 @@ static XimICMode ic_mode[] = { (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), 0}, - {XNResourceClass, 0, + {OFFSET_XNRESOURCECLASS, 0, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), @@ -1740,7 +1822,7 @@ static XimICMode ic_mode[] = { (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), 0}, - {XNGeometryCallback, 0, + {OFFSET_XNGEOMETRYCALLBACK, 0, 0, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), @@ -1750,7 +1832,7 @@ static XimICMode ic_mode[] = { (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), 0, 0}, - {XNFilterEvents, 0, + {OFFSET_XNFILTEREVENTS, XIM_MODE_PRE_GET, XIM_MODE_PRE_GET, XIM_MODE_PRE_GET, @@ -1760,7 +1842,7 @@ static XimICMode ic_mode[] = { XIM_MODE_STS_GET, XIM_MODE_STS_GET, XIM_MODE_STS_GET}, - {XNDestroyCallback, 0, + {OFFSET_XNDESTROYCALLBACK, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), @@ -1770,7 +1852,7 @@ static XimICMode ic_mode[] = { 0, 0, 0}, - {XNStringConversionCallback, 0, + {OFFSET_XNSTRINGCONVERSIONCALLBACK, (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), @@ -1780,7 +1862,7 @@ static XimICMode ic_mode[] = { 0, 0, 0}, - {XNStringConversion, 0, + {OFFSET_XNSTRINGCONVERSION, XIM_MODE_PRE_SET, XIM_MODE_PRE_SET, XIM_MODE_PRE_SET, @@ -1790,7 +1872,7 @@ static XimICMode ic_mode[] = { 0, 0, 0}, - {XNResetState, 0, + {OFFSET_XNRESETSTATE, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), @@ -1800,7 +1882,7 @@ static XimICMode ic_mode[] = { 0, 0, 0}, - {XNHotKey, 0, + {OFFSET_XNHOTKEY, (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), @@ -1810,7 +1892,7 @@ static XimICMode ic_mode[] = { 0, 0, 0}, - {XNHotKeyState, 0, + {OFFSET_XNHOTKEYSTATE, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), @@ -1820,7 +1902,7 @@ static XimICMode ic_mode[] = { 0, 0, 0}, - {XNPreeditAttributes, 0, + {OFFSET_XNPREEDITATTRIBUTES, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), @@ -1830,7 +1912,7 @@ static XimICMode ic_mode[] = { 0, 0, 0}, - {XNStatusAttributes, 0, + {OFFSET_XNSTATUSATTRIBUTES, 0, 0, 0, @@ -1840,7 +1922,7 @@ static XimICMode ic_mode[] = { (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), 0}, - {XNArea, 0, + {OFFSET_XNAREA, 0, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), @@ -1850,7 +1932,7 @@ static XimICMode ic_mode[] = { (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), 0, 0}, - {XNAreaNeeded, 0, + {OFFSET_XNAREANEEDED, 0, 0, (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), @@ -1860,7 +1942,7 @@ static XimICMode ic_mode[] = { (XIM_MODE_STS_SET | XIM_MODE_STS_GET), 0, 0}, - {XNSpotLocation, 0, + {OFFSET_XNSPOTLOCATION, 0, /*(XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),*/ (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), 0, @@ -1870,7 +1952,7 @@ static XimICMode ic_mode[] = { 0, 0, 0}, - {XNColormap, 0, + {OFFSET_XNCOLORMAP, 0, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), @@ -1880,7 +1962,7 @@ static XimICMode ic_mode[] = { (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), 0}, - {XNStdColormap, 0, + {OFFSET_XNSTDCOLORMAP, 0, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), @@ -1890,7 +1972,7 @@ static XimICMode ic_mode[] = { (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), 0}, - {XNForeground, 0, + {OFFSET_XNFOREGROUND, 0, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), @@ -1900,7 +1982,7 @@ static XimICMode ic_mode[] = { (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), 0}, - {XNBackground, 0, + {OFFSET_XNBACKGROUND, 0, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), @@ -1910,7 +1992,7 @@ static XimICMode ic_mode[] = { (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), 0}, - {XNBackgroundPixmap, 0, + {OFFSET_XNBACKGROUNDPIXMAP, 0, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), @@ -1920,7 +2002,7 @@ static XimICMode ic_mode[] = { (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), 0}, - {XNFontSet, 0, + {OFFSET_XNFONTSET, 0, (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), @@ -1930,7 +2012,7 @@ static XimICMode ic_mode[] = { (XIM_MODE_STS_CREATE | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), 0}, - {XNLineSpace, 0, + {OFFSET_XNLINESPACE, 0, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), @@ -1940,7 +2022,7 @@ static XimICMode ic_mode[] = { (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), 0}, - {XNCursor, 0, + {OFFSET_XNCURSOR, 0, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), @@ -1950,7 +2032,7 @@ static XimICMode ic_mode[] = { (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), 0}, - {XNPreeditStartCallback, 0, + {OFFSET_XNPREEDITSTARTCALLBACK, (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), 0, 0, @@ -1960,7 +2042,7 @@ static XimICMode ic_mode[] = { 0, 0, 0}, - {XNPreeditDoneCallback, 0, + {OFFSET_XNPREEDITDONECALLBACK, (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), 0, 0, @@ -1970,7 +2052,7 @@ static XimICMode ic_mode[] = { 0, 0, 0}, - {XNPreeditDrawCallback, 0, + {OFFSET_XNPREEDITDRAWCALLBACK, (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), 0, 0, @@ -1980,7 +2062,7 @@ static XimICMode ic_mode[] = { 0, 0, 0}, - {XNPreeditCaretCallback, 0, + {OFFSET_XNPREEDITCARETCALLBACK, (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), 0, 0, @@ -1990,7 +2072,7 @@ static XimICMode ic_mode[] = { 0, 0, 0}, - {XNPreeditState, 0, + {OFFSET_XNPREEDITSTATE, (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), @@ -2000,7 +2082,7 @@ static XimICMode ic_mode[] = { 0, 0, 0}, - {XNPreeditStateNotifyCallback, 0, + {OFFSET_XNPREEDITSTATENOTIFYCALLBACK, (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), @@ -2010,7 +2092,7 @@ static XimICMode ic_mode[] = { 0, 0, 0}, - {XNStatusStartCallback, 0, + {OFFSET_XNSTATUSSTARTCALLBACK, 0, 0, 0, @@ -2020,7 +2102,7 @@ static XimICMode ic_mode[] = { 0, 0, 0}, - {XNStatusDoneCallback, 0, + {OFFSET_XNSTATUSDONECALLBACK, 0, 0, 0, @@ -2030,7 +2112,7 @@ static XimICMode ic_mode[] = { 0, 0, 0}, - {XNStatusDrawCallback, 0, + {OFFSET_XNSTATUSDRAWCALLBACK, 0, 0, 0, @@ -2042,6 +2124,12 @@ static XimICMode ic_mode[] = { 0} }; +/* the quarks are separated from im_mode/ic_mode so those arrays + * can be const. + */ +static XrmQuark im_mode_quark[sizeof(im_mode) / sizeof(im_mode[0])]; +static XrmQuark ic_mode_quark[sizeof(ic_mode) / sizeof(ic_mode[0])]; + Private Bool _XimSetResourceList( XIMResourceList *res_list, @@ -2154,7 +2242,7 @@ Public XIMResourceList _XimGetResourceListRec( XIMResourceList res_list, unsigned int list_num, - char *name) + const char *name) { XrmQuark quark = XrmStringToQuark(name); @@ -2177,13 +2265,13 @@ _XimSetIMValueData( if(!(res = _XimGetResourceListRec(res_list, list_num, p->name))) { return p->value; } - check = _XimCheckIMMode(res, XIM_SETIMVALUES); + check = _XimCheckIMMode(res, XIM_SETIMVALUES); if(check == XIM_CHECK_INVALID) { continue; } else if (check == XIM_CHECK_ERROR) { return p->value; } - + if(!_XimEncodeLocalIMAttr(res, top, p->value)) { return p->value; } @@ -2207,13 +2295,13 @@ _XimGetIMValueData( if(!(res = _XimGetResourceListRec(res_list, list_num, p->name))) { return p->value; } - check = _XimCheckIMMode(res, XIM_GETIMVALUES); + check = _XimCheckIMMode(res, XIM_GETIMVALUES); if(check == XIM_CHECK_INVALID) { continue; } else if (check == XIM_CHECK_ERROR) { return p->value; } - + if(!_XimDecodeLocalIMAttr(res, top, p->value)) { return p->value; } @@ -2232,7 +2320,7 @@ _XimSetIMMode( for(i = 0; i < n; i++) { if(!(res = _XimGetResourceListRecByQuark(res_list, - list_num, im_mode[i].quark))) { + list_num, im_mode_quark[i]))) { continue; } res->mode = im_mode[i].mode; @@ -2290,10 +2378,7 @@ Public int } Public void -_XimSetICMode(res_list, list_num, style) - XIMResourceList res_list; - unsigned int list_num; - XIMStyle style; +_XimSetICMode(XIMResourceList res_list, unsigned int list_num, XIMStyle style) { XIMResourceList res; unsigned int n = XIMNumber(ic_mode); @@ -2325,7 +2410,7 @@ _XimSetICMode(res_list, list_num, style) for(i = 0; i < n; i++) { if(!(res = _XimGetResourceListRecByQuark(res_list, - list_num, ic_mode[i].quark))) { + list_num, ic_mode_quark[i]))) { continue; } res->mode = ( (*(unsigned short *)((char *)&ic_mode[i] + pre_offset)) @@ -2542,7 +2627,7 @@ _XimSetLocalIMDefaults( for(i = 0; i < num; i++) { if((res = _XimGetResourceListRecByQuark( res_list, list_num, - info[i].quark)) == (XIMResourceList)NULL) { + info[i].quark)) == (XIMResourceList)NULL) { return False; } @@ -2700,7 +2785,7 @@ _XimEncodeLocalTopValue( if (flag) { _XRegisterFilterByType(ic->core.im->core.display, ic->core.focus_window, - KeyPress, KeyPress, _XimLocalFilter, (XPointer)ic); + KeyPress, KeyRelease, _XimLocalFilter, (XPointer)ic); } } else if (res->xrm_name == XrmStringToQuark(XNFocusWindow)) { if (ic->core.client_window) { @@ -2711,7 +2796,7 @@ _XimEncodeLocalTopValue( ic->core.focus_window = (Window)p->value; if (flag) { _XRegisterFilterByType(ic->core.im->core.display, - ic->core.focus_window, KeyPress, KeyPress, + ic->core.focus_window, KeyPress, KeyRelease, _XimLocalFilter, (XPointer)ic); } } else @@ -2887,7 +2972,7 @@ _XimDecodeAttr( if(!info[i].decode) { return False; } - return (*info[i].decode)(&info[i], top, val); + return (*info[i].decode)(&info[i], top, val); } } return False; @@ -2928,13 +3013,8 @@ _XimDecodeLocalICAttr( } Public char * -_XimGetICValueData(ic, top, res_list, list_num, values, mode) - Xic ic; - XPointer top; - XIMResourceList res_list; - unsigned int list_num; - XIMArg *values; - unsigned long mode; +_XimGetICValueData(Xic ic, XPointer top, XIMResourceList res_list, + unsigned int list_num, XIMArg *values, unsigned long mode) { register XIMArg *p; XIMResourceList res; @@ -2982,9 +3062,7 @@ _XimGetICValueData(ic, top, res_list, list_num, values, mode) } Public void -_XimGetCurrentIMValues(im, im_values) - Xim im; - XimDefIMValues *im_values; +_XimGetCurrentIMValues(Xim im, XimDefIMValues *im_values) { bzero((char *)im_values, sizeof(XimDefIMValues)); @@ -2998,9 +3076,7 @@ _XimGetCurrentIMValues(im, im_values) } Public void -_XimSetCurrentIMValues(im, im_values) - Xim im; - XimDefIMValues *im_values; +_XimSetCurrentIMValues(Xim im, XimDefIMValues *im_values) { im->core.styles = im_values->styles; im->core.im_values_list = im_values->im_values_list; @@ -3012,9 +3088,7 @@ _XimSetCurrentIMValues(im, im_values) } Public void -_XimGetCurrentICValues(ic, ic_values) - Xic ic; - XimDefICValues *ic_values; +_XimGetCurrentICValues(Xic ic, XimDefICValues *ic_values) { bzero((char *)ic_values, sizeof(XimDefICValues)); @@ -3067,7 +3141,7 @@ _XimInitialIMOffsetInfo(void) register int i; for(i = 0; i < n; i++) { - im_attr_info[i].quark = XrmStringToQuark(im_attr_info[i].name); + im_attr_info[i].quark = XrmStringToQuark(GET_NAME(im_attr_info[i])); } } @@ -3079,17 +3153,17 @@ _XimInitialICOffsetInfo(void) n = XIMNumber(ic_attr_info); for(i = 0; i < n; i++) { - ic_attr_info[i].quark = XrmStringToQuark(ic_attr_info[i].name); + ic_attr_info[i].quark = XrmStringToQuark(GET_NAME(ic_attr_info[i])); } n = XIMNumber(ic_pre_attr_info); for(i = 0; i < n; i++) { - ic_pre_attr_info[i].quark = XrmStringToQuark(ic_pre_attr_info[i].name); + ic_pre_attr_info[i].quark = XrmStringToQuark(GET_NAME(ic_pre_attr_info[i])); } n = XIMNumber(ic_sts_attr_info); for(i = 0; i < n; i++) { - ic_sts_attr_info[i].quark = XrmStringToQuark(ic_sts_attr_info[i].name); + ic_sts_attr_info[i].quark = XrmStringToQuark(GET_NAME(ic_sts_attr_info[i])); } } @@ -3100,7 +3174,7 @@ _XimInitialIMMode(void) register int i; for(i = 0; i < n; i++) { - im_mode[i].quark = XrmStringToQuark(im_mode[i].name); + im_mode_quark[i] = XrmStringToQuark(GET_NAME(im_mode[i])); } } @@ -3111,7 +3185,7 @@ _XimInitialICMode(void) register int i; for(i = 0; i < n; i++) { - ic_mode[i].quark = XrmStringToQuark(ic_mode[i].name); + ic_mode_quark[i] = XrmStringToQuark(GET_NAME(ic_mode[i])); } } |