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.
This commit is contained in:
Po Lu 2022-10-21 19:19:33 +08:00
parent 4b40b790ae
commit ea70e545c9
4 changed files with 9 additions and 18 deletions

View file

@ -122,7 +122,6 @@ int x_menu_grab_keyboard = 1;
static Wait_func wait_func; static Wait_func wait_func;
static void* wait_data; static void* wait_data;
static Translate_func translate_func = NULL; static Translate_func translate_func = NULL;
static Expose_func expose_func = NULL;
void void
XMenuActivateSetWaitFunction (Wait_func func, void *data) XMenuActivateSetWaitFunction (Wait_func func, void *data)
@ -137,12 +136,6 @@ XMenuActivateSetTranslateFunction (Translate_func func)
translate_func = func; translate_func = func;
} }
void
XMenuActivateSetExposeFunction (Expose_func func)
{
expose_func = func;
}
int int
XMenuActivate( XMenuActivate(
register Display *display, /* Display to put menu on. */ register Display *display, /* Display to put menu on. */
@ -346,9 +339,6 @@ XMenuActivate(
feq = feq_tmp; feq = feq_tmp;
} }
else if (_XMEventHandler) (*_XMEventHandler)(&event); else if (_XMEventHandler) (*_XMEventHandler)(&event);
if (expose_func)
expose_func (&event);
break; break;
} }
if (event_xmp->activated) { if (event_xmp->activated) {

View file

@ -259,7 +259,6 @@ typedef void (*Wait_func)(void*);
XPutBackEvent on an equivalent artificial core event on any XPutBackEvent on an equivalent artificial core event on any
function it wants to translate. */ function it wants to translate. */
typedef void (*Translate_func)(XEvent *); typedef void (*Translate_func)(XEvent *);
typedef void (*Expose_func)(XEvent *);
/* /*
* XMenu library routine declarations. * 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 XMenuSetFreeze(XMenu *menu, int freeze);
void XMenuActivateSetWaitFunction(Wait_func func, void *data); void XMenuActivateSetWaitFunction(Wait_func func, void *data);
void XMenuActivateSetTranslateFunction(Translate_func func); 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)); 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); 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); int XMenuDeletePane(Display *display, XMenu *menu, int p_num);

View file

@ -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 XGetGeometry(p1,p2,p3,p4,p5,p6,p7,p8,p9)
#define DisplayWidth(p1,p2) (SELECTED_FRAME()->text_cols) #define DisplayWidth(p1,p2) (SELECTED_FRAME()->text_cols)
#define DisplayHeight(p1,p2) (SELECTED_FRAME()->text_lines) #define DisplayHeight(p1,p2) (SELECTED_FRAME()->text_lines)
#define XMenuSetAEQ (void)
#define XMenuSetFreeze (void) #define XMenuSetFreeze (void)
#define XMenuRecompute (void) #define XMenuRecompute (void)
#define XM_FAILURE -1 #define XM_FAILURE -1

View file

@ -294,10 +294,13 @@ x_menu_translate_generic_event (XEvent *event)
#endif #endif
#if !defined USE_X_TOOLKIT && !defined USE_GTK #if !defined USE_X_TOOLKIT && !defined USE_GTK
static void static int
x_menu_expose_event (XEvent *event) x_menu_dispatch_event (XEvent *event)
{ {
x_dispatch_event (event, event->xexpose.display); x_dispatch_event (event, event->xexpose.display);
/* The return doesn't really matter. */
return 0;
} }
#endif #endif
#endif /* ! MSDOS */ #endif /* ! MSDOS */
@ -2747,21 +2750,22 @@ x_menu_show (struct frame *f, int x, int y, int menuflags,
y += 1.5 * height/ (maxlines + 2); y += 1.5 * height/ (maxlines + 2);
} }
XMenuSetAEQ (menu, true);
XMenuSetFreeze (menu, true); XMenuSetFreeze (menu, true);
pane = selidx = 0; pane = selidx = 0;
#ifndef MSDOS #ifndef MSDOS
DEFER_SELECTIONS; 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 /* When the input extension is in use, the owner_events grab will
report extension events on frames, which the XMenu library does report extension events on frames, which the XMenu library does
not normally understand. */ not normally understand. */
#ifdef HAVE_XINPUT2 #ifdef HAVE_XINPUT2
XMenuActivateSetTranslateFunction (x_menu_translate_generic_event); XMenuActivateSetTranslateFunction (x_menu_translate_generic_event);
#endif #endif
XMenuActivateSetExposeFunction (x_menu_expose_event);
#endif #endif
record_unwind_protect_ptr (pop_down_menu, record_unwind_protect_ptr (pop_down_menu,