aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Djärv2005-02-05 16:41:38 +0000
committerJan Djärv2005-02-05 16:41:38 +0000
commit31f16913d78ccf89e278816ba2c10ed075c1be19 (patch)
treeeb5e86fd91d23f62b3e42acffba04faa001818fc /src
parentcb60275441c976673414a3737d46741218bb6a72 (diff)
downloademacs-31f16913d78ccf89e278816ba2c10ed075c1be19.tar.gz
emacs-31f16913d78ccf89e278816ba2c10ed075c1be19.zip
* xselect.c (Fx_send_client_event, x_handle_dnd_message): Handle
the longs in a XClientMessageEvent correctly when long is 64 bits.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/xselect.c48
2 files changed, 48 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index a759feb6b59..fccfbf7ddd4 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12005-02-05 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
2
3 * xselect.c (Fx_send_client_event, x_handle_dnd_message): Handle
4 the longs in a XClientMessageEvent correctly when long is 64 bits.
5
12005-02-05 Eli Zaretskii <eliz@gnu.org> 62005-02-05 Eli Zaretskii <eliz@gnu.org>
2 7
3 * xfaces.c (face_color_supported_p): Use HAVE_WINDOW_SYSTEM 8 * xfaces.c (face_color_supported_p): Use HAVE_WINDOW_SYSTEM
diff --git a/src/xselect.c b/src/xselect.c
index 5dd63b9c735..daae84b276c 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -2536,7 +2536,7 @@ x_property_data_to_lisp (f, data, type, format, size)
2536 data, size*format/8, type, format); 2536 data, size*format/8, type, format);
2537} 2537}
2538 2538
2539/* Get the mouse position frame relative coordinates. */ 2539/* Get the mouse position in frame relative coordinates. */
2540 2540
2541static void 2541static void
2542mouse_position_for_drop (f, x, y) 2542mouse_position_for_drop (f, x, y)
@@ -2635,16 +2635,31 @@ x_handle_dnd_message (f, event, dpyinfo, bufp)
2635 Lisp_Object frame; 2635 Lisp_Object frame;
2636 unsigned long size = (8*sizeof (event->data))/event->format; 2636 unsigned long size = (8*sizeof (event->data))/event->format;
2637 int x, y; 2637 int x, y;
2638 unsigned char *data = (unsigned char *) event->data.b;
2639 int idata[5];
2638 2640
2639 XSETFRAME (frame, f); 2641 XSETFRAME (frame, f);
2640 2642
2643 /* On a 64 bit machine, the event->data.l array members are 64 bits (long),
2644 but the x_property_data_to_lisp (or rather selection_data_to_lisp_data)
2645 function expects them to be of size int (i.e. 32). So to be able to
2646 use that function, put the data in the form it expects if format is 32. */
2647
2648 if (event->format == 32 && event->format < BITS_PER_LONG)
2649 {
2650 int i;
2651 for (i = 0; i < 5; ++i) /* There are only 5 longs in a ClientMessage. */
2652 idata[i] = (int) event->data.l[i];
2653 data = (unsigned char *) idata;
2654 }
2655
2641 vec = Fmake_vector (make_number (4), Qnil); 2656 vec = Fmake_vector (make_number (4), Qnil);
2642 AREF (vec, 0) = SYMBOL_NAME (x_atom_to_symbol (FRAME_X_DISPLAY (f), 2657 AREF (vec, 0) = SYMBOL_NAME (x_atom_to_symbol (FRAME_X_DISPLAY (f),
2643 event->message_type)); 2658 event->message_type));
2644 AREF (vec, 1) = frame; 2659 AREF (vec, 1) = frame;
2645 AREF (vec, 2) = make_number (event->format); 2660 AREF (vec, 2) = make_number (event->format);
2646 AREF (vec, 3) = x_property_data_to_lisp (f, 2661 AREF (vec, 3) = x_property_data_to_lisp (f,
2647 event->data.b, 2662 data,
2648 event->message_type, 2663 event->message_type,
2649 event->format, 2664 event->format,
2650 size); 2665 size);
@@ -2697,6 +2712,8 @@ are ignored. */)
2697 struct frame *f = check_x_frame (from); 2712 struct frame *f = check_x_frame (from);
2698 int count; 2713 int count;
2699 int to_root; 2714 int to_root;
2715 int idata[5];
2716 void *data;
2700 2717
2701 CHECK_STRING (message_type); 2718 CHECK_STRING (message_type);
2702 CHECK_NUMBER (format); 2719 CHECK_NUMBER (format);
@@ -2756,10 +2773,31 @@ are ignored. */)
2756 when sending to the root window. */ 2773 when sending to the root window. */
2757 event.xclient.window = to_root ? FRAME_OUTER_WINDOW (f) : wdest; 2774 event.xclient.window = to_root ? FRAME_OUTER_WINDOW (f) : wdest;
2758 2775
2759 memset (event.xclient.data.b, 0, sizeof (event.xclient.data.b)); 2776
2760 x_fill_property_data (dpyinfo->display, values, event.xclient.data.b, 2777 if (event.xclient.format == 32 && event.xclient.format < BITS_PER_LONG)
2761 event.xclient.format); 2778 {
2779 /* x_fill_property_data expects data to hold 32 bit values when
2780 format == 32, but on a 64 bit machine long is 64 bits.
2781 event.xclient.l is an array of long, so we must compensate. */
2762 2782
2783 memset (idata, 0, sizeof (idata));
2784 data = idata;
2785 }
2786 else
2787 {
2788 memset (event.xclient.data.b, 0, sizeof (event.xclient.data.b));
2789 data = event.xclient.data.b;
2790 }
2791
2792 x_fill_property_data (dpyinfo->display, values, data, event.xclient.format);
2793
2794 if (data == idata)
2795 {
2796 int i;
2797 for (i = 0; i < 5; ++i) /* There are only 5 longs in a ClientMessage. */
2798 event.xclient.data.l[i] = (long) idata[i];
2799 }
2800
2763 /* If event mask is 0 the event is sent to the client that created 2801 /* If event mask is 0 the event is sent to the client that created
2764 the destination window. But if we are sending to the root window, 2802 the destination window. But if we are sending to the root window,
2765 there is no such client. Then we set the event mask to 0xffff. The 2803 there is no such client. Then we set the event mask to 0xffff. The