emacs-diffs
[Top][All Lists]
Advanced

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

master aa685a465b: Ignore scroll lock key on Haiku


From: Po Lu
Subject: master aa685a465b: Ignore scroll lock key on Haiku
Date: Wed, 12 Jan 2022 06:13:00 -0500 (EST)

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

    Ignore scroll lock key on Haiku
    
    * src/haiku_support.cc (keysym_from_raw_char): Return special
    value for keys that shouldn't be sent to Emacs.
    (DispatchMessage): Respect said value.
---
 src/haiku_support.cc | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/src/haiku_support.cc b/src/haiku_support.cc
index 602b850724..d49e319b98 100644
--- a/src/haiku_support.cc
+++ b/src/haiku_support.cc
@@ -136,6 +136,15 @@ gui_abort (const char *msg)
   emacs_abort ();
 }
 
+/* Convert a raw character RAW produced by the keycode KEY into a key
+   symbol and place it in KEYSYM.
+
+   If RAW cannot be converted into a keysym, value is 0.  If RAW can
+   be converted into a keysym, but it should be ignored, value is -1.
+
+   Any other value means success, and that the keysym should be used
+   instead of mapping the keycode into a character.  */
+
 static int
 keysym_from_raw_char (int32 raw, int32 key, unsigned *code)
 {
@@ -190,7 +199,12 @@ keysym_from_raw_char (int32 raw, int32 key, unsigned *code)
       if (*code - XK_F1 == 12)
        *code = XK_Print;
       else if (*code - XK_F1 == 13)
-       *code = XK_Scroll_Lock;
+       /* Okay, Scroll Lock is a bit too much: keyboard.c doesn't
+          know about it yet, and it shouldn't, since that's a
+          modifier key.
+
+          *code = XK_Scroll_Lock; */
+       return -1;
       else if (*code - XK_F1 == 14)
        *code = XK_Pause;
 
@@ -701,6 +715,7 @@ public:
        rq.window = this;
 
        int32 raw, key;
+       int ret;
        msg->FindInt32 ("raw_char", &raw);
        msg->FindInt32 ("key", &key);
 
@@ -719,9 +734,14 @@ public:
        if (mods & B_OPTION_KEY)
          rq.modifiers |= HAIKU_MODIFIER_SUPER;
 
-       if (!keysym_from_raw_char (raw, key, &rq.keysym))
+       ret = keysym_from_raw_char (raw, key, &rq.keysym);
+
+       if (!ret)
          rq.keysym = 0;
 
+       if (ret < 0)
+         return;
+
        rq.multibyte_char = 0;
 
        if (!rq.keysym)



reply via email to

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