Commit Graph

56 Commits

Author SHA1 Message Date
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 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 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
Simon Zeni e192d87731 move wlr_box from /types to /util 2021-07-06 21:43:17 +02:00
zccrs 11040d4942 Make the xdg_popup_get_position to public
Rename the xdg_popup_get_position to
wlr_xdg_popup_get_position
2021-06-03 09:50:54 +02:00
Isaac Freund f574ca934c xdg shell: remove wlr_xdg_surface_for_each_popup()
This function is inferior to wlr_xdg_surface_for_each_popup_surface()
for rendering as it does not iterate over subsurfaces. Furthermore,
no compositor is known to use this to iterate popups for any purpose
other than rendering. Therefore remove the function, which may of course
be reintroduced at a later date if a use-case is found.
2021-01-12 11:25:55 +01:00
Isaac Freund 8f63557ed7 xdg shell: add wlr_xdg_surface_popup_surface_at()
This function will allow compositors to implement input handling in a
way consistent with rendering more easily.

Calling wlr_xdg_surface_surface_at() and checking if the result is a
wlr_xdg_popup is flawed as there may be subsurfaces in the popup tree.
2021-01-08 12:05:13 +01:00
Isaac Freund c5c5ab9724 xdg shell: add wlr_xdg_surface_for_each_popup_surface()
When rendering, it is necessary to iterate the subsurfaces as well,
so add a function that makes this easy.
2021-01-08 10:33:16 +01:00
Isaac Freund 129e02b57d xdg shell: make unconstrain_from_box arg const 2021-01-07 21:28:55 +01:00
Ilia Bozhinov 42d033e738 xdg-shell: add wlr_xdg_toplevel_set_parent
Co-authored-by: Jason Francis <cycl0ps@tuta.io>
2021-01-05 20:32:56 +01:00
Isaac Freund 616f06c25c xdg_positioner: remove unused field
The resource field of wlr_xdg_positioner is never initialized or
accessed within wlroots. The wl_resource for this interface is stored
in the wlr_xdg_positioner_resource struct.
2020-10-16 12:49:37 +02:00
Isaac Freund 2072d59da5 xdg-shell: split last-acked and current state
These states are distinct in the time period between the ack_configure
and the next commit on the surface. Splitting these states avoids the
following race for example:

- client starts at 1000x1000
- wlr_xdg_toplevel_set_size 500x500
- size is different -> configure sent
- client acks the configure
- wlr_xdg_toplevel_set_size 1000x1000
- compare_xdg_toplevel_state returns true since there is no pending
  configure and the currently committed size is still 1000x1000
- no new configure is sent
- client commits at the size it last acked, 500x500
2020-08-27 12:36:29 +02:00
Simon Ser 7e521fed97 xdg-shell: fix inert xdg_surface handling
Closes: https://github.com/swaywm/sway/issues/4834
Closes: https://github.com/swaywm/wlroots/issues/1890
2019-12-30 14:24:35 -07:00
Simon Ser 5cde35923c Simplify globals implementation by removing destructors
Some globals are static and it doesn't make sense to destroy them before
the wl_display. For instance, wl_compositor should be created before the
display is started and shouldn't be destroyed.

For these globals, we can simplify the code by removing the destructor
and stop keeping track of wl_resources (these will be destroyed with the
wl_display by libwayland).
2019-11-25 09:01:46 -05:00
Brian Ashworth 9914784594 wlr_xdg_toplevel: reparent on parent unmap
From the xdg-shell specification:
	If the parent is unmapped then its children are managed as
	though the parent of the now-unmapped parent has become the
	parent of this surface. If no parent exists for the now-unmapped
	parent then the children are managed as though they have no
	parent surface.
2019-08-15 11:19:06 +03:00
Sebastian Krzyszkowiak 78d96009e4 wlr_xdg_popup: grab touch events alongside pointer and keyboard
Fixes #933
2019-08-12 09:31:49 +09:00
Simon Ser ca45f4490c Remove all wayland-server.h includes
The documentation for wayland-server.h says:

> Use of this header file is discouraged. Prefer including
> wayland-server-core.h instead, which does not include the server protocol
> header and as such only defines the library PI, excluding the deprecated API
> below.

Replacing wayland-server.h with wayland-server-core.h allows us to drop the
WL_HIDE_DEPRECATED declaration.
2019-07-27 15:49:32 -04:00
Brian Ashworth 4e614683b7 wlr_xdg_toplevel: store pending fullscreen output
Since the fullscreen request may be made before the toplevel's surface
is mapped, the requested fullscreen output needs to be stored so it
can be retrieved on map (along with the existing fullscreen property).

