Commit Graph

58 Commits

Author SHA1 Message Date
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 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
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
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 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 acd5a64fd1 xdg-shell: use role object destroy handler 2022-11-06 17:00:00 +03:00
Alexander Orzechowski ef4baea0e2 Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
Kirill Primak 5c4384a133 xdg-popup: use configure fields 2022-06-21 15:14:37 +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
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 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 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 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
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 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 52da68b591 xdg popup: move function to a file it belongs to 2021-09-11 12:11:55 +02:00
Simon Ser b934fbaf04 seat: add wlr_seat_touch_{send,notify}_frame
The wl_touch.frame event is used to group multiple touch events
together. Instead of sending it immediately after each touch event,
rely on the backend to send it (and on the compositor to relay it).

This is a breaking change because compositors now need to manually
send touch frame events instead of relying on wlr_seat to do it.
2021-07-08 09:12:17 +02:00
Isaac Freund 129e02b57d xdg shell: make unconstrain_from_box arg const 2021-01-07 21:28:55 +01:00
Greg V b2bd536308 xdg-shell: check for existing role before setting xdg_popup_surface_role
Hopefully fixes #2056
2020-07-04 12:11:19 +02:00
Thomas Hebb dcae6f1431 Allow keyboard and pointer grabs to hook clear_focus()
This is necessary for some grabs, which currently have no way of knowing
when the pointer/keyboard focus has left a surface. For example, without
this, a drag-and-drop grab can erroneously drop into a window that the
cursor is no longer over.

This is the plumbing needed to properly fix swaywm/sway#5220. The
existing fix, swaywm/sway#5222, relies on every grab's `enter()` hook
allowing a `NULL` surface. This is not guaranteed by the API and, in
fact, is not the case for the xdg-shell popup grab and results in a
crash when the cursor leaves a surface and does not immediately enter
another one while a popup is open (#2161).

This fix also adds an assertion to wlr_seat_pointer_notify_enter() that
ensures it's never called with a `NULL` surface. This will make Sway
crash much more until it fixes its usage of the API, so we should land
this at the same time as a fix in Sway (which I haven't posted yet).
2020-06-05 17:20:26 +02:00
Aleksei Bavshin c99d156f0d xdg-shell: fix popups rendered outside of the screen
Leave positioner inverted on the individual axis if it's no longer
constrained. Otherwise constraint adjustment like `slide_x & flip_y`
could render popup outside of the screen when both axes are constrained.

Fixes Alexays/Waybar#532
2020-02-26 13:43:53 +01:00
Sebastian Krzyszkowiak cdfe836b03 Revert "wlr_xdg_popup: don't treat all surfaces of grabbing client as grabbing surfaces"
This reverts commit 52037d13f7.

Fixes #1801
2019-08-27 11:12:09 +09:00
Sebastian Krzyszkowiak 52037d13f7 wlr_xdg_popup: don't treat all surfaces of grabbing client as grabbing surfaces
Fixes #897
2019-08-12 09:31:49 +09:00
Sebastian Krzyszkowiak 78d96009e4 wlr_xdg_popup: grab touch events alongside pointer and keyboard
Fixes #933
2019-08-12 09:31:49 +09:00
emersion 7f5967234c
xdg-shell: destroy child popups on unmap
It doesn't make sense to keep popups opened when unmapped. We also need to do
so in wlr_xdg_popup_destroy so that popups are destroyed in the correct order.
2019-02-05 19:29:00 +01:00
Connor E c1d0729d9a Make popup inert when destroyed. 2019-02-04 10:43:51 +01:00
emersion 2624f667bf
Add missing frame events to shell pointer grabs 2019-01-30 10:31:53 +01:00
Ilia Bozhinov 07865104e1 xdg-popup: fix wlr_xdg_popup_get_toplevel_coords()
The previous code resulted in a crash when we try to unconstrain a popup
which is part of a layer-shell surface popup tree.

Fixes #1425
2018-12-12 08:51:13 +01:00
emersion 5515faa197
xdg-shell: emit xdg_surface destroy when role object is destroyed
Fixes https://github.com/swaywm/wlroots/issues/1407
2018-12-04 13:42:29 +01:00