Commit Graph

32 Commits

Author SHA1 Message Date
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
emersion 95dfbe2962
xdg-shell: don't destroy xdg role state on role destroy
ie. don't destroy surface->toplevel on xdg_toplevel destroy. Instead do this on
xdg_surface destroy.

This allows compositors to add toplevel listeners when the surface appears and
remove them when the surface is destroyed.
2018-11-12 19:37:22 +01:00
emersion 16d7e09d99 surface: add wlr_surface_role.precommit
This allows to emit the unmap event before the surface becomes
actually unmapped for most shells.
2018-07-15 19:30:19 +01:00
emersion 33db4263a0
surface: replace wlr_surface_set_role_committed with wlr_surface_role 2018-07-07 22:45:16 +01:00
Dominique Martinet a3e2a77734 xdg_popup: fix call to to handle_grab for inert popup 2018-06-28 20:28:15 +09:00
Dominique Martinet 970687a01c xdg_shell popup: fix potential segv in handle_destroy
surface could be NULL there if the popup had been made
inert before
2018-06-28 13:54:35 +09:00
Tony Crisci 006edc9dcb xdg-shell: end pointer and keyboard grab at the same time 2018-06-24 18:50:04 -04:00
Ryan Dwyer 516c864d46 Fix mistakes in xdg_popup and xdg_popup_v6 2018-06-04 22:00:40 +10:00
emersion 3036507463
xdg-shell: split into multiple files 2018-05-14 22:28:45 +01:00