From 804d919ac5ca228164bf3a74b3911fa2f946fc7a Mon Sep 17 00:00:00 2001 From: Po Lu Date: Fri, 15 Apr 2022 08:55:22 +0800 Subject: [PATCH] Fix calls to XKB functions without testing for server support * src/xterm.c (x_dnd_cleanup_drag_and_drop): (x_dnd_begin_drag_and_drop): Never call XkbSelectEvents if the X server doesn't have XKB. --- src/xterm.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/xterm.c b/src/xterm.c index da4af8bff75..289ea06d929 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -3615,8 +3615,9 @@ x_dnd_cleanup_drag_and_drop (void *frame) x_dnd_old_window_attrs.your_event_mask); #ifdef HAVE_XKB - XkbSelectEvents (FRAME_X_DISPLAY (f), XkbUseCoreKbd, - XkbStateNotifyMask, 0); + if (FRAME_DISPLAY_INFO (f)->supports_xkb) + XkbSelectEvents (FRAME_X_DISPLAY (f), XkbUseCoreKbd, + XkbStateNotifyMask, 0); #endif unblock_input (); @@ -9760,8 +9761,9 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction, FRAME_DISPLAY_INFO (f)->root_window, root_window_attrs.your_event_mask); #ifdef HAVE_XKB - XkbSelectEvents (FRAME_X_DISPLAY (f), XkbUseCoreKbd, - XkbStateNotifyMask, 0); + if (FRAME_DISPLAY_INFO (f)->supports_xkb) + XkbSelectEvents (FRAME_X_DISPLAY (f), XkbUseCoreKbd, + XkbStateNotifyMask, 0); #endif quit (); } @@ -9781,8 +9783,9 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction, FRAME_DISPLAY_INFO (f)->root_window, root_window_attrs.your_event_mask); #ifdef HAVE_XKB - XkbSelectEvents (FRAME_X_DISPLAY (f), XkbUseCoreKbd, - XkbStateNotifyMask, 0); + if (FRAME_DISPLAY_INFO (f)->supports_xkb) + XkbSelectEvents (FRAME_X_DISPLAY (f), XkbUseCoreKbd, + XkbStateNotifyMask, 0); #endif unblock_input (); -- 2.30.2