diff options
| author | Alan Third | 2020-11-10 12:54:50 +0000 |
|---|---|---|
| committer | Alan Third | 2020-12-14 20:32:06 +0000 |
| commit | ee6c702e1895d88ee7e6f57bc6778694239ead76 (patch) | |
| tree | 344c10d0fa798c7bd8a29b6c906e039a0a1ec292 /src | |
| parent | 668f0a7f847264dbc9549aeb2d42b967e25eef5f (diff) | |
| download | emacs-ee6c702e1895d88ee7e6f57bc6778694239ead76.tar.gz emacs-ee6c702e1895d88ee7e6f57bc6778694239ead76.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.
(cherry picked from commit 7970610d48701a949ce443c94c71eac47d044197)
Diffstat (limited to 'src')
| -rw-r--r-- | src/nsterm.m | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/nsterm.m b/src/nsterm.m index 4defeee7c3a..af06968d088 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -6350,6 +6350,14 @@ not_in_argv (NSString *arg) | |||
| 6350 | code = 0xFF08; /* backspace */ | 6350 | code = 0xFF08; /* backspace */ |
| 6351 | else | 6351 | else |
| 6352 | code = fnKeysym; | 6352 | code = fnKeysym; |
| 6353 | |||
| 6354 | /* Function keys (such as the F-keys, arrow keys, etc.) set | ||
| 6355 | modifiers as though the fn key has been pressed when it | ||
| 6356 | hasn't. Also some combinations of fn and a function key | ||
| 6357 | return a different key than was pressed (e.g. fn-<left> | ||
| 6358 | gives <home>). We need to unset the fn key flag in these | ||
| 6359 | cases. */ | ||
| 6360 | flags &= ~NS_FUNCTION_KEY_MASK; | ||
| 6353 | } | 6361 | } |
| 6354 | 6362 | ||
| 6355 | /* The ⌘ and ⌥ modifiers can be either shift-like (for alternate | 6363 | /* The ⌘ and ⌥ modifiers can be either shift-like (for alternate |
| @@ -6371,17 +6379,6 @@ not_in_argv (NSString *arg) | |||
| 6371 | Lisp_Object kind = fnKeysym ? QCfunction : QCordinary; | 6379 | Lisp_Object kind = fnKeysym ? QCfunction : QCordinary; |
| 6372 | emacs_event->modifiers = EV_MODIFIERS2 (flags, kind); | 6380 | emacs_event->modifiers = EV_MODIFIERS2 (flags, kind); |
| 6373 | 6381 | ||
| 6374 | /* Function keys (such as the F-keys, arrow keys, etc.) set | ||
| 6375 | modifiers as though the fn key has been pressed when it | ||
| 6376 | hasn't. Also some combinations of fn and a function key | ||
| 6377 | return a different key than was pressed (e.g. fn-<left> gives | ||
| 6378 | <home>). We need to unset the fn modifier in these cases. | ||
| 6379 | FIXME: Can we avoid setting it in the first place? */ | ||
| 6380 | if (fnKeysym && (flags & NS_FUNCTION_KEY_MASK)) | ||
| 6381 | emacs_event->modifiers | ||
| 6382 | ^= parse_solitary_modifier (mod_of_kind (ns_function_modifier, | ||
| 6383 | QCfunction)); | ||
| 6384 | |||
| 6385 | if (NS_KEYLOG) | 6382 | if (NS_KEYLOG) |
| 6386 | fprintf (stderr, "keyDown: code =%x\tfnKey =%x\tflags = %x\tmods = %x\n", | 6383 | fprintf (stderr, "keyDown: code =%x\tfnKey =%x\tflags = %x\tmods = %x\n", |
| 6387 | code, fnKeysym, flags, emacs_event->modifiers); | 6384 | code, fnKeysym, flags, emacs_event->modifiers); |