aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2022-01-12 11:09:38 +0000
committerPo Lu2022-01-12 11:09:38 +0000
commitaa685a465b4c347194efd5948563eaa01d0dcce6 (patch)
treebdf9fa3720f9ed8071a77e14b98556122689d31b /src
parent60dd962507ea1f7f5b41cb76d1efd9c0a0957353 (diff)
downloademacs-aa685a465b4c347194efd5948563eaa01d0dcce6.tar.gz
emacs-aa685a465b4c347194efd5948563eaa01d0dcce6.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/haiku_support.cc24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/haiku_support.cc b/src/haiku_support.cc
index 602b8507244..d49e319b98c 100644
--- a/src/haiku_support.cc
+++ b/src/haiku_support.cc
@@ -136,6 +136,15 @@ gui_abort (const char *msg)
136 emacs_abort (); 136 emacs_abort ();
137} 137}
138 138
139/* Convert a raw character RAW produced by the keycode KEY into a key
140 symbol and place it in KEYSYM.
141
142 If RAW cannot be converted into a keysym, value is 0. If RAW can
143 be converted into a keysym, but it should be ignored, value is -1.
144
145 Any other value means success, and that the keysym should be used
146 instead of mapping the keycode into a character. */
147
139static int 148static int
140keysym_from_raw_char (int32 raw, int32 key, unsigned *code) 149keysym_from_raw_char (int32 raw, int32 key, unsigned *code)
141{ 150{
@@ -190,7 +199,12 @@ keysym_from_raw_char (int32 raw, int32 key, unsigned *code)
190 if (*code - XK_F1 == 12) 199 if (*code - XK_F1 == 12)
191 *code = XK_Print; 200 *code = XK_Print;
192 else if (*code - XK_F1 == 13) 201 else if (*code - XK_F1 == 13)
193 *code = XK_Scroll_Lock; 202 /* Okay, Scroll Lock is a bit too much: keyboard.c doesn't
203 know about it yet, and it shouldn't, since that's a
204 modifier key.
205
206 *code = XK_Scroll_Lock; */
207 return -1;
194 else if (*code - XK_F1 == 14) 208 else if (*code - XK_F1 == 14)
195 *code = XK_Pause; 209 *code = XK_Pause;
196 210
@@ -701,6 +715,7 @@ public:
701 rq.window = this; 715 rq.window = this;
702 716
703 int32 raw, key; 717 int32 raw, key;
718 int ret;
704 msg->FindInt32 ("raw_char", &raw); 719 msg->FindInt32 ("raw_char", &raw);
705 msg->FindInt32 ("key", &key); 720 msg->FindInt32 ("key", &key);
706 721
@@ -719,9 +734,14 @@ public:
719 if (mods & B_OPTION_KEY) 734 if (mods & B_OPTION_KEY)
720 rq.modifiers |= HAIKU_MODIFIER_SUPER; 735 rq.modifiers |= HAIKU_MODIFIER_SUPER;
721 736
722 if (!keysym_from_raw_char (raw, key, &rq.keysym)) 737 ret = keysym_from_raw_char (raw, key, &rq.keysym);
738
739 if (!ret)
723 rq.keysym = 0; 740 rq.keysym = 0;
724 741
742 if (ret < 0)
743 return;
744
725 rq.multibyte_char = 0; 745 rq.multibyte_char = 0;
726 746
727 if (!rq.keysym) 747 if (!rq.keysym)