emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/xselect.c


From: Jan Djärv
Subject: [Emacs-diffs] Changes to emacs/src/xselect.c
Date: Sat, 05 Feb 2005 11:41:12 -0500

Index: emacs/src/xselect.c
diff -c emacs/src/xselect.c:1.145 emacs/src/xselect.c:1.146
*** emacs/src/xselect.c:1.145   Fri Jan  7 16:59:57 2005
--- emacs/src/xselect.c Sat Feb  5 16:41:10 2005
***************
*** 2536,2542 ****
                                        data, size*format/8, type, format);
  }
  
! /* Get the mouse position frame relative coordinates.  */
  
  static void
  mouse_position_for_drop (f, x, y)
--- 2536,2542 ----
                                        data, size*format/8, type, format);
  }
  
! /* Get the mouse position in frame relative coordinates.  */
  
  static void
  mouse_position_for_drop (f, x, y)
***************
*** 2635,2650 ****
    Lisp_Object frame;
    unsigned long size = (8*sizeof (event->data))/event->format;
    int x, y;
  
    XSETFRAME (frame, f);
  
    vec = Fmake_vector (make_number (4), Qnil);
    AREF (vec, 0) = SYMBOL_NAME (x_atom_to_symbol (FRAME_X_DISPLAY (f),
                                                   event->message_type));
    AREF (vec, 1) = frame;
    AREF (vec, 2) = make_number (event->format);
    AREF (vec, 3) = x_property_data_to_lisp (f,
!                                            event->data.b,
                                             event->message_type,
                                             event->format,
                                             size);
--- 2635,2665 ----
    Lisp_Object frame;
    unsigned long size = (8*sizeof (event->data))/event->format;
    int x, y;
+   unsigned char *data = (unsigned char *) event->data.b;
+   int idata[5];
  
    XSETFRAME (frame, f);
  
+   /* On a 64 bit machine, the event->data.l array members are 64 bits (long),
+      but the x_property_data_to_lisp (or rather selection_data_to_lisp_data)
+      function expects them to be of size int (i.e. 32).  So to be able to
+      use that function, put the data in the form it expects if format is 32. 
*/
+ 
+   if (event->format == 32 && event->format < BITS_PER_LONG)
+     {
+       int i;
+       for (i = 0; i < 5; ++i) /* There are only 5 longs in a ClientMessage. */
+         idata[i] = (int) event->data.l[i];
+       data = (unsigned char *) idata;
+     }
+ 
    vec = Fmake_vector (make_number (4), Qnil);
    AREF (vec, 0) = SYMBOL_NAME (x_atom_to_symbol (FRAME_X_DISPLAY (f),
                                                   event->message_type));
    AREF (vec, 1) = frame;
    AREF (vec, 2) = make_number (event->format);
    AREF (vec, 3) = x_property_data_to_lisp (f,
!                                            data,
                                             event->message_type,
                                             event->format,
                                             size);
***************
*** 2697,2702 ****
--- 2712,2719 ----
    struct frame *f = check_x_frame (from);
    int count;
    int to_root;
+   int idata[5];
+   void *data;
  
    CHECK_STRING (message_type);
    CHECK_NUMBER (format);
***************
*** 2756,2765 ****
       when sending to the root window.  */
    event.xclient.window = to_root ? FRAME_OUTER_WINDOW (f) : wdest;
  
!   memset (event.xclient.data.b, 0, sizeof (event.xclient.data.b));
!   x_fill_property_data (dpyinfo->display, values, event.xclient.data.b,
!                         event.xclient.format);
  
    /* If event mask is 0 the event is sent to the client that created
       the destination window.  But if we are sending to the root window,
       there is no such client.  Then we set the event mask to 0xffff.  The
--- 2773,2803 ----
       when sending to the root window.  */
    event.xclient.window = to_root ? FRAME_OUTER_WINDOW (f) : wdest;
  
!   
!   if (event.xclient.format == 32 && event.xclient.format < BITS_PER_LONG)
!     {
!       /* x_fill_property_data expects data to hold 32 bit values when
!          format == 32, but on a 64 bit machine long is 64 bits.
!          event.xclient.l is an array of long, so we must compensate. */
  
+       memset (idata, 0, sizeof (idata));
+       data = idata;
+     }
+   else
+     {
+       memset (event.xclient.data.b, 0, sizeof (event.xclient.data.b));
+       data = event.xclient.data.b;
+     }
+ 
+   x_fill_property_data (dpyinfo->display, values, data, event.xclient.format);
+ 
+   if (data == idata)
+     {
+       int i;
+       for (i = 0; i < 5; ++i) /* There are only 5 longs in a ClientMessage. */
+         event.xclient.data.l[i] = (long) idata[i];
+     }
+   
    /* If event mask is 0 the event is sent to the client that created
       the destination window.  But if we are sending to the root window,
       there is no such client.  Then we set the event mask to 0xffff.  The




reply via email to

[Prev in Thread] Current Thread [Next in Thread]