Commit graph

112 commits

Author SHA1 Message Date
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
Simon Ser
e383c1f1db xdg-shell: add support for v4
This adds a configure_bounds event to let the client know of the
preferred maximum window geometry size.
2022-06-01 18:18:54 +02:00
Kirill Primak
c1ec71903c xdg-shell: bump version to 3 2022-05-27 13:31:30 +00:00
Kirill Primak
1761c3bbe2 xdg-popup: add reposition support 2022-05-27 13:31:30 +00:00
Kirill Primak
8a0835c59c xdg-positioner: add v3 parameters 2022-05-27 13:31:30 +00:00
Kirill Primak
6f1fce9cb4 xdg-popup: use current/pending state pattern 2022-05-27 13:31:30 +00:00
Kirill Primak
4a968576e4 xdg-popup: add proper configure flow 2022-05-27 13:31:30 +00:00
Simon Ser
8fe3aa29da xdg-shell: specify version in wlr_xdg_shell_create
With protocol additions such as [1], compositors currently have no
way to opt out of the version upgrade. The protocol upgrade will
always be backwards-compatible but may require new compositor
features.

The status quo doesn't make it possible to ship a protocol addition
without breaking the wlroots API. This will be an issue for API
stabilization [2].

To address this, let compositors provide a maximum version in the
function creating the global. We need to support all previous versions
of the interface anyways because of older clients.

This mechanism works the same way as Wayland clients passing a version
in wl_global.bind.

