Merge pull request #29 from tiosgz/wlr-0.13

Fix incompatibilities with wlroots 0.13
This commit is contained in:
buffet 2021-07-30 17:51:43 +00:00 committed by GitHub
commit cd36d81a6a
5 changed files with 119 additions and 27 deletions

View file

@ -15,9 +15,9 @@ struct kiwmi_output {
struct kiwmi_desktop *desktop; struct kiwmi_desktop *desktop;
struct wlr_output *wlr_output; struct wlr_output *wlr_output;
struct wl_listener frame; struct wl_listener frame;
struct wl_listener commit;
struct wl_listener destroy; struct wl_listener destroy;
struct wl_listener mode; struct wl_listener mode;
struct wl_listener transform;
struct wl_list layers[4]; // struct kiwmi_layer_surface::link struct wl_list layers[4]; // struct kiwmi_layer_surface::link

View file

@ -168,6 +168,19 @@ output_frame_notify(struct wl_listener *listener, void *data)
wlr_output_commit(wlr_output); wlr_output_commit(wlr_output);
} }
static void
output_commit_notify(struct wl_listener *listener, void *data)
{
struct kiwmi_output *output = wl_container_of(listener, output, commit);
struct wlr_output_event_commit *event = data;
if (event->committed & WLR_OUTPUT_STATE_TRANSFORM) {
arrange_layers(output);
wl_signal_emit(&output->events.resize, output);
}
}
static void static void
output_destroy_notify(struct wl_listener *listener, void *UNUSED(data)) output_destroy_notify(struct wl_listener *listener, void *UNUSED(data))
{ {
@ -195,16 +208,6 @@ output_mode_notify(struct wl_listener *listener, void *UNUSED(data))
wl_signal_emit(&output->events.resize, output); wl_signal_emit(&output->events.resize, output);
} }
static void
output_transform_notify(struct wl_listener *listener, void *UNUSED(data))
{
struct kiwmi_output *output = wl_container_of(listener, output, transform);
arrange_layers(output);
wl_signal_emit(&output->events.resize, output);
}
static struct kiwmi_output * static struct kiwmi_output *
output_create(struct wlr_output *wlr_output, struct kiwmi_desktop *desktop) output_create(struct wlr_output *wlr_output, struct kiwmi_desktop *desktop)
{ {
@ -219,15 +222,15 @@ output_create(struct wlr_output *wlr_output, struct kiwmi_desktop *desktop)
output->frame.notify = output_frame_notify; output->frame.notify = output_frame_notify;
wl_signal_add(&wlr_output->events.frame, &output->frame); wl_signal_add(&wlr_output->events.frame, &output->frame);
output->commit.notify = output_commit_notify;
wl_signal_add(&wlr_output->events.commit, &output->commit);
output->destroy.notify = output_destroy_notify; output->destroy.notify = output_destroy_notify;
wl_signal_add(&wlr_output->events.destroy, &output->destroy); wl_signal_add(&wlr_output->events.destroy, &output->destroy);
output->mode.notify = output_mode_notify; output->mode.notify = output_mode_notify;
wl_signal_add(&wlr_output->events.mode, &output->mode); wl_signal_add(&wlr_output->events.mode, &output->mode);
output->transform.notify = output_transform_notify;
wl_signal_add(&wlr_output->events.transform, &output->transform);
return output; return output;
} }

View file

