TkDisplay * TkpOpenDisplay( CONST char *displayNameStr) { TkDisplay *dispPtr; Display *display; int event = 0; int error = 0; int major = 1; int minor = 0; int reason = 0; unsigned int use_xkb = 0; /* ** Bug [3607830]: Before using Xkb, it must be initialized and confirmed ** that the serve supports it. The XkbOpenDisplay call ** will perform this check and return NULL if the extension ** is not supported. ** ** Work around un-const-ified Xkb headers using (char *) cast. */ display = XkbOpenDisplay((char *)displayNameStr, &event, &error, &major, &minor, &reason); if (display == NULL) { /*fprintf(stderr,"event=%d error=%d major=%d minor=%d reason=%d\nDisabling xkb\n", event, error, major, minor, reason);*/ display = XOpenDisplay(displayNameStr); } else { use_xkb = TK_DISPLAY_USE_XKB; /*fprintf(stderr, "Using xkb %d.%d\n", major, minor);*/ } if (display == NULL) { return NULL; } dispPtr = (TkDisplay *) ckalloc(sizeof(TkDisplay)); memset(dispPtr, 0, sizeof(TkDisplay)); dispPtr->display = display; dispPtr->flags |= use_xkb; #ifdef TK_USE_INPUT_METHODS OpenIM(dispPtr); #endif Tcl_CreateFileHandler(ConnectionNumber(display), TCL_READABLE, DisplayFileProc, (ClientData) dispPtr); return dispPtr; }
static void Register(Widget inwidg, XawVendorShellExtPart* ve) { if (ve->im.xim == NULL) { OpenIM(ve); } if (IsRegistered(inwidg, ve)) return; if (RegisterToVendorShell(inwidg, ve) == FALSE) return; if (ve->im.xim == NULL) return; if (XtIsRealized(ve->parent)) { CreateIC(inwidg, ve); SetICFocus(inwidg, ve); } }
static void Reconnect(XawVendorShellExtPart *ve) { XawIcTableList p; ve->im.open_im = True; if (ve->im.xim == NULL) { OpenIM(ve); } if (ve->im.xim == NULL) return; if (IsSharedIC(ve)) { p = ve->ic.shared_ic_table; p->flg = p->prev_flg; p->openic_error = FALSE; } else { for (p = ve->ic.ic_table; p; p = p->next) { p->flg = p->prev_flg; p->openic_error = FALSE; } } AllCreateIC(ve); }