diff options
| author | Po Lu | 2022-03-07 21:36:25 +0800 |
|---|---|---|
| committer | Po Lu | 2022-03-07 21:36:25 +0800 |
| commit | 418e5da5d308b4e440f28545eb139211066b48a4 (patch) | |
| tree | 6061adb42a47040a10f8d36854f6e924c4202ac6 | |
| parent | 8a7df412a640c8b2334b78ec0ca872a6d11e8b0e (diff) | |
| download | emacs-418e5da5d308b4e440f28545eb139211066b48a4.tar.gz emacs-418e5da5d308b4e440f28545eb139211066b48a4.zip | |
Correctly handle exposure in oldXMenu
* oldXMenu/Activate.c (XMenuActivate): Call set expose_func if
no pane was found.
(XMenuActivateSetExposeFunction): New function.
* oldXMenu/XMenu.h: New typedef `expose_func'. Update
prototypes.
* src/xmenu.c (x_menu_expose_event): New function.
(x_menu_show): Set expose event handler.
* src/xterm.c (x_dispatch_event): Make `static' only on GTK.
* src/xterm.h: Expose `x_dispatch_event' on no-toolkit builds.
| -rw-r--r-- | oldXMenu/Activate.c | 10 | ||||
| -rw-r--r-- | oldXMenu/XMenu.h | 2 | ||||
| -rw-r--r-- | src/xmenu.c | 9 | ||||
| -rw-r--r-- | src/xterm.c | 8 | ||||
| -rw-r--r-- | src/xterm.h | 2 |
5 files changed, 27 insertions, 4 deletions
diff --git a/oldXMenu/Activate.c b/oldXMenu/Activate.c index 781c05bd026..e679c2ffed6 100644 --- a/oldXMenu/Activate.c +++ b/oldXMenu/Activate.c | |||
| @@ -122,6 +122,7 @@ int x_menu_grab_keyboard = 1; | |||
| 122 | static Wait_func wait_func; | 122 | static Wait_func wait_func; |
| 123 | static void* wait_data; | 123 | static void* wait_data; |
| 124 | static Translate_func translate_func = NULL; | 124 | static Translate_func translate_func = NULL; |
| 125 | static Expose_func expose_func = NULL; | ||
| 125 | 126 | ||
| 126 | void | 127 | void |
| 127 | XMenuActivateSetWaitFunction (Wait_func func, void *data) | 128 | XMenuActivateSetWaitFunction (Wait_func func, void *data) |
| @@ -136,6 +137,12 @@ XMenuActivateSetTranslateFunction (Translate_func func) | |||
| 136 | translate_func = func; | 137 | translate_func = func; |
| 137 | } | 138 | } |
| 138 | 139 | ||
| 140 | void | ||
| 141 | XMenuActivateSetExposeFunction (Expose_func func) | ||
| 142 | { | ||
| 143 | expose_func = func; | ||
| 144 | } | ||
| 145 | |||
| 139 | int | 146 | int |
| 140 | XMenuActivate( | 147 | XMenuActivate( |
| 141 | register Display *display, /* Display to put menu on. */ | 148 | register Display *display, /* Display to put menu on. */ |
| @@ -339,6 +346,9 @@ XMenuActivate( | |||
| 339 | feq = feq_tmp; | 346 | feq = feq_tmp; |
| 340 | } | 347 | } |
| 341 | else if (_XMEventHandler) (*_XMEventHandler)(&event); | 348 | else if (_XMEventHandler) (*_XMEventHandler)(&event); |
| 349 | |||
| 350 | if (expose_func) | ||
| 351 | expose_func (&event); | ||
| 342 | break; | 352 | break; |
| 343 | } | 353 | } |
| 344 | if (event_xmp->activated) { | 354 | if (event_xmp->activated) { |
diff --git a/oldXMenu/XMenu.h b/oldXMenu/XMenu.h index 2eee18a3844..54061235ae7 100644 --- a/oldXMenu/XMenu.h +++ b/oldXMenu/XMenu.h | |||
| @@ -259,6 +259,7 @@ typedef void (*Wait_func)(void*); | |||
| 259 | XPutBackEvent on an equivalent artificial core event on any | 259 | XPutBackEvent on an equivalent artificial core event on any |
| 260 | function it wants to translate. */ | 260 | function it wants to translate. */ |
| 261 | typedef void (*Translate_func)(XEvent *); | 261 | typedef void (*Translate_func)(XEvent *); |
| 262 | typedef void (*Expose_func)(XEvent *); | ||
| 262 | 263 | ||
| 263 | /* | 264 | /* |
| 264 | * XMenu library routine declarations. | 265 | * XMenu library routine declarations. |
| @@ -280,6 +281,7 @@ int XMenuLocate(Display *display, XMenu *menu, int p_num, int s_num, int x_pos, | |||
| 280 | void XMenuSetFreeze(XMenu *menu, int freeze); | 281 | void XMenuSetFreeze(XMenu *menu, int freeze); |
| 281 | void XMenuActivateSetWaitFunction(Wait_func func, void *data); | 282 | void XMenuActivateSetWaitFunction(Wait_func func, void *data); |
| 282 | void XMenuActivateSetTranslateFunction(Translate_func func); | 283 | void XMenuActivateSetTranslateFunction(Translate_func func); |
| 284 | void XMenuActivateSetExposeFunction(Expose_func func); | ||
| 283 | 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)); | 285 | 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)); |
| 284 | char *XMenuPost(Display *display, XMenu *menu, int *p_num, int *s_num, int x_pos, int y_pos, int event_mask); | 286 | char *XMenuPost(Display *display, XMenu *menu, int *p_num, int *s_num, int x_pos, int y_pos, int event_mask); |
| 285 | int XMenuDeletePane(Display *display, XMenu *menu, int p_num); | 287 | int XMenuDeletePane(Display *display, XMenu *menu, int p_num); |
diff --git a/src/xmenu.c b/src/xmenu.c index e085fa1ace5..4d0e5bd81c2 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -280,6 +280,14 @@ x_menu_translate_generic_event (XEvent *event) | |||
| 280 | } | 280 | } |
| 281 | } | 281 | } |
| 282 | #endif | 282 | #endif |
| 283 | |||
| 284 | #if !defined USE_X_TOOLKIT && !defined USE_GTK | ||
| 285 | static void | ||
| 286 | x_menu_expose_event (XEvent *event) | ||
| 287 | { | ||
| 288 | x_dispatch_event (event, event->xexpose.display); | ||
| 289 | } | ||
| 290 | #endif | ||
| 283 | #endif /* ! MSDOS */ | 291 | #endif /* ! MSDOS */ |
| 284 | 292 | ||
| 285 | 293 | ||
| @@ -2638,6 +2646,7 @@ x_menu_show (struct frame *f, int x, int y, int menuflags, | |||
| 2638 | #ifdef HAVE_XINPUT2 | 2646 | #ifdef HAVE_XINPUT2 |
| 2639 | XMenuActivateSetTranslateFunction (x_menu_translate_generic_event); | 2647 | XMenuActivateSetTranslateFunction (x_menu_translate_generic_event); |
| 2640 | #endif | 2648 | #endif |
| 2649 | XMenuActivateSetExposeFunction (x_menu_expose_event); | ||
| 2641 | #endif | 2650 | #endif |
| 2642 | 2651 | ||
| 2643 | record_unwind_protect_ptr (pop_down_menu, | 2652 | record_unwind_protect_ptr (pop_down_menu, |
diff --git a/src/xterm.c b/src/xterm.c index 6682d3c9a46..60cd57b8512 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -13520,14 +13520,17 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 13520 | return count; | 13520 | return count; |
| 13521 | } | 13521 | } |
| 13522 | 13522 | ||
| 13523 | #if defined USE_X_TOOLKIT || defined USE_MOTIF || defined USE_GTK | ||
| 13524 | |||
| 13525 | /* Handles the XEvent EVENT on display DISPLAY. | 13523 | /* Handles the XEvent EVENT on display DISPLAY. |
| 13526 | This is used for event loops outside the normal event handling, | 13524 | This is used for event loops outside the normal event handling, |
| 13527 | i.e. looping while a popup menu or a dialog is posted. | 13525 | i.e. looping while a popup menu or a dialog is posted. |
| 13528 | 13526 | ||
| 13529 | Returns the value handle_one_xevent sets in the finish argument. */ | 13527 | Returns the value handle_one_xevent sets in the finish argument. */ |
| 13528 | |||
| 13529 | #ifdef USE_GTK | ||
| 13530 | static int | ||
| 13531 | #else | ||
| 13530 | int | 13532 | int |
| 13533 | #endif | ||
| 13531 | x_dispatch_event (XEvent *event, Display *display) | 13534 | x_dispatch_event (XEvent *event, Display *display) |
| 13532 | { | 13535 | { |
| 13533 | struct x_display_info *dpyinfo; | 13536 | struct x_display_info *dpyinfo; |
| @@ -13540,7 +13543,6 @@ x_dispatch_event (XEvent *event, Display *display) | |||
| 13540 | 13543 | ||
| 13541 | return finish; | 13544 | return finish; |
| 13542 | } | 13545 | } |
| 13543 | #endif | ||
| 13544 | 13546 | ||
| 13545 | /* Read events coming from the X server. | 13547 | /* Read events coming from the X server. |
| 13546 | Return as soon as there are no more events to be read. | 13548 | Return as soon as there are no more events to be read. |
diff --git a/src/xterm.h b/src/xterm.h index 846df03277c..88949b30391 100644 --- a/src/xterm.h +++ b/src/xterm.h | |||
| @@ -1320,7 +1320,7 @@ extern void x_clear_area (struct frame *f, int, int, int, int); | |||
| 1320 | extern void x_mouse_leave (struct x_display_info *); | 1320 | extern void x_mouse_leave (struct x_display_info *); |
| 1321 | #endif | 1321 | #endif |
| 1322 | 1322 | ||
| 1323 | #if defined USE_X_TOOLKIT || defined USE_MOTIF | 1323 | #ifndef USE_GTK |
| 1324 | extern int x_dispatch_event (XEvent *, Display *); | 1324 | extern int x_dispatch_event (XEvent *, Display *); |
| 1325 | #endif | 1325 | #endif |
| 1326 | extern int x_x_to_emacs_modifiers (struct x_display_info *, int); | 1326 | extern int x_x_to_emacs_modifiers (struct x_display_info *, int); |