@ -75,7 +75,7 @@ keyboard_key_notify(struct wl_listener *listener, void *data)
bool handled = false; bool handled = false;
if (event->state == WLR_KEY_PRESSED) { if (event->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
handled = handled =
switch_vt(translated_syms, translated_syms_len, server->backend); switch_vt(translated_syms, translated_syms_len, server->backend);
} }
@ -91,7 +91,7 @@ keyboard_key_notify(struct wl_listener *listener, void *data)
.handled = false, .handled = false,
}; };
if (event->state == WLR_KEY_PRESSED) { if (event->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
wl_signal_emit(&keyboard->events.key_down, &data); wl_signal_emit(&keyboard->events.key_down, &data);
} else { } else {
wl_signal_emit(&keyboard->events.key_up, &data); wl_signal_emit(&keyboard->events.key_up, &data);

View file

@ -33,7 +33,7 @@ server_init(struct kiwmi_server *server, char *config_path)
server->wl_event_loop = wl_display_get_event_loop(server->wl_display); server->wl_event_loop = wl_display_get_event_loop(server->wl_display);
server->backend = wlr_backend_autocreate(server->wl_display, NULL); server->backend = wlr_backend_autocreate(server->wl_display);
if (!server->backend) { if (!server->backend) {
wlr_log(WLR_ERROR, "Failed to create backend"); wlr_log(WLR_ERROR, "Failed to create backend");
wl_display_destroy(server->wl_display); wl_display_destroy(server->wl_display);

View file

@ -25,7 +25,7 @@
THIS SOFTWARE. THIS SOFTWARE.
</copyright> </copyright>
<interface name="zwlr_layer_shell_v1" version="2"> <interface name="zwlr_layer_shell_v1" version="4">
<description summary="create surfaces that are layers of the desktop"> <description summary="create surfaces that are layers of the desktop">
Clients can use this interface to assign the surface_layer role to Clients can use this interface to assign the surface_layer role to
wl_surfaces. Such surfaces are assigned to a "layer" of the output and wl_surfaces. Such surfaces are assigned to a "layer" of the output and
@ -47,6 +47,12 @@
or manipulate a buffer prior to the first layer_surface.configure call or manipulate a buffer prior to the first layer_surface.configure call
must also be treated as errors. must also be treated as errors.
After creating a layer_surface object and setting it up, the client
must perform an initial commit without any buffer attached.
The compositor will reply with a layer_surface.configure event.
The client must acknowledge it and is then allowed to attach a buffer
to map the surface.
You may pass NULL for output to allow the compositor to decide which You may pass NULL for output to allow the compositor to decide which
output to use. Generally this will be the one that the user most output to use. Generally this will be the one that the user most
recently interacted with. recently interacted with.
@ -82,9 +88,19 @@
<entry name="top" value="2"/> <entry name="top" value="2"/>
<entry name="overlay" value="3"/> <entry name="overlay" value="3"/>
</enum> </enum>
<!-- Version 3 additions -->
<request name="destroy" type="destructor" since="3">
<description summary="destroy the layer_shell object">
This request indicates that the client will not use the layer_shell
object any more. Objects that have been created through this instance
are not affected.
</description>
</request>
</interface> </interface>
<interface name="zwlr_layer_surface_v1" version="2"> <interface name="zwlr_layer_surface_v1" version="4">
<description summary="layer metadata interface"> <description summary="layer metadata interface">
An interface that may be implemented by a wl_surface, for surfaces that An interface that may be implemented by a wl_surface, for surfaces that
are designed to be rendered as a layer of a stacked desktop-like are designed to be rendered as a layer of a stacked desktop-like
@ -93,6 +109,14 @@
Layer surface state (layer, size, anchor, exclusive zone, Layer surface state (layer, size, anchor, exclusive zone,
margin, interactivity) is double-buffered, and will be applied at the margin, interactivity) is double-buffered, and will be applied at the
time wl_surface.commit of the corresponding wl_surface is called. time wl_surface.commit of the corresponding wl_surface is called.
Attaching a null buffer to a layer surface unmaps it.
Unmapping a layer_surface means that the surface cannot be shown by the
compositor until it is explicitly mapped again. The layer_surface
returns to the state it had right after layer_shell.get_layer_surface.
The client can re-map the surface by performing a commit without any
buffer attached, waiting for a configure event and handling it as usual.
</description> </description>
<request name="set_size"> <request name="set_size">
@ -179,21 +203,85 @@
<arg name="left" type="int"/> <arg name="left" type="int"/>
</request> </request>
<enum name="keyboard_interactivity">
<description summary="types of keyboard interaction possible for a layer shell surface">
Types of keyboard interaction possible for layer shell surfaces. The
rationale for this is twofold: (1) some applications are not interested
in keyboard events and not allowing them to be focused can improve the
desktop experience; (2) some applications will want to take exclusive
keyboard focus.
</description>
<entry name="none" value="0">
<description summary="no keyboard focus is possible">
This value indicates that this surface is not interested in keyboard
events and the compositor should never assign it the keyboard focus.
This is the default value, set for newly created layer shell surfaces.
This is useful for e.g. desktop widgets that display information or
only have interaction with non-keyboard input devices.
</description>
</entry>
<entry name="exclusive" value="1">
<description summary="request exclusive keyboard focus">
Request exclusive keyboard focus if this surface is above the shell surface layer.
For the top and overlay layers, the seat will always give
exclusive keyboard focus to the top-most layer which has keyboard
interactivity set to exclusive. If this layer contains multiple
surfaces with keyboard interactivity set to exclusive, the compositor
determines the one receiving keyboard events in an implementation-
defined manner. In this case, no guarantee is made when this surface
will receive keyboard focus (if ever).
For the bottom and background layers, the compositor is allowed to use
normal focus semantics.
This setting is mainly intended for applications that need to ensure
they receive all keyboard events, such as a lock screen or a password
prompt.
</description>
</entry>
<entry name="on_demand" value="2" since="4">
<description summary="request regular keyboard focus semantics">
This requests the compositor to allow this surface to be focused and
unfocused by the user in an implementation-defined manner. The user
should be able to unfocus this surface even regardless of the layer
it is on.
Typically, the compositor will want to use its normal mechanism to
manage keyboard focus between layer shell surfaces with this setting
and regular toplevels on the desktop layer (e.g. click to focus).
Nevertheless, it is possible for a compositor to require a special
interaction to focus or unfocus layer shell surfaces (e.g. requiring
a click even if focus follows the mouse normally, or providing a
keybinding to switch focus between layers).
This setting is mainly intended for desktop shell components (e.g.
panels) that allow keyboard interaction. Using this option can allow
implementing a desktop shell that can be fully usable without the
mouse.
</description>
</entry>
</enum>
<request name="set_keyboard_interactivity"> <request name="set_keyboard_interactivity">
<description summary="requests keyboard events"> <description summary="requests keyboard events">
Set to 1 to request that the seat send keyboard events to this layer Set how keyboard events are delivered to this surface. By default,
surface. For layers below the shell surface layer, the seat will use layer shell surfaces do not receive keyboard events; this request can
normal focus semantics. For layers above the shell surface layers, the be used to change this.
seat will always give exclusive keyboard focus to the top-most layer
which has keyboard interactivity set to true. This setting is inherited by child surfaces set by the get_popup
request.
Layer surfaces receive pointer, touch, and tablet events normally. If Layer surfaces receive pointer, touch, and tablet events normally. If
you do not want to receive them, set the input region on your surface you do not want to receive them, set the input region on your surface
to an empty region. to an empty region.
Events is double-buffered, see wl_surface.commit. Keyboard interactivity is double-buffered, see wl_surface.commit.
</description> </description>
<arg name="keyboard_interactivity" type="uint"/> <arg name="keyboard_interactivity" type="uint" enum="keyboard_interactivity"/>
</request> </request>
<request name="get_popup"> <request name="get_popup">
@ -278,6 +366,7 @@
<entry name="invalid_surface_state" value="0" summary="provided surface state is invalid"/> <entry name="invalid_surface_state" value="0" summary="provided surface state is invalid"/>
<entry name="invalid_size" value="1" summary="size is invalid"/> <entry name="invalid_size" value="1" summary="size is invalid"/>
<entry name="invalid_anchor" value="2" summary="anchor bitfield is invalid"/> <entry name="invalid_anchor" value="2" summary="anchor bitfield is invalid"/>
<entry name="invalid_keyboard_interactivity" value="3" summary="keyboard interactivity is invalid"/>
</enum> </enum>
<enum name="anchor" bitfield="true"> <enum name="anchor" bitfield="true">
@ -295,7 +384,7 @@
Layer is double-buffered, see wl_surface.commit. Layer is double-buffered, see wl_surface.commit.
</description> </description>
<arg name="layer" type="uint" enum="layer" summary="layer to move this surface to"/> <arg name="layer" type="uint" enum="zwlr_layer_shell_v1.layer" summary="layer to move this surface to"/>
</request> </request>
</interface> </interface>
</protocol> </protocol>