Author: ianmacarthur
Date: 2011-01-15 14:47:30 -0800 (Sat, 15 Jan 2011)
New Revision: 8279
Log:
Another tweak to fl_init_xim() as proposed by Denton Thomas.
Should not change the behaviour from the previous fix, it is
just a bit tidier!



Modified:
   branches/branch-1.3/src/Fl_x.cxx

Modified: branches/branch-1.3/src/Fl_x.cxx
===================================================================
--- branches/branch-1.3/src/Fl_x.cxx    2011-01-14 22:06:41 UTC (rev 8278)
+++ branches/branch-1.3/src/Fl_x.cxx    2011-01-15 22:47:30 UTC (rev 8279)
@@ -282,7 +282,7 @@
 static void convert_crlf(unsigned char *string, long& len) {
   unsigned char *a, *b;
   a = b = string;
-  while (*a) { 
+  while (*a) {
     if (*a == '\r' && a[1] == '\n') { a++; len--; }
     else *b++ = *a++;
   }
@@ -568,8 +568,6 @@
   if (!fl_xim_ic) {
     Fl::warning("XCreateIC() failed\n");
     XCloseIM(fl_xim_im);
-    if(xim_styles) XFree(xim_styles);
-    xim_styles = NULL; // make sure we remember we have free'd xim_styles
     fl_xim_im = NULL;
   }
   // if xim_styles is still allocated, free it now
@@ -614,13 +612,13 @@
   fl_XdndURIList        = XInternAtom(d, "text/uri-list",       0);
   fl_Xatextplainutf     = XInternAtom(d, "text/plain;charset=UTF-8",0);
   fl_Xatextplain        = XInternAtom(d, "text/plain",          0);
-  fl_XaText             = XInternAtom(d, "TEXT",                0);     
+  fl_XaText             = XInternAtom(d, "TEXT",                0);
   fl_XaCompoundText     = XInternAtom(d, "COMPOUND_TEXT",       0);
   fl_XaUtf8String       = XInternAtom(d, "UTF8_STRING",         0);
   fl_XaTextUriList      = XInternAtom(d, "text/uri-list",       0);
   fl_NET_WM_NAME        = XInternAtom(d, "_NET_WM_NAME",        0);
   fl_NET_WM_ICON_NAME   = XInternAtom(d, "_NET_WM_ICON_NAME",   0);
-  
+
   if (sizeof(Atom) < 4)
     atom_bits = sizeof(Atom) * 8;
 
@@ -955,10 +953,10 @@
                  t == fl_Xatextplain ||
                  t == fl_XaUtf8String) {type = t; break;}
            // rest are only used if no utf-8 available:
-           if (t == fl_XaText || 
-                 t == fl_XaTextUriList || 
+           if (t == fl_XaText ||
+                 t == fl_XaTextUriList ||
                  t == fl_XaCompoundText) type = t;
-       }       
+       }
        XFree(portion);
        Atom property = xevent.xselection.property;
        XConvertSelection(fl_display, property, type, property,
@@ -966,17 +964,17 @@
              fl_event_time);
        return true;
       }
-      XTextProperty text_prop; 
+      XTextProperty text_prop;
       text_prop.value=portion;
       text_prop.format=format;
       text_prop.encoding=actual;
       text_prop.nitems=count;
       char **text_list;
       text_list = (char**)&portion;
-      int bytesnew = strlen(*text_list)+1; 
+      int bytesnew = strlen(*text_list)+1;
       buffer = (unsigned char*)realloc(buffer, bytesread+bytesnew+remaining);
       memcpy(buffer+bytesread, *text_list, bytesnew);
-      XFree(portion); 
+      XFree(portion);
       bytesread += bytesnew - 1;
       if (!remaining) break;
     }
@@ -1264,21 +1262,21 @@
       // down, probably due to some back compatibility problem. Fortunately
       // we can detect this because the repeating KeyPress event is in
       // the queue, get it and execute it instead:
-      
+
       // Bool XkbSetDetectableAutorepeat ( display, detectable, supported_rtrn 
)
       // Display * display ;
       // Bool detectable ;
       // Bool * supported_rtrn ;
-      // ...would be the easy way to corrct this isuue. Unfortunatly, this 
call is also 
+      // ...would be the easy way to corrct this isuue. Unfortunatly, this 
call is also
       // broken on many Unix distros including Ubuntu and Solaris (as of Dec 
2009)
 
-      // Bogus KeyUp events are generated by repeated KeyDown events. One 
+      // Bogus KeyUp events are generated by repeated KeyDown events. One
       // neccessary condition is an identical key event pending right after
       // the bogus KeyUp.
       // The new code introduced Dec 2009 differs in that it only check the 
very
       // next event in the queue, not the entire queue of events.
       // This function wrongly detects a repeat key if a software keyboard
-      // sends a burst of events containing two consecutive equal keys. 
However, 
+      // sends a burst of events containing two consecutive equal keys. 
However,
       // in every non-gaming situation, this is no problem because both 
KeyPress
       // events will cause the expected behavior.
       XEvent peekevent;
@@ -1292,7 +1290,7 @@
           goto KEYPRESS;
         }
       }
-      
+
       event = FL_KEYUP;
       fl_key_vector[keycode/8] &= ~(1 << (keycode%8));
       // keyup events just get the unshifted keysym:
@@ -1346,10 +1344,10 @@
       Fl::e_original_keysym = (int)keysym;
     }
     Fl::e_keysym = int(keysym);
-  
+
     // replace XK_ISO_Left_Tab (Shift-TAB) with FL_Tab (modifier flags are set 
correctly by X11)
     if (Fl::e_keysym == 0xfe20) Fl::e_keysym = FL_Tab;
-    
+
     set_event_xy();
     Fl::e_is_click = 0;
     break;}
@@ -1452,7 +1450,7 @@
   case ReparentNotify: {
     int xpos, ypos;
     Window junk;
-    
+
     // on some systems, the ReparentNotify event is not handled as we would 
expect.
     XErrorHandler oldHandler = XSetErrorHandler(catchXExceptions());
 
@@ -1668,7 +1666,7 @@
       XSetTransientForHint(fl_display, xp->xid, fl_xid(wp));
       if (!wp->visible()) showit = 0; // guess that wm will not show it
     }
-   
+
     // Make sure that borderless windows do not show in the task bar
     if (!win->border()) {
       Atom net_wm_state = XInternAtom (fl_display, "_NET_WM_STATE", 0);

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to