emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 418e5da5d3: Correctly handle exposure in oldXMenu


From: Po Lu
Subject: master 418e5da5d3: Correctly handle exposure in oldXMenu
Date: Mon, 7 Mar 2022 08:39:32 -0500 (EST)

branch: master
commit 418e5da5d308b4e440f28545eb139211066b48a4
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    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.
---
 oldXMenu/Activate.c | 10 ++++++++++
 oldXMenu/XMenu.h    |  2 ++
 src/xmenu.c         |  9 +++++++++
 src/xterm.c         |  8 +++++---
 src/xterm.h         |  2 +-
 5 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/oldXMenu/Activate.c b/oldXMenu/Activate.c
index 781c05bd02..e679c2ffed 100644
--- a/oldXMenu/Activate.c
+++ b/oldXMenu/Activate.c
@@ -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) {
diff --git a/oldXMenu/XMenu.h b/oldXMenu/XMenu.h
index 2eee18a384..54061235ae 100644
--- a/oldXMenu/XMenu.h
+++ b/oldXMenu/XMenu.h
@@ -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);
diff --git a/src/xmenu.c b/src/xmenu.c
index e085fa1ace..4d0e5bd81c 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -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 */
 
 
@@ -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,
diff --git a/src/xterm.c b/src/xterm.c
index 6682d3c9a4..60cd57b851 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -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.
diff --git a/src/xterm.h b/src/xterm.h
index 846df03277..88949b3039 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);
 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);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]