Skip to content

Commit

Permalink
fix {esc} hotkey
Browse files Browse the repository at this point in the history
fixes #48
  • Loading branch information
phil294 committed Jul 8, 2023
1 parent 73f1442 commit 2f2537d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/run/display/x11.cr
Expand Up @@ -293,7 +293,7 @@ module Run
_key_event.type = type
_key_event.keycode = keycode
_key_event.state = state
if keycode <= 9 # mouse button
if type >= 4 # mouse button. keycode will be 1-9
# pretend that keysym = keycode
@key_handler.not_nil!.call(_key_event, keycode.to_u64, nil)
else
Expand Down
24 changes: 23 additions & 1 deletion tests.ahk
Expand Up @@ -3,7 +3,7 @@
; Right now, only commands that can be easily tested in 1-2 lines are tested.
;;;;;;;;;;;;;;;;;;;;;;

N_TESTS = 48
N_TESTS = 50

GoSub, run_tests
if tests_run != %N_TESTS%
Expand Down Expand Up @@ -633,6 +633,28 @@ runwait, xdotool key shift+s
expect = hotkey shift_s lowercase,hotkey_shift_s_success,1
gosub assert

; esc and xbutton2 share the same keycode:
goto l_after_esc_hotkey
hotkey_esc:
hotkey_esc_success = 1
return
l_after_esc_hotkey:
hotkey, esc, hotkey_esc
runwait, xdotool key Escape
expect = hotkey esc,hotkey_esc_success,1
gosub assert
hotkey, esc, off
goto l_after_xbutton2_hotkey
hotkey_xbutton2:
hotkey_xbutton2_success = 1
return
l_after_xbutton2_hotkey:
hotkey, xbutton2, hotkey_xbutton2
runwait, xdotool click 9
expect = hotkey xbutton2,hotkey_xbutton2_success,1
gosub assert
hotkey, xbutton2, off

Send, {LButton}
sleep 20
expect = send {lbutton},gui_button_clicked_success,1
Expand Down

0 comments on commit 2f2537d

Please sign in to comment.