Skip to content

Commit

Permalink
FIX: single ctrl key not set flags in gdk's event/state
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbegin committed May 6, 2020
1 parent 8807332 commit fa101a5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
27 changes: 27 additions & 0 deletions modules/view/backends/gtk3/events.reds
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,33 @@ keycode-ascii: [
;-- 80h
]

special-key-to-flags: func [
key [integer!]
return: [integer!]
][
case [
key = RED_VK_LCONTROL [
EVT_FLAG_CTRL_DOWN
]
key = RED_VK_RCONTROL [
EVT_FLAG_CTRL_DOWN
]
key = RED_VK_LSHIFT [
EVT_FLAG_SHIFT_DOWN
]
key = RED_VK_RSHIFT [
EVT_FLAG_SHIFT_DOWN
]
key = RED_VK_LMENU [
EVT_FLAG_MENU_DOWN
]
key = RED_VK_RMENU [
EVT_FLAG_MENU_DOWN
]
true [0]
]
]

make-at: func [
widget [handle!]
face [red-object!]
Expand Down
4 changes: 4 additions & 0 deletions modules/view/backends/gtk3/handlers.reds
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,10 @@ key-press-event: func [
key: translate-key event-key/keyval
flags: check-extra-keys event-key/state
special-key: either char-key? as-byte key [0][-1] ;-- special key or not
if all [key >= 80h special-key = -1][
flags: flags or special-key-to-flags key
key: 0
]
res: make-event widget key or flags EVT_KEY_DOWN
if res <> EVT_NO_DISPATCH [
key2: gdk_keyval_to_unicode event-key/keyval
Expand Down

0 comments on commit fa101a5

Please sign in to comment.