FLTK logo

[Library] r7473 - trunk/src/x11

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[Library] r7473 - trunk/src/x11 fltk-dev Apr 08, 2010  
 
Author: spitzak
Date: 2010-04-08 13:25:03 -0700 (Thu, 08 Apr 2010)
New Revision: 7473
Log:
It appears that deferring XCreateIC() until first needed avoids some bugs that make
it flaky and not work sometimes. This one for my (simple European compose-key)
layout seems to work reliably except it fails if you type Compose as the very
first key (Compose works after that). Not tested for Asian locales.


Modified:
   trunk/src/x11/run.cxx

Modified: trunk/src/x11/run.cxx
===================================================================
--- trunk/src/x11/run.cxx	2010-04-08 17:51:28 UTC (rev 7472)
+++ trunk/src/x11/run.cxx	2010-04-08 20:25:03 UTC (rev 7473)
@@ -102,7 +102,7 @@
 static char fl_is_over_the_spot = 0;
 static XRectangle status_area;
 
-static void fl_new_ic()
+static void fl_new_ic(XWindow xid)
 {
   // Give up if this failed earlier:
   if (!fl_xim_im)
@@ -125,7 +125,7 @@
   if (XGetIMValues(fl_xim_im, XNQueryInputStyle,
 		   &xim_styles, NULL, NULL) ||
       !xim_styles || !xim_styles->count_styles) {
-    warning("No XIM style found\n");
+    warning("No XIM style found");
     XCloseIM(fl_xim_im);
     fl_xim_im = NULL;
     return;
@@ -162,6 +162,7 @@
 			    XNInputStyle, (XIMPreeditPosition | XIMStatusArea),
 			    XNPreeditAttributes, preedit_attr,
 			    XNStatusAttributes, status_attr,
+                            XNClientWindow, xid,
 			    NULL);
       XFree(status_attr);
     }
@@ -169,15 +170,18 @@
       fl_xim_ic = XCreateIC(fl_xim_im,
 			    XNInputStyle,XIMPreeditPosition | XIMStatusNothing,
 			    XNPreeditAttributes, preedit_attr,
+                            XNClientWindow, xid,
 			    NULL);
     XFree(preedit_attr);
     if (fl_xim_ic) {
       fl_is_over_the_spot = 1;
+#if 0 // This appears to have been done in the "if (sarea)" above
       XVaNestedList status_attr;
       status_attr = XVaCreateNestedList(0, XNAreaNeeded, &status_area, NULL);
       if (status_area.height != 0)
 	XGetICValues(fl_xim_ic, XNStatusAttributes, status_attr, NULL);
       XFree(status_attr);
+#endif
       return;
     }
   }
@@ -186,9 +190,10 @@
   fl_is_over_the_spot = 0;
   fl_xim_ic = XCreateIC(fl_xim_im,
 			XNInputStyle, (XIMPreeditNothing | XIMStatusNothing),
+                        XNClientWindow, xid,
 			NULL);
   if (!fl_xim_ic) {
-    warning("XCreateIC() failed\n");
+    warning("XCreateIC() failed");
     XCloseIM(fl_xim_im);
     fl_xim_im = NULL;
   }
@@ -203,7 +208,7 @@
   fl_xim_im = XOpenIM(xdisplay, NULL, NULL, NULL);
 
   if (!fl_xim_im)
-    warning("XOpenIM() failed\n");
+    warning("XOpenIM() failed");
 }
 
 void fl_set_spot(fltk::Font *f, Widget *w, int x, int y)
@@ -1575,8 +1580,6 @@
 
   case FocusIn:
 #if USE_XIM
-    // For some reason, always destroying & recreating seems to help this work:
-    /*if (!fl_xim_ic)*/ fl_new_ic();
     if (fl_xim_ic) {
       XSetICValues(fl_xim_ic,
 		   XNClientWindow, xevent.xclient.window,
@@ -1619,6 +1622,8 @@
     int len;
     KeySym keysym;
 #if USE_XIM
+    if (!fl_xim_ic)
+        fl_new_ic(xevent.xany.window);
     if (fl_xim_ic) {
       Status status;
     RETRY:

Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.