Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that input focus is returned to correct window when i3lock quits #302

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

CometStorm991
Copy link

Description

  • The input focus does not always return to the previously focused window after i3lock-color quits.
  • For example, when the --composite option is enabled, the parent window set by parent_win = composite_reply->overlay_win; in xcb.c can be different from the window from which focus was stolen.
  • If i3-lock fails to grab the pointer and keyboard on its first attempt, the input focus will be set to i3lock and will later revert to the parent window (which may not be the correct window when the --composite option is enabled) as shown below (comments removed)
    auth_state = STATE_AUTH_LOCK;
    if (!grab_pointer_and_keyboard(conn, screen, cursor, 1000)) {
        DEBUG("stole focus from X11 window 0x%08x\n", stolen_focus);

        xcb_set_input_focus(conn, XCB_INPUT_FOCUS_PARENT /* revert_to */, win, XCB_CURRENT_TIME);
        ...
    }
  • Incorrectly reverting the input focus can cause user input in DE/WMs to seem "frozen" since keyboard input may not appear to work (although the mouse may work).
  • Adding xcb_set_input_focus(conn, XCB_INPUT_FOCUS_PARENT /* revert_to */, stolen_focus, XCB_CURRENT_TIME); to the end of main(...), ensures that focus returns to the correct window stolen_focus.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant