emacs-diffs
[Top][All Lists]
Advanced

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

feature/android 7cd11a71fa8 2/2: Avoid splurious menu-bar nil events


From: Po Lu
Subject: feature/android 7cd11a71fa8 2/2: Avoid splurious menu-bar nil events
Date: Tue, 18 Jul 2023 01:26:19 -0400 (EDT)

branch: feature/android
commit 7cd11a71fa8d02b9f7115d76b440905b778c398b
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Avoid splurious menu-bar nil events
    
    * src/keyboard.c (make_lispy_event): Return nil if no menu item
    is found.
---
 src/keyboard.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/src/keyboard.c b/src/keyboard.c
index a65d706ee2d..97172be8152 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -6222,6 +6222,11 @@ make_lispy_event (struct input_event *event)
                          }
                      }
 
+                   /* Don't generate a menu bar event if ITEM is
+                      nil.  */
+                   if (NILP (item))
+                     return Qnil;
+
                    /* ELisp manual 2.4b says (x y) are window
                       relative but code says they are
                       frame-relative.  */
@@ -6566,6 +6571,10 @@ make_lispy_event (struct input_event *event)
 #endif /* HAVE_WINDOW_SYSTEM */
 
        f = XFRAME (event->frame_or_window);
+
+       if (!FRAME_LIVE_P (f))
+         return Qnil;
+
        id = event->arg;
        x = event->x;
        y = event->y;
@@ -6641,6 +6650,9 @@ make_lispy_event (struct input_event *event)
        bool close;
 #endif /* HAVE_WINDOW_SYSTEM */
 
+       if (!FRAME_LIVE_P (f))
+         return Qnil;
+
        id = event->arg;
        x = event->x;
        y = event->y;
@@ -6680,6 +6692,11 @@ make_lispy_event (struct input_event *event)
                          }
                      }
 
+                   /* Don't generate a menu bar event if ITEM is
+                      nil.  */
+                   if (NILP (item))
+                     return Qnil;
+
                    /* ELisp manual 2.4b says (x y) are window
                       relative but code says they are
                       frame-relative.  */
@@ -6769,6 +6786,9 @@ make_lispy_event (struct input_event *event)
        struct frame *f = XFRAME (event->frame_or_window);
        evt = Qnil;
 
+       if (!FRAME_LIVE_P (f))
+         return Qnil;
+
        for (tem = event->arg; CONSP (tem); tem = XCDR (tem))
          {
            it = XCAR (tem);
@@ -6777,10 +6797,19 @@ make_lispy_event (struct input_event *event)
            y = XCAR (XCDR (it));
            id = XCAR (XCDR (XCDR (it)));
 
+           /* Don't report touches to the menu bar.  */
+           if (EQ (id, menu_bar_touch_id))
+             continue;
+
            position = make_lispy_position (f, x, y, event->timestamp);
            evt = Fcons (Fcons (id, position), evt);
          }
 
+       if (NILP (evt))
+         /* Don't return an event if the touchpoint list is
+            empty.  */
+         return Qnil;
+
        return list2 (Qtouchscreen_update, evt);
       }
 



reply via email to

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