Back to index

im-sdk  12.3.91
iiimpICG.c
Go to the documentation of this file.
00001 /*
00002 Copyright 1990-2001 Sun Microsystems, Inc. All Rights Reserved.
00003 
00004 Permission is hereby granted, free of charge, to any person obtaining a
00005 copy of this software and associated documentation files (the
00006 "Software"), to deal in the Software without restriction, including
00007 without limitation the rights to use, copy, modify, merge, publish,
00008 distribute, sublicense, and/or sell copies of the Software, and to
00009 permit persons to whom the Software is furnished to do so, subject to
00010 the following conditions: The above copyright notice and this
00011 permission notice shall be included in all copies or substantial
00012 portions of the Software.
00013 
00014 
00015 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00016 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00017 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00018 IN NO EVENT SHALL THE OPEN GROUP OR SUN MICROSYSTEMS, INC. BE LIABLE
00019 FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
00020 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
00021 THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE EVEN IF
00022 ADVISED IN ADVANCE OF THE POSSIBILITY OF SUCH DAMAGES.
00023 
00024 
00025 Except as contained in this notice, the names of The Open Group and/or
00026 Sun Microsystems, Inc. shall not be used in advertising or otherwise to
00027 promote the sale, use or other dealings in this Software without prior
00028 written authorization from The Open Group and/or Sun Microsystems,
00029 Inc., as applicable.
00030 
00031 
00032 X Window System is a trademark of The Open Group
00033 
00034 OSF/1, OSF/Motif and Motif are registered trademarks, and OSF, the OSF
00035 logo, LBX, X Window System, and Xinerama are trademarks of the Open
00036 Group. All other trademarks and registered trademarks mentioned herein
00037 are the property of their respective owners. No right, title or
00038 interest in or to any trademark, service mark, logo or trade name of
00039 Sun Microsystems, Inc. or its licensors is granted.
00040 
00041 */
00042 #include "iiimpIM.h"
00043 #include "iiimpICG.h"
00044 #include "XimpIm.h"
00045 #include "guiIM.h"
00046 
00047 int
00048 GetAreaNeededWidth(XicCommon ic) {
00049   unsigned int width = 0;
00050   if (XIMP_CHK_PREFONTMASK(ic)) { /* we can do something */
00051     XFontSet fs = ic->core.preedit_attr.fontset;
00052     XFontSetExtents *fsx = XExtentsOfFontSet(fs);
00053     if (fsx) {
00054       width = fsx->max_logical_extent.width * MAX_PREEDIT_CHARNUM;
00055     }
00056   }
00057   if (width == 0) width = 100;
00058   return width;
00059 }
00060 
00061 int
00062 GetAreaNeededHeight(XicCommon ic) {
00063   unsigned int height = 0;
00064   if (XIMP_CHK_PREFONTMASK(ic)) { /* we can do something */
00065     XFontSet fs = ic->core.preedit_attr.fontset;
00066     XFontSetExtents *fsx = XExtentsOfFontSet(fs);
00067     if (fsx) {
00068       height  = fsx->max_logical_extent.height;
00069     }
00070   }
00071   if (height == 0) height = 16;
00072   return height;
00073 }
00074 
00075 static Bool
00076 PreGetAttributes(XicCommon ic, XIMArg *vl,
00077                XimpChangeaMask change_mask,
00078                char **return_name) {
00079   XIMArg *p;
00080   XRectangle *p_rect;
00081   XPoint *p_point;
00082   XIMCallback *p_callback;
00083 
00084   for (p = vl; p->name != NULL; p++) {
00085     if (strcmp(p->name, XNArea)==0) {
00086       if (XIMP_CHK_PREAREAMASK(ic)) {
00087        if ((p_rect = (XRectangle *)Xmalloc(sizeof(XRectangle))) == NULL) {
00088          *return_name = p->name;
00089          return(False);
00090        }
00091        p_rect->x       = ic->core.preedit_attr.area.x;
00092        p_rect->y       = ic->core.preedit_attr.area.y;
00093        p_rect->width   = ic->core.preedit_attr.area.width;
00094        p_rect->height  = ic->core.preedit_attr.area.height;
00095       } else {
00096        *return_name = p->name;
00097        return(False);
00098       }
00099       *((XRectangle **)(p->value)) = p_rect;
00100     } else if (strcmp(p->name, XNAreaNeeded)==0) {
00101       if ((p_rect = (XRectangle *)Xmalloc(sizeof(XRectangle))) == NULL) {
00102        *return_name = p->name;
00103        return(False);
00104       }
00105       memset(p_rect, 0, sizeof(XRectangle));
00106 
00107       p_rect->x  = p_rect->y  = 0;
00108 
00109       if (XIMP_CHK_PREAREANEEDMASK(ic) &&
00110          ((p_rect->width = ic->core.preedit_attr.area_needed.width) > 0) &&
00111          ((p_rect->height = ic->core.preedit_attr.area_needed.height) > 0)
00112          ) {
00113        goto All_Set;
00114       }
00115       if (p_rect->width == 0 || p_rect->height == 0) {
00116        if (p_rect->width == 0) {
00117          p_rect->width = GetAreaNeededWidth(ic);
00118        }
00119        if (p_rect->height == 0) {
00120          p_rect->height  = GetAreaNeededHeight(ic);
00121        }
00122       }
00123     All_Set:
00124       /* For next query  */
00125       ic->core.preedit_attr.area_needed.width = p_rect->width;
00126       ic->core.preedit_attr.area_needed.height = p_rect->height;
00127       XIMP_SET_PREAREANEEDMASK(ic, change_mask);
00128 
00129       *((XRectangle **)(p->value)) = p_rect;
00130 
00131     } else if (strcmp(p->name, XNSpotLocation)==0) {
00132       if (XIMP_CHK_PRESPOTLMASK(ic)) {
00133        if ((p_point = (XPoint *)Xmalloc(sizeof(XPoint))) == NULL) {
00134          *return_name = p->name;
00135          return(False);
00136        }
00137        p_point->x = ic->core.preedit_attr.spot_location.x;
00138        p_point->y = ic->core.preedit_attr.spot_location.y;
00139       } else {
00140        *return_name = p->name;
00141        return(False);
00142       }
00143       *((XPoint **)(p->value)) = p_point;
00144     } else if (strcmp(p->name, XNColormap)==0) {
00145       if (XIMP_CHK_PRECOLORMAPMASK(ic)) {
00146        *((Colormap *)(p->value)) = ic->core.preedit_attr.colormap;
00147       } else {
00148        *return_name = p->name;
00149        return(False);
00150       }
00151     } else if (strcmp(p->name, XNStdColormap)==0) {
00152       if (XIMP_CHK_PRESTDCOLORMAPMASK(ic))
00153        *((Atom *)(p->value)) = ic->core.preedit_attr.std_colormap;
00154       else {
00155        *return_name = p->name;
00156        return(False);
00157       }
00158     } else if (strcmp(p->name, XNBackground)==0) {
00159       if (XIMP_CHK_PREBGMASK(ic)) {
00160        *((unsigned long *)(p->value)) = ic->core.preedit_attr.background;
00161       } else {
00162        *return_name = p->name;
00163        return(False);
00164       }
00165     } else if (strcmp(p->name, XNForeground)==0) {
00166       if (XIMP_CHK_PREFGMASK(ic)) {
00167        *((unsigned long *)(p->value)) = ic->core.preedit_attr.foreground;
00168       } else {
00169        *return_name = p->name;
00170        return(False);
00171       }
00172     } else if (strcmp(p->name, XNBackgroundPixmap)==0) {
00173       if (XIMP_CHK_PREBGPIXMAPMASK(ic)) {
00174        *((Pixmap *)(p->value)) = ic->core.preedit_attr.background_pixmap;
00175       } else {
00176        *return_name = p->name;
00177        return(False);
00178       }
00179     } else if (strcmp(p->name, XNFontSet)==0) {
00180       if (XIMP_CHK_PREFONTMASK(ic)) {
00181        *((XFontSet *)(p->value)) = ic->core.preedit_attr.fontset;
00182       } else {
00183        *return_name = p->name;
00184        return(False);
00185       }
00186     } else if (strcmp(p->name, XNLineSpace)==0) {
00187       if (XIMP_CHK_PRELINESPMASK(ic)) {
00188        *((int *)(p->value)) = ic->core.preedit_attr.line_spacing;
00189       } else {
00190        *return_name = p->name;
00191        return(False);
00192       }
00193     } else if (strcmp(p->name, XNCursor)==0) {
00194       if (XIMP_CHK_PRECURSORMASK(ic)) {
00195        *((Cursor *)(p->value)) = ic->core.preedit_attr.cursor;
00196       } else {
00197        *return_name = p->name;
00198        return(False);
00199       }
00200     } else if (strcmp(p->name, XNPreeditStartCallback)==0) {
00201       if ((int)ic->core.preedit_attr.start_callback.callback) {
00202        if ((p_callback = (XIMCallback *)Xmalloc(sizeof(XIMCallback))) == NULL) {
00203          *return_name = p->name;
00204          return(False);
00205        }
00206        p_callback->client_data =
00207          ic->core.preedit_attr.start_callback.client_data;
00208        p_callback->callback =
00209          ic->core.preedit_attr.start_callback.callback;
00210        *((XIMCallback **)(p->value)) = p_callback;
00211       } else {
00212        *return_name = p->name;
00213        return(False);
00214       }
00215     } else if (strcmp(p->name, XNPreeditDrawCallback)==0) {
00216       if ((int)ic->core.preedit_attr.draw_callback.callback) {
00217        if ((p_callback = (XIMCallback *)Xmalloc(sizeof(XIMCallback))) == NULL) {
00218          *return_name = p->name;
00219          return(False);
00220        }
00221        p_callback->client_data =
00222          ic->core.preedit_attr.draw_callback.client_data;
00223        p_callback->callback =
00224          ic->core.preedit_attr.draw_callback.callback;
00225        *((XIMCallback **)(p->value)) = p_callback;
00226       } else {
00227        *return_name = p->name;
00228        return(False);
00229       }
00230     } else if (strcmp(p->name, XNPreeditDoneCallback)==0) {
00231       if ((int)ic->core.preedit_attr.done_callback.callback) {
00232        if ((p_callback = (XIMCallback *)Xmalloc(sizeof(XIMCallback))) == NULL) {
00233          *return_name = p->name;
00234          return(False);
00235        }
00236        p_callback->client_data =
00237          ic->core.preedit_attr.done_callback.client_data;
00238        p_callback->callback =
00239          ic->core.preedit_attr.done_callback.callback;
00240        *((XIMCallback **)(p->value)) = p_callback;
00241       } else {
00242        *return_name = p->name;
00243        return(False);
00244       }
00245     } else if (strcmp(p->name, XNPreeditCaretCallback)==0) {
00246       if ((int)ic->core.preedit_attr.caret_callback.callback) {
00247        if ((p_callback = (XIMCallback *)Xmalloc(sizeof(XIMCallback))) == NULL) {
00248          *return_name = p->name;
00249          return(False);
00250        }
00251        p_callback->client_data =
00252          ic->core.preedit_attr.caret_callback.client_data;
00253        p_callback->callback =
00254          ic->core.preedit_attr.caret_callback.callback;
00255        *((XIMCallback **)(p->value)) = p_callback;
00256       } else {
00257        *return_name = p->name;
00258        return(False);
00259       }
00260     } else if (strcmp(p->name, XNPreeditState)==0) {
00261       *((XIMPreeditState*)(p->value)) = ic->core.preedit_attr.preedit_state;
00262     } else if (strcmp(p->name, XNPreeditStateNotifyCallback)==0) {
00263       if ((int)ic->core.preedit_attr.state_notify_callback.callback) {
00264        if ((p_callback = (XIMCallback *)Xmalloc(sizeof(XIMCallback))) == NULL) {
00265          *return_name = p->name;
00266          return(False);
00267        }
00268        p_callback->client_data =
00269          ic->core.preedit_attr.state_notify_callback.client_data;
00270        p_callback->callback =
00271          ic->core.preedit_attr.state_notify_callback.callback;
00272        *((XIMCallback **)(p->value)) = p_callback;
00273       } else {
00274        *return_name = p->name;
00275        return(False);
00276       }
00277  /* private XIC extention */
00278     } else if (strcmp(p->name, XNLookupStartCallback)==0) {
00279       if (ic->lookup_start_callback.callback) {
00280        if ((p_callback = (XIMCallback *)Xmalloc(sizeof(XIMCallback))) == NULL) {
00281          *return_name = p->name;
00282          return(False);
00283        }
00284        p_callback->client_data =
00285          ic->lookup_start_callback.client_data;
00286        p_callback->callback =
00287          ic->lookup_start_callback.callback;
00288        *((XIMCallback **)(p->value)) = p_callback;
00289       } else {
00290        *return_name = p->name;
00291        return(False);
00292       }
00293     } else if (strcmp(p->name, XNLookupDrawCallback)==0) {
00294       if (ic->lookup_draw_callback.callback) {
00295        if ((p_callback = (XIMCallback *)Xmalloc(sizeof(XIMCallback))) == NULL) {
00296          *return_name = p->name;
00297          return(False);
00298        }
00299        p_callback->client_data =
00300          ic->lookup_draw_callback.client_data;
00301        p_callback->callback =
00302          ic->lookup_draw_callback.callback;
00303        *((XIMCallback **)(p->value)) = p_callback;
00304       } else {
00305        *return_name = p->name;
00306        return(False);
00307       }
00308     } else if (strcmp(p->name, XNLookupDoneCallback)==0) {
00309       if (ic->lookup_done_callback.callback) {
00310        if ((p_callback = (XIMCallback *)Xmalloc(sizeof(XIMCallback))) == NULL) {
00311          *return_name = p->name;
00312          return(False);
00313        }
00314        p_callback->client_data =
00315          ic->lookup_done_callback.client_data;
00316        p_callback->callback =
00317          ic->lookup_done_callback.callback;
00318        *((XIMCallback **)(p->value)) = p_callback;
00319       } else {
00320        *return_name = p->name;
00321        return(False);
00322       }
00323     } else if (strcmp(p->name, XNSwitchIMNotifyCallback)==0) {
00324       if (ic->switchim_notify_callback.callback) {
00325        if ((p_callback = (XIMCallback *)Xmalloc(sizeof(XIMCallback))) == NULL) {
00326          *return_name = p->name;
00327          return(False);
00328        }
00329        p_callback->client_data =
00330          ic->switchim_notify_callback.client_data;
00331        p_callback->callback =
00332          ic->switchim_notify_callback.callback;
00333        *((XIMCallback **)(p->value)) = p_callback;
00334       } else {
00335        *return_name = p->name;
00336        return(False);
00337       }
00338     } else if (strcmp(p->name, XNCommitStringCallback)==0) {
00339       if (ic->commit_string_callback.callback) {
00340        if ((p_callback = (XIMCallback *)Xmalloc(sizeof(XIMCallback))) == NULL) {
00341          *return_name = p->name;
00342          return(False);
00343        }
00344        p_callback->client_data =
00345          ic->commit_string_callback.client_data;
00346        p_callback->callback =
00347          ic->commit_string_callback.callback;
00348        *((XIMCallback **)(p->value)) = p_callback;
00349       } else {
00350        *return_name = p->name;
00351        return(False);
00352       }
00353     } else if (strcmp(p->name, XNForwardEventCallback)==0) {
00354       if (ic->forward_event_callback.callback) {
00355        if ((p_callback = (XIMCallback *)Xmalloc(sizeof(XIMCallback))) == NULL) {
00356          *return_name = p->name;
00357          return(False);
00358        }
00359        p_callback->client_data =
00360          ic->forward_event_callback.client_data;
00361        p_callback->callback =
00362          ic->forward_event_callback.callback;
00363        *((XIMCallback **)(p->value)) = p_callback;
00364       } else {
00365        *return_name = p->name;
00366        return(False);
00367       }
00368     }
00369   }
00370   return(True);
00371 }
00372 
00373 static Bool
00374 StatusGetAttributes(XicCommon ic, XIMArg *vl,
00375                   XimpChangeaMask change_mask,
00376                   char **return_name) {
00377   XIMArg *p;
00378   XRectangle *p_rect;
00379   XIMCallback *p_callback;
00380 
00381   for (p = vl; p->name != NULL; p++) {
00382     if (strcmp(p->name, XNArea)==0) {
00383       if (XIMP_CHK_STSAREAMASK(ic)) {
00384        if ((p_rect = (XRectangle *)Xmalloc(sizeof(XRectangle))) == NULL) {
00385          *return_name = p->name;
00386          return(False);
00387        }
00388        p_rect->x       = ic->core.status_attr.area.x;
00389        p_rect->y       = ic->core.status_attr.area.y;
00390        p_rect->width   = ic->core.status_attr.area.width;
00391        p_rect->height  = ic->core.status_attr.area.height;
00392       } else {
00393        *return_name = p->name;
00394        return(False);
00395       }
00396       *((XRectangle **)(p->value)) = p_rect;
00397 
00398     } else if (strcmp(p->name, XNAreaNeeded)==0) {
00399       if ((p_rect = (XRectangle *)Xmalloc(sizeof(XRectangle))) == NULL) {
00400        *return_name = p->name;
00401        return(False);
00402       }
00403       memset(p_rect, 0, sizeof(XRectangle));
00404 
00405       p_rect->x  = p_rect->y  = 0;
00406 
00407       if (XIMP_CHK_STSAREANEEDMASK(ic) &&
00408          ((p_rect->width = ic->core.status_attr.area_needed.width) > 0) &&
00409          ((p_rect->height = ic->core.status_attr.area_needed.height) > 0)
00410          ) {
00411        goto All_Set;
00412       } else {
00413        if (p_rect->width == 0 || p_rect->height == 0) {
00414          if (XIMP_CHK_STSFONTMASK(ic)) { /* we can do something */
00415            XFontSet fs = ic->core.status_attr.fontset;
00416            XFontSetExtents *fsx = XExtentsOfFontSet(fs);
00417            if (!fsx) goto All_Set;
00418 
00419            if (p_rect->width == 0 ||
00420               ic->core.input_style & XIMPreeditArea) {
00421              p_rect->width = fsx->max_logical_extent.width *
00422               MAX_STATUS_CHARNUM;
00423            }
00424            if (p_rect->height == 0) {
00425              p_rect->height  = fsx->max_logical_extent.height;
00426            }
00427          }
00428        }
00429       }
00430     All_Set:
00431       if (p_rect->width == 0) p_rect->width = 100;
00432       if (p_rect->height == 0) p_rect->height = 16;
00433 
00434       /* For next query  */
00435       ic->core.status_attr.area_needed.width = p_rect->width;
00436       ic->core.status_attr.area_needed.height = p_rect->height;
00437       XIMP_SET_STSAREANEEDMASK(ic, change_mask);
00438 
00439       *((XRectangle **)(p->value)) = p_rect;
00440 
00441     } else if (strcmp(p->name, XNColormap)==0) {
00442       if (XIMP_CHK_STSCOLORMAPMASK(ic)) {
00443        *((Colormap *)(p->value)) = ic->core.status_attr.colormap;
00444       } else {
00445        *return_name = p->name;
00446        return(False);
00447       }
00448     } else if (strcmp(p->name, XNStdColormap)==0) {
00449       if (XIMP_CHK_STSSTDCOLORMAPMASK(ic)) {
00450        *((Atom *)(p->value)) = ic->core.status_attr.std_colormap;
00451       } else {
00452        *return_name = p->name;
00453        return(False);
00454       }
00455     } else if (strcmp(p->name, XNBackground)==0) {
00456       if (XIMP_CHK_STSBGMASK(ic)) {
00457        *((unsigned long *)(p->value)) = ic->core.status_attr.background;
00458       } else {
00459        *return_name = p->name;
00460        return(False);
00461       }
00462     } else if (strcmp(p->name, XNForeground)==0) {
00463       if (XIMP_CHK_STSFGMASK(ic)) {
00464        *((unsigned long *)(p->value)) = ic->core.status_attr.foreground;
00465       } else {
00466        *return_name = p->name;
00467        return(False);
00468       }
00469     } else if (strcmp(p->name, XNBackgroundPixmap)==0) {
00470       if (XIMP_CHK_STSBGPIXMAPMASK(ic)) {
00471        *((Pixmap *)(p->value)) = ic->core.status_attr.background_pixmap;
00472       } else {
00473        *return_name = p->name;
00474        return(False);
00475       }
00476     } else if (strcmp(p->name, XNFontSet)==0) {
00477       if (XIMP_CHK_STSFONTMASK(ic)) {
00478        *((XFontSet *)(p->value)) = ic->core.status_attr.fontset;
00479       } else {
00480        *return_name = p->name;
00481        return(False);
00482       }
00483     } else if (strcmp(p->name, XNLineSpace)==0) {
00484       if (XIMP_CHK_STSLINESPMASK(ic)) {
00485        *((int *)(p->value)) = ic->core.status_attr.line_spacing;
00486       } else {
00487        *return_name = p->name;
00488        return(False);
00489       }
00490     } else if (strcmp(p->name, XNCursor)==0) {
00491       if (XIMP_CHK_STSCURSORMASK(ic)) {
00492        *((Cursor *)(p->value)) = ic->core.status_attr.cursor;
00493       } else {
00494        *return_name = p->name;
00495        return(False);
00496       }
00497     } else if (strcmp(p->name, XNStatusStartCallback)==0) {
00498       if ((int)ic->core.status_attr.start_callback.callback) {
00499        if ((p_callback = (XIMCallback *)Xmalloc(sizeof(XIMCallback))) == NULL) {
00500          *return_name = p->name;
00501          return(False);
00502        }
00503        p_callback->client_data =
00504          ic->core.status_attr.start_callback.client_data;
00505        p_callback->callback =
00506          ic->core.status_attr.start_callback.callback;
00507        *((XIMCallback **)(p->value)) = p_callback;
00508       } else {
00509        *return_name = p->name;
00510        return(False);
00511       }
00512     } else if (strcmp(p->name, XNStatusDrawCallback)==0) {
00513       if ((int)ic->core.status_attr.draw_callback.callback) {
00514        if ((p_callback = (XIMCallback *)Xmalloc(sizeof(XIMCallback))) == NULL) {
00515          *return_name = p->name;
00516          return(False);
00517        }
00518        p_callback->client_data =
00519          ic->core.status_attr.draw_callback.client_data;
00520        p_callback->callback =
00521          ic->core.status_attr.draw_callback.callback;
00522        *((XIMCallback **)(p->value)) = p_callback;
00523       } else {
00524        *return_name = p->name;
00525        return(False);
00526       }
00527     } else if (strcmp(p->name, XNStatusDoneCallback)==0) {
00528       if ((int)ic->core.status_attr.done_callback.callback) {
00529        if ((p_callback = (XIMCallback *)Xmalloc(sizeof(XIMCallback))) == NULL) {
00530          *return_name = p->name;
00531          return(False);
00532        }
00533        p_callback->client_data =
00534          ic->core.status_attr.done_callback.client_data;
00535        p_callback->callback =
00536          ic->core.status_attr.done_callback.callback;
00537        *((XIMCallback **)(p->value)) = p_callback;
00538       } else {
00539        *return_name = p->name;
00540        return(False);
00541       }
00542     }
00543   }
00544   return(True);
00545 }
00546 
00547 char *
00548 GetICValueData(XicCommon ic, XIMArg *values, XimpChangeaMask change_mask) {
00549   XIMArg *p;
00550   char *p_char;
00551   char *return_name = NULL;
00552   int len;
00553 
00554   for (p = values; p->name != NULL; p++) {
00555     if (strcmp(p->name, XNInputStyle) == 0) {
00556       if (ic->ximp_icpart->value_mask & XIMP_INPUT_STYLE) {
00557        *((XIMStyle *)(p->value)) = ic->core.input_style;
00558       } else {
00559        return_name = p->name;
00560        break;
00561       }
00562     } else if (strcmp(p->name, XNClientWindow)==0) {
00563       if (ic->ximp_icpart->value_mask & XIMP_CLIENT_WIN) {
00564        *((Window *)(p->value)) = ic->core.client_window;
00565       } else {
00566        return_name = p->name;
00567        break;
00568       }
00569     } else if (strcmp(p->name, XNFocusWindow)==0) {
00570       if (XIMP_CHK_FOCUSWINMASK(ic)) {
00571        *((Window *)(p->value)) = ic->core.focus_window;
00572       } else {
00573        return_name = p->name;
00574        break;
00575       }
00576     } else if (strcmp(p->name, XNResourceName)==0) {
00577       if (ic->core.im->core.res_name != (char *)NULL) {
00578        len = strlen(ic->core.im->core.res_name);
00579        if ((p_char = (char*)Xmalloc(len+1)) == NULL) {
00580          return_name = p->name;
00581          break;
00582        }
00583        strcpy(p_char, ic->core.im->core.res_name);
00584        *((char **)(p->value)) = p_char;
00585       } else {
00586        return_name = p->name;
00587        break;
00588       }
00589     } else if (strcmp(p->name, XNResourceClass)==0) {
00590       if (ic->core.im->core.res_class != (char *)NULL) {
00591        len = strlen(ic->core.im->core.res_class);
00592        if ((p_char = (char*)Xmalloc(len+1)) == NULL) {
00593          return_name = p->name;
00594          break;
00595        }
00596        strcpy(p_char, ic->core.im->core.res_class);
00597        *((char **)(p->value)) = p_char;
00598       } else {
00599        return_name = p->name;
00600        break;
00601       }
00602     } else if (strcmp(p->name, XNGeometryCallback)==0) {
00603       if (ic->ximp_icpart->value_mask & XIMP_GEOMETRY_CB) {
00604        *((XICCallback *)(p->value)) = ic->core.geometry_callback;
00605       } else {
00606        return_name = p->name;
00607        break;
00608       }
00609     } else if (strcmp(p->name, XNFilterEvents)==0) {
00610       *((unsigned long *)(p->value)) = ic->core.filter_events;
00611     } else if (strcmp(p->name, XNUnicodeCharacterSubset)==0) {
00612       XIMUnicodeCharacterSubset **value;
00613       XIMUnicodeCharacterSubset *subset;
00614       XimCommon xim = (XimCommon)ic->core.im;
00615 
00616       if (xim->unicode_char_subsets == NULL)
00617        return p->name;
00618 
00619       subset = &(xim->unicode_char_subsets->supported_subsets[ic->subset_id]);
00620       value = (XIMUnicodeCharacterSubset**)p->value;
00621       *value = subset;
00622     } else if (strcmp(p->name, XNPreeditAttributes)==0) {
00623       if (PreGetAttributes(ic, (XIMArg*)p->value,
00624                         change_mask,
00625                         &return_name) == False)
00626        break;
00627     } else if (strcmp(p->name, XNStatusAttributes)==0) {
00628       if (StatusGetAttributes(ic, (XIMArg*)p->value,
00629                            change_mask,
00630                            &return_name) == False)
00631        break;
00632     } else {
00633       return_name = p->name;
00634       break;
00635     }
00636   }
00637   return(return_name);
00638 }