Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

virtual_keyboard: Release keys on destroy#2697

Closed
tadeokondrak wants to merge 1 commit intoswaywm:masterfrom
tadeokondrak:virtual-keyboard-release-keys
Closed

virtual_keyboard: Release keys on destroy#2697
tadeokondrak wants to merge 1 commit intoswaywm:masterfrom
tadeokondrak:virtual-keyboard-release-keys

Conversation

@tadeokondrak
Copy link
Copy Markdown
Contributor

Fixes #2034.

@emersion
Copy link
Copy Markdown
Member

Hm, but maybe this applies to physical keyboards as well? What happens if you hold a key and disconnect your keyboard? Same applies to the keyboards for the Wayland/X11 backends.

Maybe this logic should be part of wlr_keyboard_destroy?

@tadeokondrak
Copy link
Copy Markdown
Contributor Author

Hm, but maybe this applies to physical keyboards as well? What happens if you hold a key and disconnect your keyboard?

It doesn't keep repeating, I'm not sure what handles this.

Wayland backend

Is the parent Wayland compositor leaving a key pressed when removing the keyboard capability from a seat something that clients should handle?

X11 backend

It only has one seat, so keyboards can't be removed during runtime.

@tadeokondrak tadeokondrak force-pushed the virtual-keyboard-release-keys branch from 01b5f97 to ccd6b4f Compare February 8, 2021 17:01

void wlr_keyboard_init(struct wlr_keyboard *keyboard,
const struct wlr_keyboard_impl *impl);
void wlr_keyboard_release_keys(struct wlr_keyboard *keyboard);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this shouldn't be a public function. Not sure what to do instead, though.

}

void wlr_keyboard_destroy(struct wlr_keyboard *kb) {
if (kb == NULL) {
Copy link
Copy Markdown

@jaens jaens Apr 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could wlr_keyboard_release_keys be called inside wlr_keyboard_destroy instead?
That way it could be private. [edit: I see this was suggested above as well]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be best indeed. I'm not a fan of having keyboard-specific stuff inside the common code.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wlr_keyboard_destroy is called after the destroy signal on the wlr_input_device is emitted.
If the keys are released after that signal, the original issue isn't fixed anymore.

@emersion
Copy link
Copy Markdown
Member

emersion commented May 5, 2021

I wonder if instead we should keep the status quo and make it so destroying a keyboard implicitly releases all keys.

@emersion
Copy link
Copy Markdown
Member

emersion commented May 7, 2021

Superseded by #2918

@emersion emersion closed this May 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

virtual-keyboard: release unreleased keys

3 participants