Commit graph

152 commits

Author SHA1 Message Date
Kirill Primak
811ca199c4 xdg-shell: drop automatic surface configuration
Compositors now are expected to wait for an initial commit by checking
wlr_xdg_surface.initial_commit on every surface commit and send
(schedule) configure events manually.
2024-02-06 13:48:00 +00:00
Kirill Primak
0052078bd3 compositor: introduce wlr_surface_reject_pending() 2024-01-27 12:05:05 +00:00
Simon Ser
00bb1b0f84 seat/pointer: add support for axis_relative_direction event 2024-01-23 08:37:29 +00:00
Simon Ser
b80337a8f2 xdg-shell: assert that configure events carry positive or zero sizes
Negative values here would indicate a compositor bug. For xdg_popup,
zero values are not allowed.
2024-01-22 17:49:38 +01:00
Simon Ser
4b3553409a xdg-shell: use wlr_surface_synced for popups 2023-12-25 11:47:15 +01:00
Simon Ser
9201431c29 xdg-shell: use wlr_surface_synced for toplevel 2023-12-25 11:47:15 +01:00
Simon Ser
69d9a4e2cb xdg-shell: use wlr_surface_synced for wlr_xdg_surface 2023-12-25 11:47:15 +01:00
Kirill Primak
c85838892d xdg-{shell,decoration}: improve events
This commit changes the behavior of `new_*` signals to better match
their names (see https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3608).
wlr_xdg_shell.events.new_surface is now emitted when an xdg_surface is
created, and wlr_xdg_shell.events.new_{toplevel,popup} events are
introduced to get notified when an xdg_{toplevel,popup} is created.
Same applies to
`wlr_xdg_decoration_manager_v1.events.new_toplevel_decoration`. As a
result, wlr_xdg_surface.added and wlr_xdg_toplevel_decoration_v1.added
are removed, as we no longer need to track whether the corresponding
event was emitted.

Additionally, this commit changes the behavior of
wlr_xdg_surface.events.destroy: it is now emitted when the xdg_surface
is destroyed, as the name suggests.
wlr_xdg_{toplevel,popup}.events.destroy events are added to get
notified when an xdg_{toplevel,popup} is destroyed.
2023-11-23 12:52:20 +00:00
Manuel Stoeckl
a3d22dbe97 xdg-toplevel: check that title provided actually is UTF-8
While the xdg-shell protocol requires this, it does not yet have
a dedicated error code for invalid titles; this commit makes
wlroots send a generic error instead.
2023-11-22 22:03:00 +03:00
Simon Ser
319e4125ab xdg-shell: add wlr_xdg_{toplevel,popup}_try_from_wlr_surface()
Convenience helpers for compositors. Saves them the trouble of
manually checking the role (and if they forget to do so, prevents
an invalid cast).
2023-11-13 10:31:00 +01:00
Kirill Primak
5fac9b1beb xdg-toplevel: don't send maximized if tiled is requested but not supported
This is a bit too magical and may break compositors which try not to
send duplicate configure events.
2023-10-29 15:51:12 +00:00
Kirill Primak
d253d70786 xdg-shell: use wlr_surface.unmap_commit 2023-10-26 19:06:40 +03:00
Kirill Primak
0de3659698 Drop wl_client and user data assertions in bind handlers
A client can never be NULL and user data assertions aren't really
useful there.
2023-10-10 20:10:00 +03:00
Kirill Primak
86c30b8715 seat: remove wlr_seat_validate_grab_serial()
It makes little sense to have a catch-all grab vaildation function,
considering that e.g. tablet tool implicit grabs are possible as well.
Besides, the function has always returned true anyway.
2023-10-06 08:51:47 +00:00
Alexander Orzechowski
1b0694b794 treewide: Migrate from sizeof(struct) to sizeof(*pointer) where practical 2023-10-03 01:51:07 -04:00
Kirill Primak
0fdbdc36c0 xdg-surface: fix init state flow
Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3677
2023-10-02 18:37:09 +00:00
Kirill Primak
016494af1b xdg-surface: assert that xdg_surface isn't inert 2023-10-02 18:37:09 +00:00
Kirill Primak
e315068b98 xdg-popup: validate parent
This matches Mutter's behavior.

Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3576
2023-09-01 12:48:36 +03:00
Kirill Primak
bd5c4f4a4a xdg-shell: rework roles 2023-08-21 16:30:29 +00:00
Kirill Primak
e5300c225e xdg-popup: avoid using wlr_surface_destroy_role_object() 2023-08-21 16:30:29 +00:00
Kirill Primak
10ba8ebc70 Don't assume xdg_surface.{toplevel,popup} is non-NULL
This assumption will become incorrect with future commits.
2023-08-21 16:30:29 +00:00
Kirill Primak
f0cc712af1 xdg-shell: don't return anything from create_xdg_surface() 2023-08-21 16:30:29 +00:00
Leonardo Hernández Hernández
e8d545a977
xdg-shell: add support for v6
This adds the suspended toplevel state
2023-07-23 20:30:43 -06:00
Simon Ser
89cb484220 compositor: replace role_data with role_resource
This increases type safety, makes it more obvious that role_data
must represent the role object, and will allow for automatic
cleanup when the resource is destroyed.
2023-06-23 14:23:27 +02:00
Kirill Primak
0f67580aab compositor: introduce wlr_surface_set_role_object() 2023-06-23 11:54:05 +00:00
Väinö Mäkelä
07e27ba854 xdg-popup: Handle inert seats
According to the protocol text, the popup will be immediately dismissed
when the grab is rejected. Because the grab can't be executed with a
destroyed seat, the popup is dismissed when one is provided.
2023-06-03 10:43:12 +00:00
Kirill Primak
b0437fc416 xdg-shell: use unified map logic 2023-06-02 17:26:18 +00:00
Kirill Primak
a3489f2c64 xdg-shell: improve unmapping logic slightly 2023-03-12 11:09:36 +00:00
Isaac Freund
5ae17de23f
xdg-shell: improve validation of resize edges
The current validation doesn't catch some invalid values such as 3 or 7.
2023-03-02 21:31:51 +01:00
Simon Ser
711a1a3ed4 xdg-shell: convert to try_from
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/884
2023-02-01 20:12:49 +01:00
Simon Ser
0f24d27e0b xdg-shell: rename wlr_xdg_popup.committed to sent_initial_configure
We made a similar change to wlr_xdg_toplevel.
2023-01-31 16:27:05 +01:00
Simon Ser
df0c926a7a xdg-shell: rename wlr_xdg_toplevel.added to sent_initial_configure
This is more descriptive, and avoids the confusion with
wlr_xdg_surface.added.
2023-01-31 16:20:33 +01:00
Simon Ser
e1a1dc4be5 xdg-shell: remove unnecessary return
We're at the end of the function anyways.
2023-01-31 16:20:33 +01:00
Simon Ser
e69dd909f7 xdg-shell: reset added/committed flag on unmap
When a client attaches a NULL buffer to its wl_surface, it's
unmapped. This resets the xdg_surface in its initial state. An
extra NULL commit makes the compositor send an initial configure
event.

