summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>2002-04-05 08:41:24 (GMT)
committerhobbs <hobbs>2002-04-05 08:41:24 (GMT)
commit406eb5a70238050ba7015af89d5495a48ad31107 (patch)
tree07c721cfec3e47c07c3f1d4a511ba9e3f49bd7a6
parent152c3ff975fe90f65cf10f081e7741aea3e0a6dc (diff)
downloadtk-406eb5a70238050ba7015af89d5495a48ad31107.zip
tk-406eb5a70238050ba7015af89d5495a48ad31107.tar.gz
tk-406eb5a70238050ba7015af89d5495a48ad31107.tar.bz2
* unix/tkUnixEvent.c:
* generic/tkWindow.c: moved OpenIM over to tkUnixEvent.c. Removed setting inputContext to null in Tk_MakeWindowExist as it was redundant.
-rw-r--r--generic/tkWindow.c73
-rw-r--r--unix/tkUnixEvent.c98
2 files changed, 98 insertions, 73 deletions
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index 7975b54..4384c45 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWindow.c,v 1.43 2002/02/27 01:26:51 hobbs Exp $
+ * RCS: @(#) $Id: tkWindow.c,v 1.44 2002/04/05 08:41:24 hobbs Exp $
*/
#include "tkPort.h"
@@ -212,7 +212,6 @@ static int Initialize _ANSI_ARGS_((Tcl_Interp *interp));
static int NameWindow _ANSI_ARGS_((Tcl_Interp *interp,
TkWindow *winPtr, TkWindow *parentPtr,
char *name));
-static void OpenIM _ANSI_ARGS_((TkDisplay *dispPtr));
static void UnlinkWindow _ANSI_ARGS_((TkWindow *winPtr));
/*
@@ -470,7 +469,6 @@ GetScreen(interp, screenName, screenPtr)
strncpy(dispPtr->name, screenName, length);
dispPtr->name[length] = '\0';
dispPtr->useInputMethods = 0;
- OpenIM(dispPtr);
TkInitXId(dispPtr);
dispPtr->deletionEpoch = 0L;
@@ -1617,9 +1615,6 @@ Tk_MakeWindowExist(tkwin)
Tcl_SetHashValue(hPtr, winPtr);
winPtr->dirtyAtts = 0;
winPtr->dirtyChanges = 0;
-#ifdef TK_USE_INPUT_METHODS
- winPtr->inputContext = NULL;
-#endif /* TK_USE_INPUT_METHODS */
if (!(winPtr->flags & TK_TOP_LEVEL)) {
/*
@@ -1666,7 +1661,7 @@ Tk_MakeWindowExist(tkwin)
*/
if ((winPtr->flags & TK_NEED_CONFIG_NOTIFY)
- && !(winPtr->flags & TK_ALREADY_DEAD)){
+ && !(winPtr->flags & TK_ALREADY_DEAD)) {
winPtr->flags &= ~TK_NEED_CONFIG_NOTIFY;
TkDoConfigureNotify(winPtr);
}
@@ -2554,70 +2549,6 @@ Tk_StrictMotif(tkwin)
return ((TkWindow *) tkwin)->mainPtr->strictMotif;
}
-/*
- *--------------------------------------------------------------
- *
- * OpenIM --
- *
- * Tries to open an X input method, associated with the
- * given display. Right now we can only deal with a bare-bones
- * input style: no preedit, and no status.
- *
- * Results:
- * Stores the input method in dispPtr->inputMethod; if there isn't
- * a suitable input method, then NULL is stored in dispPtr->inputMethod.
- *
- * Side effects:
- * An input method gets opened.
- *
- *--------------------------------------------------------------
- */
-
-static void
-OpenIM(dispPtr)
- TkDisplay *dispPtr; /* Tk's structure for the display. */
-{
-#ifndef TK_USE_INPUT_METHODS
- return;
-#else
- unsigned short i;
- XIMStyles *stylePtr;
- char *modifier_list;
-
- if ((modifier_list = XSetLocaleModifiers("")) == NULL) {
- goto error;
- }
-
- dispPtr->inputMethod = XOpenIM(dispPtr->display, NULL, NULL, NULL);
- if (dispPtr->inputMethod == NULL) {
- return;
- }
-
- if ((XGetIMValues(dispPtr->inputMethod, XNQueryInputStyle, &stylePtr,
- NULL) != NULL) || (stylePtr == NULL)) {
- goto error;
- }
- for (i = 0; i < stylePtr->count_styles; i++) {
- if (stylePtr->supported_styles[i]
- == (XIMPreeditNothing|XIMStatusNothing)) {
- XFree(stylePtr);
- return;
- }
- }
- XFree(stylePtr);
-
- error:
-
- /*
- * Should close the input method, but this causes core dumps on some
- * systems (e.g. Solaris 2.3 as of 1/6/95).
- * XCloseIM(dispPtr->inputMethod);
- */
- dispPtr->inputMethod = NULL;
- return;
-#endif /* TK_USE_INPUT_METHODS */
-}
-
/*
*----------------------------------------------------------------------
*
diff --git a/unix/tkUnixEvent.c b/unix/tkUnixEvent.c
index d2682a7..d0f1476 100644
--- a/unix/tkUnixEvent.c
+++ b/unix/tkUnixEvent.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkUnixEvent.c,v 1.4 2002/01/25 21:09:37 dgp Exp $
+ * RCS: @(#) $Id: tkUnixEvent.c,v 1.5 2002/04/05 08:41:24 hobbs Exp $
*/
#include "tkInt.h"
@@ -39,6 +39,9 @@ static void DisplayFileProc _ANSI_ARGS_((ClientData clientData,
static void DisplaySetupProc _ANSI_ARGS_((ClientData clientData,
int flags));
static void TransferXEventsToTcl _ANSI_ARGS_((Display *display));
+#ifdef TK_USE_INPUT_METHODS
+static void OpenIM _ANSI_ARGS_((TkDisplay *dispPtr));
+#endif
/*
@@ -128,6 +131,11 @@ TkpOpenDisplay(display_name)
}
dispPtr = (TkDisplay *) ckalloc(sizeof(TkDisplay));
dispPtr->display = display;
+#ifdef TK_USE_INPUT_METHODS
+ dispPtr->inputMethod = NULL;
+ dispPtr->inputXfs = NULL;
+ OpenIM(dispPtr);
+#endif
Tcl_CreateFileHandler(ConnectionNumber(display), TCL_READABLE,
DisplayFileProc, (ClientData) dispPtr);
return dispPtr;
@@ -158,10 +166,27 @@ TkpCloseDisplay(displayPtr)
if (dispPtr->display != 0) {
Tcl_DeleteFileHandler(ConnectionNumber(dispPtr->display));
+#ifdef TK_USE_INPUT_METHODS
+#if TK_XIM_SPOT
+ if (dispPtr->inputXfs) {
+ XFreeFontSet(dispPtr->display, dispPtr->inputXfs);
+ }
+#endif
+ if (dispPtr->inputMethod) {
+ /*
+ * This causes core dumps on some systems (e.g. Solaris 2.3 as of
+ * 1/6/95), but is OK with X11R6
+ */
+#if ! defined (SOLARIS2) || defined (HAVE_X11R6)
+ XCloseIM(dispPtr->inputMethod);
+#endif
+ }
+#endif
+
(void) XSync(dispPtr->display, False);
(void) XCloseDisplay(dispPtr->display);
}
-
+
ckfree((char *) dispPtr);
}
@@ -516,5 +541,74 @@ TkpSync(display)
* Transfer events from the X event queue to the Tk event queue.
*/
TransferXEventsToTcl(display);
+}
+#ifdef TK_USE_INPUT_METHODS
+
+/*
+ *--------------------------------------------------------------
+ *
+ * OpenIM --
+ *
+ * Tries to open an X input method, associated with the
+ * given display. Right now we can only deal with a bare-bones
+ * input style: no preedit, and no status.
+ *
+ * Results:
+ * Stores the input method in dispPtr->inputMethod; if there isn't
+ * a suitable input method, then NULL is stored in dispPtr->inputMethod.
+ *
+ * Side effects:
+ * An input method gets opened.
+ *
+ *--------------------------------------------------------------
+ */
+static void
+OpenIM(dispPtr)
+ TkDisplay *dispPtr; /* Tk's structure for the display. */
+{
+ unsigned short i;
+ XIMStyles *stylePtr;
+ char *modifier_list;
+
+ if ((modifier_list = XSetLocaleModifiers("")) == NULL) {
+ goto error;
+ }
+
+ dispPtr->inputMethod = XOpenIM(dispPtr->display, NULL, NULL, NULL);
+ if (dispPtr->inputMethod == NULL) {
+ return;
+ }
+
+ if ((XGetIMValues(dispPtr->inputMethod, XNQueryInputStyle, &stylePtr,
+ NULL) != NULL) || (stylePtr == NULL)) {
+ goto error;
+ }
+ for (i = 0; i < stylePtr->count_styles; i++) {
+ if (stylePtr->supported_styles[i]
+#if TK_XIM_SPOT
+ == (XIMPreeditPosition | XIMStatusNothing)
+#else
+ == (XIMPreeditNothing | XIMStatusNothing)
+#endif
+ ) {
+ XFree(stylePtr);
+ return;
+ }
+ }
+ XFree(stylePtr);
+
+ error:
+
+ if (dispPtr->inputMethod) {
+ /*
+ * This causes core dumps on some systems (e.g. Solaris 2.3 as of
+ * 1/6/95), but is OK with X11R6
+ */
+#if ! defined (SOLARIS2) || defined (HAVE_X11R6)
+ XCloseIM(dispPtr->inputMethod);
+#endif
+ dispPtr->inputMethod = NULL;
+ }
}
+#endif /* TK_USE_INPUT_METHODS */