[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3514
[2]: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/1008

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3397
2022-05-15 15:44:40 +00:00
Kirill Primak
8b0d4947cc xdg-toplevel: store states on the stack 2022-05-10 19:19:08 +03:00
Kirill Primak
dec2565f2b xdg-toplevel: don't schedule configures on state requests 2022-04-13 17:00:06 +00:00
Kirill Primak
bf3f60ff73 xdg-toplevel: treat unmapped parents as NULL 2022-04-13 16:48:15 +00:00
Kirill Primak
2d623724c3 xdg-positioner: fix sliding regression
This commit fixes a regression introduced in
511f137f8f where GTK tooltips wouldn't be
unconstrained due to no gravity on x axis being set, in which case the
behavior is ambiguous, by sliding to the right/bottom.
2022-03-15 18:08:29 +00:00
Kirill Primak
511f137f8f xdg-positioner: rewrite unconstraining, untie from xdg-popup 2022-02-21 17:26:51 +00:00
Kirill Primak
5879e77d68 xdg-positioner: rename structs
To be consistent with other wlr_xdg_* structs,
wlr_xdg_positioner_resource is renamed to wlr_xdg_positioner and made
public, and wlr_xdg_positioner is renamed to wlr_xdg_positioner_rules.
Functions which operated on wlr_xdg_positioner were renamed and updated
accordingly.
2022-02-21 17:26:51 +00:00
Kirill Primak
b5b15b2625 xdg-{toplevel,popup}: extract destructors 2022-02-21 17:26:51 +00:00
Kirill Primak
c1a2c09ade xdg-popup: send invalid_positioner to the right resource 2022-02-02 21:06:12 +03:00
Kirill Primak
7ed60c54a0 xdg-surface: avoid emitting signals with their owner object
https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/1008#note_1139647
2022-02-02 21:06:12 +03:00
Kirill Primak
34a71eae31 xdg-shell: drop wlr_xdg_toplevel_set_fullscreen_event
Instead, compositors can read relevant values from
wlr_xdg_toplevel.requested.
2022-02-02 21:06:12 +03:00
Kirill Primak
fd3a2a0906 xdg-surface: minor consistency renaming 2022-02-02 21:06:12 +03:00
Kirill Primak
88f3040438 xdg-popup: destroy popup-less grab
This also fixes a seat destruction segfaulting if xdg-shell was
destroyed first.
2022-02-02 21:06:12 +03:00
Kirill Primak
d2b36b7bd1 xdg-shell: fix potential use-after-free 2022-02-02 21:06:12 +03:00
Kirill Primak
c35d14ecfa xdg-shell: extract role-specific unmap logic 2022-02-02 21:06:12 +03:00
Kirill Primak
e59aa3e0e7 xdg-toplevel: change object type in event structs
This commit replaces wlr_xdg_toplevel_*_event::surface with a toplevel
field.
2022-02-02 21:06:12 +03:00
Kirill Primak
1e4c1a3b58 xdg-toplevel: change parent type to xdg-toplevel
This commit changes wlr_xdg_toplevel::parent type from wlr_xdg_surface
to wlr_xdg_toplevel.
2022-02-02 21:06:12 +03:00
Kirill Primak
27c8865a4d xdg-shell: unify function arguments' names
`wlr_xdg_surface`s are now named "surface" everywhere, and
`wlr_surface`s are called "wlr_surface".
2022-02-02 21:06:12 +03:00
Kirill Primak
41412cadbe xdg-popup: fix functions' main argument type
With this commit, `wlr_xdg_popup_*()` functions now expect
a `wlr_xdg_popup` instead of a `wlr_xdg_surface`.
2022-02-02 21:06:12 +03:00
Kirill Primak
affe0d8713 xdg-toplevel: fix functions' main argument type
With this commit, `wlr_xdg_toplevel_*()` functions now expect
a `wlr_xdg_toplevel` instead of a `wlr_xdg_surface`.
2022-02-02 21:06:11 +03:00
Kirill Primak
ee52c32915 xdg-shell: fix create_xdg_popup() param type 2022-02-02 21:04:59 +03:00
Kirill Primak
05dd990e43 xdg-shell: rename surface role handlers 2022-02-02 21:04:59 +03:00
Kirill Primak
50827ed7f5 surface: improve role precommit hook
Now the role precommit hook is called before the commit, not on
wl_surface.commit request, and takes a state which is to be applied.
2022-01-13 15:15:54 +03:00
Kirill Primak
28248dd83b xdg-shell: remove redundant NULL buffer check
This is already checked in role precommit handler, and if the buffer is
NULL due to failed upload, that means the surface was already unmapped.
2021-10-06 10:15:49 +02:00
tiosgz
ce66244fd2 surface_at: check if surfaces are mapped 2021-10-02 11:38:40 +02:00
tiosgz
893434b2d4 for_each_surface: only iterate mapped surfaces
These functions are used mostly for rendering, where including unmapped
surfaces is undesired.

This is a breaking change. However, few to no usages will have to be
updated.
2021-10-02 11:38:40 +02:00
Simon Ser
744a5c2fef xdg-shell: stop clearing wlr_xdg_surface state on unmap
The protocol doesn't say we should, so let's not.

Also it's pointless to reset scheduled_serial, since 0 is a valid
serial.
2021-09-30 23:17:32 +03:00
Simon Ser
665a164f27 xdg-shell: rename wlr_xdg_surface.next_configure_serial
Rename it to scheduled_serial for consistency with the rest of
wlroots.
2021-09-30 23:17:32 +03:00
Simon Ser
0e34208344 xdg-shell: introduce wlr_xdg_surface.current
This holds the current state, and avoids having ad-hoc fields in
wlr_xdg_surface.
2021-09-30 23:17:32 +03:00
Kirill Primak
db4afc2408 xdg-surface: add pending state
struct wlr_xdg_surface_state is introduced to hold the geometry
and configure serial to be applied on next wl_surface.commit.

This commit fixes our handling for ack_configure: instead of making
the request mutate our current state, it mutates the pending state
only.

Co-authored-by: Simon Ser <contact@emersion.fr>
2021-09-30 23:17:32 +03:00
Kirill Primak
ccc84f11a4 xdg surface: check adding configure_idle for NULL 2021-09-21 10:09:09 +02:00
Kirill Primak
0e2d369106 xdg-surface: simplify configure mechanism
This commit removes any checks whether a configure will change anything
and makes configures be sent unconditionally. Additionally, configures
are scheduled on xdg_toplevel.{un,}set_{maximized,fullscreen} events.
2021-09-21 10:09:09 +02:00
Kirill Primak
b72a217fcc xdg-toplevel: refactor configure/state flow
Previously, `wlr_xdg_toplevel` didn't follow the usual "current state +
pending state" pattern and instead had confusingly named
`client_pending` and `server_pending`. This commit removes them, and
instead introduces `wlr_xdg_toplevel.scheduled` to store the properties
that are yet to be sent to a client, and `wlr_xdg_toplevel.requested`
to store the properties that a client has requested. They have different
types to emphasize that they aren't actual states.
2021-09-21 10:09:09 +02:00
Kirill Primak
52da68b591 xdg popup: move function to a file it belongs to 2021-09-11 12:11:55 +02:00