aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlan Third2020-11-10 12:54:50 +0000
committerAlan Third2020-11-13 16:15:00 +0000
commit7970610d48701a949ce443c94c71eac47d044197 (patch)
tree2c56381739f35e77408aed4a2efa8e49f402aa1d /src
parent297f89f7e4becd64c1732af6db8ba925186d1d45 (diff)
downloademacs-7970610d48701a949ce443c94c71eac47d044197.tar.gz
emacs-7970610d48701a949ce443c94c71eac47d044197.zip
Fix error with fn key in NS port (bug#44533)
* src/nsterm.m ([EmacsView keyDown:]): Move the correction for fn key handling to before the modifiers are calculated.
Diffstat (limited to 'src')
-rw-r--r--src/nsterm.m19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/nsterm.m b/src/nsterm.m
index 4fad521b74c..a9280eb4af9 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -6531,6 +6531,14 @@ not_in_argv (NSString *arg)
6531 code = 0xFF08; /* backspace */ 6531 code = 0xFF08; /* backspace */
6532 else 6532 else
6533 code = fnKeysym; 6533 code = fnKeysym;
6534
6535 /* Function keys (such as the F-keys, arrow keys, etc.) set
6536 modifiers as though the fn key has been pressed when it
6537 hasn't. Also some combinations of fn and a function key
6538 return a different key than was pressed (e.g. fn-<left>
6539 gives <home>). We need to unset the fn key flag in these
6540 cases. */
6541 flags &= ~NS_FUNCTION_KEY_MASK;
6534 } 6542 }
6535 6543
6536 /* The ⌘ and ⌥ modifiers can be either shift-like (for alternate 6544 /* The ⌘ and ⌥ modifiers can be either shift-like (for alternate
@@ -6552,17 +6560,6 @@ not_in_argv (NSString *arg)
6552 Lisp_Object kind = fnKeysym ? QCfunction : QCordinary; 6560 Lisp_Object kind = fnKeysym ? QCfunction : QCordinary;
6553 emacs_event->modifiers = EV_MODIFIERS2 (flags, kind); 6561 emacs_event->modifiers = EV_MODIFIERS2 (flags, kind);
6554 6562
6555 /* Function keys (such as the F-keys, arrow keys, etc.) set
6556 modifiers as though the fn key has been pressed when it
6557 hasn't. Also some combinations of fn and a function key
6558 return a different key than was pressed (e.g. fn-<left> gives
6559 <home>). We need to unset the fn modifier in these cases.
6560 FIXME: Can we avoid setting it in the first place? */
6561 if (fnKeysym && (flags & NS_FUNCTION_KEY_MASK))
6562 emacs_event->modifiers
6563 ^= parse_solitary_modifier (mod_of_kind (ns_function_modifier,
6564 QCfunction));
6565
6566 if (NS_KEYLOG) 6563 if (NS_KEYLOG)
6567 fprintf (stderr, "keyDown: code =%x\tfnKey =%x\tflags = %x\tmods = %x\n", 6564 fprintf (stderr, "keyDown: code =%x\tfnKey =%x\tflags = %x\tmods = %x\n",
6568 code, fnKeysym, flags, emacs_event->modifiers); 6565 code, fnKeysym, flags, emacs_event->modifiers);