Note, wlr_xdg_toplevel.added is separate from wlr_xdg_surface.added.

Closes: https://github.com/swaywm/sway/issues/7397
2023-01-31 16:20:10 +01:00
Simon Ser
0e54b861e9 seat/keyboard: constify wlr_seat_keyboard_notify_enter() 2023-01-26 15:06:45 +00:00
Simon Ser
695d28c250 seat/keyboard: constify wlr_seat_keyboard_notify_modifiers() 2023-01-26 15:06:45 +00:00
Kirill Primak
79248e4961 xdg-shell: use defunct_role_object error 2022-12-07 13:54:31 +00:00
Kirill Primak
c2fb5289c2 xdg-shell: send invalid_size errors 2022-11-17 10:03:52 +00:00
Kirill Primak
099b9de752 compositor: drop role object NULL checks in handlers
Instead, move the check to the caller.
2022-11-06 17:00:00 +03:00
Kirill Primak
acd5a64fd1 xdg-shell: use role object destroy handler 2022-11-06 17:00:00 +03:00
Kirill Primak
1243a855d4 xdg-shell: fix geometry types 2022-11-05 18:30:09 +00:00
Kirill Primak
a049d66dd7 xdg-toplevel: send invalid_parent error 2022-10-14 10:57:49 +00:00
Kirill Primak
ebd4c83cd6 xdg-toplevel: validate resize_edge 2022-09-17 08:20:24 +00:00
Alexander Orzechowski
ef4baea0e2 Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
Kenny Levinsen
7abe8352db xdg_shell: Destroy popups after unmap event
This aligns with wlr_layer_shell_v1, and better matches how we normally use
teardown signals.
2022-08-06 00:20:42 +02:00
Kenny Levinsen
668b2740ff Set mapped before firing map/unmap events
This allows whatever the user calls from the signal handlers to react to observe
the new state rather than the old, e.g. that a surface is no longer mapped in
the unmap handler.
2022-08-06 00:19:38 +02:00
Simon Ser
f1e05a6493 xdg-shell: add support for v5
This version adds a wm_capabilities event.
2022-08-01 18:50:16 +02:00
Kirill Primak
5c4384a133 xdg-popup: use configure fields 2022-06-21 15:14:37 +00:00
Kirill Primak
8d2fa15e9d xdg-toplevel: post no memory on strdup() fail 2022-06-21 17:37:45 +03:00
Kirill Primak
e7b217efb9 xdg-shell: improve shell version check 2022-06-11 20:22:54 +03:00