]> git.eshelyaron.com Git - emacs.git/commitdiff
Correctly handle exposure in oldXMenu
authorPo Lu <luangruo@yahoo.com>
Mon, 7 Mar 2022 13:36:25 +0000 (21:36 +0800)
committerPo Lu <luangruo@yahoo.com>
Mon, 7 Mar 2022 13:36:25 +0000 (21:36 +0800)
* 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.

oldXMenu/Activate.c
oldXMenu/XMenu.h
src/xmenu.c
src/xterm.c
src/xterm.h

index 781c05bd026474ad1dd1eb32a3c96c22046e882c..e679c2ffed653847e0bb13fdb3a1d99843a6d161 100644 (file)
@@ -122,6 +122,7 @@ 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)
@@ -136,6 +137,12 @@ 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. */
@@ -339,6 +346,9 @@ XMenuActivate(
                    feq = feq_tmp;
                }
                else if (_XMEventHandler) (*_XMEventHandler)(&event);
+
+               if (expose_func)
+                 expose_func (&event);
                break;
            }
            if (event_xmp->activated) {
index 2eee18a3844f03571230bdb13466ea2ea55f0c48..54061235ae77f9a63218c7b91a09931bb0fe5d53 100644 (file)
@@ -259,6 +259,7 @@ 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.
@@ -280,6 +281,7 @@ 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);
index e085fa1ace51cf12f260a07d69950435d645ccc1..4d0e5bd81c2d1ad30afe73eed386a0e287e920aa 100644 (file)
@@ -280,6 +280,14 @@ x_menu_translate_generic_event (XEvent *event)
     }
 }
 #endif
+
+#if !defined USE_X_TOOLKIT && !defined USE_GTK
+static void
+x_menu_expose_event (XEvent *event)
+{
+  x_dispatch_event (event, event->xexpose.display);
+}
+#endif
 #endif /* ! MSDOS */
 
 \f
@@ -2638,6 +2646,7 @@ x_menu_show (struct frame *f, int x, int y, int menuflags,
 #ifdef HAVE_XINPUT2
   XMenuActivateSetTranslateFunction (x_menu_translate_generic_event);
 #endif
+  XMenuActivateSetExposeFunction (x_menu_expose_event);
 #endif
 
   record_unwind_protect_ptr (pop_down_menu,
index 6682d3c9a4660adac7a47d9baae2863748323546..60cd57b8512dc293582b815461f5b87607eee674 100644 (file)
@@ -13520,14 +13520,17 @@ handle_one_xevent (struct x_display_info *dpyinfo,
   return count;
 }
 
-#if defined USE_X_TOOLKIT || defined USE_MOTIF || defined USE_GTK
-
 /* Handles the XEvent EVENT on display DISPLAY.
    This is used for event loops outside the normal event handling,
    i.e. looping while a popup menu or a dialog is posted.
 
    Returns the value handle_one_xevent sets in the finish argument.  */
+
+#ifdef USE_GTK
+static int
+#else
 int
+#endif
 x_dispatch_event (XEvent *event, Display *display)
 {
   struct x_display_info *dpyinfo;
@@ -13540,7 +13543,6 @@ x_dispatch_event (XEvent *event, Display *display)
 
   return finish;
 }
-#endif
 
 /* Read events coming from the X server.
    Return as soon as there are no more events to be read.
index 846df03277c2ffba001cecd04e94c79936f5ef0e..88949b303917b4d3b2eb5a77387e41f5d029c366 100644 (file)
@@ -1320,7 +1320,7 @@ extern void x_clear_area (struct frame *f, int, int, int, int);
 extern void x_mouse_leave (struct x_display_info *);
 #endif
 
-#if defined USE_X_TOOLKIT || defined USE_MOTIF
+#ifndef USE_GTK
 extern int x_dispatch_event (XEvent *, Display *);
 #endif
 extern int x_x_to_emacs_modifiers (struct x_display_info *, int);