From ea70e545c90e0cbfe3ea33c31ba3ef4f3487c32c Mon Sep 17 00:00:00 2001 From: Po Lu Date: Fri, 21 Oct 2022 19:19:33 +0800 Subject: [PATCH] Fix delivery of window manager ping events during menu * oldXMenu/Activate.c (XMenuActivateSetExposeFunction) (XMenuActivate): * oldXMenu/XMenu.h: Remove expose functions. * src/msdos.h (XMenuSetAEQ): Remove no longer used function. * src/xmenu.c (x_menu_expose_event): Delete function. (x_menu_dispatch_event): New function. (x_menu_show): Set it as the XMenu event handler. --- oldXMenu/Activate.c | 10 ---------- oldXMenu/XMenu.h | 2 -- src/msdos.h | 1 - src/xmenu.c | 14 +++++++++----- 4 files changed, 9 insertions(+), 18 deletions(-) diff --git a/oldXMenu/Activate.c b/oldXMenu/Activate.c index e679c2ffed6..781c05bd026 100644 --- a/oldXMenu/Activate.c +++ b/oldXMenu/Activate.c @@ -122,7 +122,6 @@ int x_menu_grab_keyboard = 1; static Wait_func wait_func; static void* wait_data; static Translate_func translate_func = NULL; -static Expose_func expose_func = NULL; void XMenuActivateSetWaitFunction (Wait_func func, void *data) @@ -137,12 +136,6 @@ XMenuActivateSetTranslateFunction (Translate_func func) translate_func = func; } -void -XMenuActivateSetExposeFunction (Expose_func func) -{ - expose_func = func; -} - int XMenuActivate( register Display *display, /* Display to put menu on. */ @@ -346,9 +339,6 @@ XMenuActivate( feq = feq_tmp; } else if (_XMEventHandler) (*_XMEventHandler)(&event); - - if (expose_func) - expose_func (&event); break; } if (event_xmp->activated) { diff --git a/oldXMenu/XMenu.h b/oldXMenu/XMenu.h index 54061235ae7..2eee18a3844 100644 --- a/oldXMenu/XMenu.h +++ b/oldXMenu/XMenu.h @@ -259,7 +259,6 @@ typedef void (*Wait_func)(void*); XPutBackEvent on an equivalent artificial core event on any function it wants to translate. */ typedef void (*Translate_func)(XEvent *); -typedef void (*Expose_func)(XEvent *); /* * XMenu library routine declarations. @@ -281,7 +280,6 @@ int XMenuLocate(Display *display, XMenu *menu, int p_num, int s_num, int x_pos, void XMenuSetFreeze(XMenu *menu, int freeze); void XMenuActivateSetWaitFunction(Wait_func func, void *data); void XMenuActivateSetTranslateFunction(Translate_func func); -void XMenuActivateSetExposeFunction(Expose_func func); int XMenuActivate(Display *display, XMenu *menu, int *p_num, int *s_num, int x_pos, int y_pos, unsigned int event_mask, char **data, void (*help_callback) (char const *, int, int)); char *XMenuPost(Display *display, XMenu *menu, int *p_num, int *s_num, int x_pos, int y_pos, int event_mask); int XMenuDeletePane(Display *display, XMenu *menu, int p_num); diff --git a/src/msdos.h b/src/msdos.h index 24697bcf24b..1b304cf02b9 100644 --- a/src/msdos.h +++ b/src/msdos.h @@ -123,7 +123,6 @@ extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object); #define XGetGeometry(p1,p2,p3,p4,p5,p6,p7,p8,p9) #define DisplayWidth(p1,p2) (SELECTED_FRAME()->text_cols) #define DisplayHeight(p1,p2) (SELECTED_FRAME()->text_lines) -#define XMenuSetAEQ (void) #define XMenuSetFreeze (void) #define XMenuRecompute (void) #define XM_FAILURE -1 diff --git a/src/xmenu.c b/src/xmenu.c index 9d35e3529fb..d9660a6910f 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -294,10 +294,13 @@ x_menu_translate_generic_event (XEvent *event) #endif #if !defined USE_X_TOOLKIT && !defined USE_GTK -static void -x_menu_expose_event (XEvent *event) +static int +x_menu_dispatch_event (XEvent *event) { x_dispatch_event (event, event->xexpose.display); + + /* The return doesn't really matter. */ + return 0; } #endif #endif /* ! MSDOS */ @@ -2747,21 +2750,22 @@ x_menu_show (struct frame *f, int x, int y, int menuflags, y += 1.5 * height/ (maxlines + 2); } - XMenuSetAEQ (menu, true); XMenuSetFreeze (menu, true); pane = selidx = 0; #ifndef MSDOS DEFER_SELECTIONS; - XMenuActivateSetWaitFunction (x_menu_wait_for_event, FRAME_X_DISPLAY (f)); + XMenuActivateSetWaitFunction (x_menu_wait_for_event, + FRAME_X_DISPLAY (f)); + XMenuEventHandler (x_menu_dispatch_event); + /* When the input extension is in use, the owner_events grab will report extension events on frames, which the XMenu library does not normally understand. */ #ifdef HAVE_XINPUT2 XMenuActivateSetTranslateFunction (x_menu_translate_generic_event); #endif - XMenuActivateSetExposeFunction (x_menu_expose_event); #endif record_unwind_protect_ptr (pop_down_menu, -- 2.39.2