Skip to content

Commit

Permalink
Input: Do not grab focus from active window
Browse files Browse the repository at this point in the history
This is essentially the same as 53fa4c7, but for `XGrabKeyboard`, not just `XGrabButton`. See that commit for details

ref phil294/vimium-everywhere#3
  • Loading branch information
phil294 committed Jul 5, 2023
1 parent c6ad56b commit 0b92357
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/cmd/x11/window/win-util.cr
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Cmd::X11::Window::Util
wid = title[7..].to_u64?
raise Run::RuntimeException.new "ahk_id must be a number" if ! wid
win = XDo::Window.new(thread.runner.display.x_do.xdo_p, wid)
win = nil if ! win.name
win = nil if ! win.name # avoids segfaults
else
text = match_conditions[1]? || ""
exclude_title = match_conditions[2]? || ""
Expand Down
3 changes: 1 addition & 2 deletions src/run/display/x11.cr
Original file line number Diff line number Diff line change
Expand Up @@ -336,10 +336,9 @@ module Run
end
@mutex.unlock
end
# TODO: retest, also BlockInput command
def grab_keyboard
@mutex.lock
@display.grab_keyboard(grab_window: @root_win, owner_events: true, pointer_mode: ::X11::GrabModeAsync, keyboard_mode: ::X11::GrabModeAsync, time: ::X11::CurrentTime)
@display.grab_keyboard(grab_window: @last_active_window, owner_events: true, pointer_mode: ::X11::GrabModeAsync, keyboard_mode: ::X11::GrabModeAsync, time: ::X11::CurrentTime)
@mutex.unlock
end
def ungrab_keyboard
Expand Down

0 comments on commit 0b92357

Please sign in to comment.