This commit makes the required changes for wlr_xdg_toplevel.
2019-03-27 10:04:10 +02:00
Guido Günther cf9607f282 wlr_xdg_shell: Remove redundant declaration in the same file 2019-02-28 21:24:22 +01:00
Connor E e7fff4f560 Remove wlr_xdg_surface_send_close. 2019-01-13 14:22:49 +00:00
Alexander Bakker 20db29779e Add destroy signals to types that are destroyed by wl_display_destroy 2018-08-26 23:23:12 +02:00
Ilia Bozhinov 88e9dbe32e remove dangling declaration of wlr_xdg_surface_popup_get_position() 2018-08-09 07:55:20 +03:00
Drew DeVault 5642c5cc8f
Merge pull request #1053 from emersion/xdg-decoration
Add xdg-decoration-unstable-v1 support
2018-08-02 09:33:10 -04:00
Drew DeVault 211ae764fd Initial pass on API stability guarantees
This introduces -DWLR_USE_UNSTABLE and adds information regarding the
stability status to all headers. I started with a conservative set of
headers to mark as stable:

- types/wlr_matrix.h
- util/edges.h
- util/log.h
- util/region.h
- xcursor.h
2018-07-29 19:20:34 -04:00
emersion 555721f714 Add xdg-decoration-unstable-v1 support 2018-07-28 22:48:07 +01:00
Ilia Bozhinov 8b7c85d765 xdg-shell(-v6): add set_title and set_app_id toplevel signals
This is useful for example when rendering decorations
2018-07-22 22:42:37 +03:00
Drew DeVault c0b4217fce
Merge pull request #1116 from emersion/surface-role
surface: replace wlr_surface_set_role_committed with wlr_surface_role
2018-07-11 15:27:42 -07:00
emersion deeca53e33
Rename wl_resources to resource, wl_global to global 2018-07-08 19:21:31 +01:00
emersion 33db4263a0
surface: replace wlr_surface_set_role_committed with wlr_surface_role 2018-07-07 22:45:16 +01:00
Ryan Dwyer 86f401e827 Introduce wlr_xdg_surface_for_each_popup
It is common to want to iterate an xdg-surface's popups separately from
the toplevel and subsurfaces. For example, popups are typically rendered
on top of most other surfaces.

wlr_xdg_surface_for_each_surface continues to iterate both surfaces and
popups to maintain backwards compatibility.
2018-07-01 23:24:39 +10:00
Ilia Bozhinov a989104a6b xdg-shells: add a set_parent signal to toplevel surfaces 2018-06-06 17:08:06 +03:00
Markus Ongyerth 3994762ae0 Add wlr_surface_get_geometry
This function defaults and clips the xdg-surface geometry to the
bounding box of the surface + its subsurfaces, as specified by the
protocol spec.
2018-06-01 15:21:18 +02:00
Tony Crisci 044fa52be4 reword new_surface docs 2018-05-28 13:12:53 -04:00
Tony Crisci c27cd5f065 document the map/unmap xdg-shell events 2018-05-28 11:16:33 -04:00
emersion 47f097e09b
xdg-shell: add wlr_xdg_toplevel_set_tiled 2018-05-27 13:38:06 +01:00
morganamilo 6305e6327f
Fix typos in comments and strings 2018-05-03 21:59:43 +01:00
Drew DeVault 0a0627f5d0 Finish forward-porting @acrisci's positioner work 2018-04-23 11:24:06 +02:00
Drew DeVault 2e3d901ac5 Forward-port xdg-shell-v6 positioner improvements 2018-04-23 11:24:06 +02:00
Drew DeVault d3cdb00208 Add (shitty) support for popups to layer example 2018-04-23 11:24:06 +02:00
Drew DeVault 6b7b64ec1e Generalize xdg-shell popups and add to layer-shell 2018-04-23 11:22:23 +02:00
emersion 8dec7036d0
Always unmap before destroying surface 2018-04-11 23:09:13 -04:00
emersion 4a9a9eae9a
Add surface iterators 2018-04-05 14:18:17 -04:00
emersion 3ea425d4e2
Fix xdg-shell popups, add wlr_xdg_surface_surface_at 2018-04-04 17:45:24 -04:00
Drew DeVault 333ab59902 Add wlr_surface_is_*_surface
And wlr_*_surface_from_wlr_surface
2018-04-02 20:42:02 -04:00
Drew DeVault 88eec637a4 Address feedback 2018-03-27 18:50:09 -04:00
Drew DeVault 3ba57fccd1 Wire up layer surface resources to stubs 2018-03-27 18:50:09 -04:00
Drew DeVault 1ed90541f9
Merge pull request #753 from emersion/xdg-shell-unmap-destroy
xdg-shell-v6: don't destroy role resources on unmap
2018-03-27 13:15:32 -04:00
emersion 171e28eaff
xdg-shell: don't destroy role resources on unmap, move toplevel fields
Ports 5233801530 and
334bab543d to xdg-shell stable.
2018-03-27 10:25:02 -04:00