From cb45fff0cb01d7a2e428676e0406bcc7ebc1e63a Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sat, 9 Apr 2022 11:35:08 +0800 Subject: [PATCH] Minor cleanups in X Windows drag-and-drop code * src/keyboard.c (kbd_buffer_get_event): Don't dereference f if nil when generating mouse motion event. * src/xterm.c (x_dnd_send_enter, x_dnd_send_position) (x_dnd_send_leave, x_dnd_send_drop, x_send_scroll_bar_event): Use NoEventMask instead of 0. --- src/keyboard.c | 2 +- src/xterm.c | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/keyboard.c b/src/keyboard.c index 588ee75ee00..642ae7d7e0a 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -4317,7 +4317,7 @@ kbd_buffer_get_event (KBOARD **kbp, obj = make_lispy_movement (f, bar_window, part, x, y, t); if (!NILP (obj)) - Vlast_event_device = (STRINGP (f->last_mouse_device) + Vlast_event_device = (f && STRINGP (f->last_mouse_device) ? f->last_mouse_device : virtual_core_pointer_name); } diff --git a/src/xterm.c b/src/xterm.c index 329376cab2c..d94a3cf91a9 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -3331,7 +3331,7 @@ x_dnd_send_enter (struct frame *f, Window target, int supported) x_dnd_n_targets); x_catch_errors (dpyinfo->display); - XSendEvent (FRAME_X_DISPLAY (f), target, False, 0, &msg); + XSendEvent (FRAME_X_DISPLAY (f), target, False, NoEventMask, &msg); x_uncatch_errors (); } @@ -3390,7 +3390,7 @@ x_dnd_send_position (struct frame *f, Window target, int supported, msg.xclient.data.l[4] = action; x_catch_errors (dpyinfo->display); - XSendEvent (FRAME_X_DISPLAY (f), target, False, 0, &msg); + XSendEvent (FRAME_X_DISPLAY (f), target, False, NoEventMask, &msg); x_uncatch_errors (); } @@ -3414,7 +3414,7 @@ x_dnd_send_leave (struct frame *f, Window target) msg.xclient.data.l[4] = 0; x_catch_errors (dpyinfo->display); - XSendEvent (FRAME_X_DISPLAY (f), target, False, 0, &msg); + XSendEvent (FRAME_X_DISPLAY (f), target, False, NoEventMask, &msg); x_uncatch_errors (); } @@ -3504,7 +3504,7 @@ x_dnd_send_drop (struct frame *f, Window target, Time timestamp, msg.xclient.data.l[2] = timestamp; x_catch_errors (dpyinfo->display); - XSendEvent (FRAME_X_DISPLAY (f), target, False, 0, &msg); + XSendEvent (FRAME_X_DISPLAY (f), target, False, NoEventMask, &msg); x_uncatch_errors (); return true; } @@ -10735,7 +10735,8 @@ x_send_scroll_bar_event (Lisp_Object window, enum scroll_bar_part part, /* Setting the event mask to zero means that the message will be sent to the client that created the window, and if that window no longer exists, no event will be sent. */ - XSendEvent (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), False, 0, &event); + XSendEvent (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), False, + NoEventMask, &event); unblock_input (); } -- 2.39.5