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

Keyboard interactivity options #2555

Merged
merged 1 commit into from
Jan 12, 2021

Conversation

dkondor
Copy link
Contributor

@dkondor dkondor commented Dec 18, 2020

Implementation for swaywm/wlr-protocols#100

The goal of this is to enable layer-shell clients to have "regular" keyboard focus semantics. This can make it easier to implement layer-shell clients (no need to adjust the keyboard-interactivity setting when needed); also, it allows better support for keyboard interaction on the main layer-shell surface, including being notified of keyboard notifiers along with mouse clicks.

For clients using the old version of the protocol, any value is still interpreted as requesting exclusive focus. For clients with using the new protocol version, the compositor can interpret the given value. according to its policies.

Question: should there be a way for compositors to specify which version to use in wlr_layer_shell_v1_create()?


Breaking change: wlr_layer_surface_v1_state.keyboard_interactivity has now the type enum zwlr_layer_surface_v1_keyboard_interactivity to reflect protocol changes.

@dkondor
Copy link
Contributor Author

dkondor commented Dec 18, 2020

Matching Wayfire PR: WayfireWM/wayfire#962

@@ -498,7 +509,7 @@ struct wlr_layer_shell_v1 *wlr_layer_shell_v1_create(struct wl_display *display)
}

struct wl_global *global = wl_global_create(display,
&zwlr_layer_shell_v1_interface, 2, layer_shell, layer_shell_bind);
&zwlr_layer_shell_v1_interface, zwlr_layer_shell_v1_interface.version, layer_shell, layer_shell_bind);
Copy link
Member

Choose a reason for hiding this comment

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

We can't advertise zwlr_layer_shell_v1_interface.version here, because re-compiling with an XML file that has v5 won't make the wlroots code handle v5 properly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I just rebased on master after #2608 -- I'm still wondering if it would make sense to allow a compositor to request a lower version than available in wlroots (so if it does not support the new version, only the lower version will be advertised to clients). It would still be a breaking change though since that would need to be an extra parameter for this function.

Copy link
Member

Choose a reason for hiding this comment

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

Our policy so far has been that compositors always need to support the version supported by wlroots.

In this particular case it's not a big deal because compositors are not required to focus layer surfaces.

@emersion
Copy link
Member

emersion commented Jan 7, 2021

Also need to update the protocol XML to the latest version.

@dkondor dkondor force-pushed the keyboard_interactivity_options2 branch from b4786c1 to 837574c Compare January 7, 2021 15:16
@dkondor
Copy link
Contributor Author

dkondor commented Jan 7, 2021

I've addressed the comments, aside from my question about letting the compositor set the version it wants to support; if you think it's worth it, I can try to add a separate interface for that.

Copy link
Member

@emersion emersion left a comment

Choose a reason for hiding this comment

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

LGTM, can you squash everything into a single commit?

@emersion emersion added the breaking Breaking change in public API label Jan 8, 2021
Value is now an enum with a new value ("on-demand") that compositors can use to allow "normal" keyboard focus semantics regardless of the layer the client surface is on. An error is sent for invalid keyboard interactivity values. The old behavior is retained for clients using the previous version of the protocol.

Also adjusted the layer-shell example program to use the new keyboard interactivity options.
@dkondor dkondor force-pushed the keyboard_interactivity_options2 branch from 837574c to 6498666 Compare January 8, 2021 09:42
@dkondor
Copy link
Contributor Author

dkondor commented Jan 8, 2021

LGTM, can you squash everything into a single commit?

Great, I just squashed it, thanks!

@emersion emersion merged commit b7dc4f2 into swaywm:master Jan 12, 2021
@emersion
Copy link
Member

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
breaking Breaking change in public API
Development

Successfully merging this pull request may close these issues.

3 participants