summaryrefslogtreecommitdiffstats
path: root/generic/tkCmds.c
diff options
context:
space:
mode:
authorhobbs <hobbs@noemail.net>1999-12-16 21:57:35 (GMT)
committerhobbs <hobbs@noemail.net>1999-12-16 21:57:35 (GMT)
commitfeb635bda0bb3be090722f31e2886cc52bdad153 (patch)
treea359295061e8e63458411176f65e6bc6517f9dec /generic/tkCmds.c
parentbb0b1ed89ded5088cb9310c0d4bf22b08931f5fb (diff)
downloadtk-feb635bda0bb3be090722f31e2886cc52bdad153.zip
tk-feb635bda0bb3be090722f31e2886cc52bdad153.tar.gz
tk-feb635bda0bb3be090722f31e2886cc52bdad153.tar.bz2
* generic/tkCmds.c:
* generic/tkEvent.c: * generic/tkWindow.c: * generic/tkInt.h: add 'tk useinputmethods ?-display win? ?bool?' call to provide support for disabling/enabling the use of XIM on X. This was previously all done at compile time, and always on. Now it * generic/tkCanvUtil.c: fixed bug in Tk_CanvasPsOutline that freed mem it shouldn't. * generic/tkFont.c: added "bitstream cyberbit" (popular Windows CJK font) to list of font fallbacks. (kenny) [Bug: 2407] FossilOrigin-Name: 3f23335ddf3083f408deedfb90188f6c2fe8a533
Diffstat (limited to 'generic/tkCmds.c')
-rw-r--r--generic/tkCmds.c47
1 files changed, 41 insertions, 6 deletions
diff --git a/generic/tkCmds.c b/generic/tkCmds.c
index 75504bb..15650f2 100644
--- a/generic/tkCmds.c
+++ b/generic/tkCmds.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkCmds.c,v 1.8 1999/12/03 07:14:39 hobbs Exp $
+ * RCS: @(#) $Id: tkCmds.c,v 1.9 1999/12/16 21:57:35 hobbs Exp $
*/
#include "tkPort.h"
@@ -568,10 +568,10 @@ Tk_TkObjCmd(clientData, interp, objc, objv)
int index;
Tk_Window tkwin;
static char *optionStrings[] = {
- "appname", "scaling", NULL
+ "appname", "scaling", "useinputmethods", NULL
};
enum options {
- TK_APPNAME, TK_SCALING
+ TK_APPNAME, TK_SCALING, TK_USE_IM
};
tkwin = (Tk_Window) clientData;
@@ -607,7 +607,7 @@ Tk_TkObjCmd(clientData, interp, objc, objv)
Screen *screenPtr;
int skip, width, height;
double d;
-
+
screenPtr = Tk_Screen(tkwin);
skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin);
@@ -620,7 +620,7 @@ Tk_TkObjCmd(clientData, interp, objc, objv)
d /= WidthMMOfScreen(screenPtr);
Tcl_SetDoubleObj(Tcl_GetObjResult(interp), d);
} else if (objc - skip == 3) {
- if (Tcl_GetDoubleFromObj(interp, objv[2 + skip], &d) != TCL_OK) {
+ if (Tcl_GetDoubleFromObj(interp, objv[2+skip], &d) != TCL_OK) {
return TCL_ERROR;
}
d = (25.4 / 72) / d;
@@ -641,6 +641,40 @@ Tk_TkObjCmd(clientData, interp, objc, objv)
}
break;
}
+ case TK_USE_IM: {
+ TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
+ int skip;
+
+ skip = TkGetDisplayOf(interp, objc-2, objv+2, &tkwin);
+ if (skip < 0) {
+ return TCL_ERROR;
+ } else if (skip) {
+ dispPtr = ((TkWindow *) tkwin)->dispPtr;
+ }
+ if ((objc - skip) == 3) {
+#ifdef TK_USE_INPUT_METHODS
+ /*
+ * In the case where TK_USE_INPUT_METHODS is not defined,
+ * this will be ignored and we will always return 0.
+ * That will indicate to the user that input methods
+ * are just not available.
+ */
+ int bool;
+ if (Tcl_GetBooleanFromObj(interp, objv[2+skip], &bool)
+ != TCL_OK) {
+ return TCL_ERROR;
+ }
+ dispPtr->useInputMethods = bool;
+#endif /* TK_USE_INPUT_METHODS */
+ } else if ((objc - skip) != 2) {
+ Tcl_WrongNumArgs(interp, 2, objv,
+ "?-displayof window? ?boolean?");
+ return TCL_ERROR;
+ }
+ Tcl_SetBooleanObj(Tcl_GetObjResult(interp),
+ dispPtr->useInputMethods);
+ break;
+ }
}
return TCL_OK;
}
@@ -1522,7 +1556,8 @@ TkGetDisplayOf(interp, objc, objv, tkwinPtr)
return 0;
}
string = Tcl_GetStringFromObj(objv[0], &length);
- if ((length >= 2) && (strncmp(string, "-displayof", (unsigned) length) == 0)) {
+ if ((length >= 2) &&
+ (strncmp(string, "-displayof", (unsigned) length) == 0)) {
if (objc < 2) {
Tcl_SetStringObj(Tcl_GetObjResult(interp),
"value for \"-displayof\" missing", -1);