Author: AlbrechtS
Date: 2010-11-14 23:14:29 -0800 (Sun, 14 Nov 2010)
New Revision: 7837
Log:
Fixed X11 cut/copy problem on 64-bit systems (STR #2419)


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    2010-11-15 04:49:46 UTC (rev 7836)
+++ branches/branch-1.3/src/Fl_x.cxx    2010-11-15 07:14:29 UTC (rev 7837)
@@ -310,6 +310,14 @@
 Atom fl_XaUtf8String;
 Atom fl_XaTextUriList;
 
+/*
+  X defines 32-bit-entities to have a format value of max. 32,
+  although sizeof(atom) can be 8 (64 bits) on a 64-bit OS.
+  See also fl_open_display() for sizeof(atom) < 4.
+  Used for XChangeProperty (see STR #2419).
+*/
+static int atom_bits = 32;
+
 static void fd_callback(int,void *) {
   do_queued_events();
 }
@@ -583,6 +591,9 @@
   fl_XdndURIList        = XInternAtom(d, "text/uri-list",       0);
   fl_XaUtf8String       = XInternAtom(d, "UTF8_STRING",         0);
   fl_XaTextUriList      = XInternAtom(d, "text/uri-list",       0);
+  
+  if (sizeof(Atom) < 4)
+    atom_bits = sizeof(Atom) * 8;
 
   Fl::add_fd(ConnectionNumber(d), POLLIN, fd_callback);
 
@@ -934,7 +945,7 @@
     if (e.target == TARGETS) {
       Atom a = fl_XaUtf8String; //XA_STRING;
       XChangeProperty(fl_display, e.requestor, e.property,
-                      XA_ATOM, sizeof(Atom)*8, 0, (unsigned char*)&a, 1);
+                      XA_ATOM, atom_bits, 0, (unsigned char*)&a, 1);
     } else if (/*e.target == XA_STRING &&*/ fl_selection_length[clipboard]) {
       XChangeProperty(fl_display, e.requestor, e.property,
                       e.target, 8, 0,

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

Reply via email to