diff options
author | Po Lu <luangruo@yahoo.com> | 2022-03-01 14:44:02 +0800 |
---|---|---|
committer | Po Lu <luangruo@yahoo.com> | 2022-03-01 14:44:02 +0800 |
commit | db9b9435cddb1201bc57c65f44f90208e7047582 (patch) | |
tree | 6d54fd520b5fac80c56b5b132527c6832ba9f2a5 /oldXMenu | |
parent | 6b8808ab8ce21e9367e0dd930d4d074e5b21ff6b (diff) | |
download | emacs-db9b9435cddb1201bc57c65f44f90208e7047582.tar.gz emacs-db9b9435cddb1201bc57c65f44f90208e7047582.tar.bz2 emacs-db9b9435cddb1201bc57c65f44f90208e7047582.zip |
Fix old X menu on builds with XI2
* oldXMenu/Activate.c (XMenuActivateSetTranslateFunction): New
function.
(XMenuActivate): Handle generic events.
* oldXMenu/XMenu.h: New prototypes.
(Translate_func): New type.
* src/xmenu.c (x_menu_wait_translate_generic_event): New
function.
(x_menu_show): Set translate function.
Diffstat (limited to 'oldXMenu')
-rw-r--r-- | oldXMenu/Activate.c | 13 | ||||
-rw-r--r-- | oldXMenu/XMenu.h | 6 |
2 files changed, 19 insertions, 0 deletions
diff --git a/oldXMenu/Activate.c b/oldXMenu/Activate.c index 646631df84b..447b7398ca2 100644 --- a/oldXMenu/Activate.c +++ b/oldXMenu/Activate.c @@ -121,6 +121,7 @@ int x_menu_grab_keyboard = 1; static Wait_func wait_func; static void* wait_data; +static Translate_func translate_func = NULL; void XMenuActivateSetWaitFunction (Wait_func func, void *data) @@ -129,6 +130,12 @@ XMenuActivateSetWaitFunction (Wait_func func, void *data) wait_data = data; } +void +XMenuActivateSetTranslateFunction (Translate_func func) +{ + translate_func = func; +} + int XMenuActivate( register Display *display, /* Display to put menu on. */ @@ -515,6 +522,12 @@ XMenuActivate( feq = feq_tmp; } else if (_XMEventHandler) (*_XMEventHandler)(&event); + break; +#ifdef HAVE_XINPUT2 + case GenericEvent: + if (translate_func) + translate_func (&event); +#endif } /* * If a selection has been made, break out of the event loop. diff --git a/oldXMenu/XMenu.h b/oldXMenu/XMenu.h index 50ea6834090..2eee18a3844 100644 --- a/oldXMenu/XMenu.h +++ b/oldXMenu/XMenu.h @@ -255,6 +255,11 @@ typedef struct _xmenu { typedef void (*Wait_func)(void*); +/* Function for translating GenericEvents. It is should call + XPutBackEvent on an equivalent artificial core event on any + function it wants to translate. */ +typedef void (*Translate_func)(XEvent *); + /* * XMenu library routine declarations. */ @@ -274,6 +279,7 @@ void XMenuEventHandler(int (*handler) (XEvent *)); int XMenuLocate(Display *display, XMenu *menu, int p_num, int s_num, int x_pos, int y_pos, int *ul_x, int *ul_y, int *width, int *height); void XMenuSetFreeze(XMenu *menu, int freeze); void XMenuActivateSetWaitFunction(Wait_func func, void *data); +void XMenuActivateSetTranslateFunction(Translate_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); |