Commit Graph

36 Commits

Author SHA1 Message Date
Kirill Primak 7dfbd87771 compositor: drop wlr_surface.external_damage 2024-02-01 14:51:43 +00:00
Simon Ser 96aec06b0a subcompositor: use wlr_surface_synced 2023-12-25 11:47:15 +01:00
Kirill Primak 87346b3393 Revert "subcompositor: emit new_subsurface immediately"
new_subsurface emitted immediately isn't actually that useful. Revert the change
and document that this event is special.

This reverts commit 504b9491f0.
2023-11-25 11:47:11 +00:00
Kirill Primak 504b9491f0 subcompositor: emit new_subsurface immediately
See https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3608.
2023-11-23 13:18:06 +00:00
Kirill Primak 43fd3a007e subcompositor: don't map unadded subsurfaces 2023-11-23 13:18:06 +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 7df11ada5e Unmap wlr_surface before making its role object inert 2023-07-26 20:39:03 +00:00
Kirill Primak 7d176b6237 subcompositor: don't remove inert role resource
Now that role objects are stored as resources, we can distinguish
the inert object case from it being destroyed by the client:

- When the resource is destroyed by the client, role_resource == NULL
- When the resource is made inert, role_resource != NULL but its
  user_data is NULL
2023-07-10 10:03:08 +02:00
Simon Ser 8a5b5e6f28 compositor: listen to role_resource destroy signal
Call wlr_surface_destroy_role_object() when the role_resource is
destroyed.
2023-06-23 14:33:26 +02: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
Kirill Primak 63f3802e0f subcompositor: set role_data with wlr_surface_set_role() 2023-06-08 20:03:18 +02:00
Kirill Primak 25a62a3775 subcompositor: simplify subsurface_consider_map(), call on add
Fixes: 49e9be62ae
2023-06-06 20:38:19 +00:00
Kirill Primak 37b5f8a89e compositor: unmap subsurfaces too on unmap
Similar to 49e9be62ae.
2023-06-05 19:14:35 +00:00
Kirill Primak 49e9be62ae subcompositor: consider mapping on parent map
Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3654
2023-06-03 14:36:41 +00:00
Kirill Primak c590bb600f subcompositor: use unified map logic 2023-06-02 17:26:18 +00:00
Kirill Primak fac7a5cc9d subcompositor: use bad_parent error 2023-04-14 17:00:17 +02:00
Kirill Primak 49435cb27b subcompositor: simplify get_subsurface handler 2023-04-14 16:59:55 +02:00
Kirill Primak 911648f430 subcompositor: fix mapped parent check 2023-02-02 17:26:25 +03:00
Simon Ser eb3e8f08a8 subcompositor: convert to try_from
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/884
2023-02-01 20:14:39 +01:00
Alexander Orzechowski 5f264a7d6c subcompositor: Clean up subsurface_consider_map
check_parent was unecessary: it only served to skip a trivial check
and added more complexity than it was worth.
2023-01-04 04:24:17 -05:00
Alexander Orzechowski 84aee1d708 subcompositor: Clarify comment on subsurface mapped consideration 2023-01-04 04:24:17 -05: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 2518ace573 subcompositor: use role object destroy handler 2022-11-06 17:00:00 +03:00
Kirill Primak 42ae1e75aa subcompositor: consider mapping after adding
ec8b49c93f calls subsurface_consider_map()
too early. Instead, call it after emitting new_subsurface signal to let
compositors receive a map event.
2022-09-12 18:44:36 +00:00
Kirill Primak 3abedaf211 subcompositor: move+rename subsurface_parent_commit() 2022-09-12 18:44:36 +00:00
Alexander Orzechowski ef4baea0e2 Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04: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
Kirill Primak ec8b49c93f subcompositor: consider map on creation
wl_subsurface description states:

A sub-surface becomes mapped, when a non-NULL wl_buffer is applied and
the parent surface is mapped.

Note that this doesn't require an explicit commit, which means that a
newly created subsurface with a mapped parent and a buffer already
attached must be mapped immediately. This can happen with the following
sequence of events:

- subcompositor.get_subsurface(subsurface, surface, parent)
- surface.attach(buffer)
- surface.commit()
- subsurface.destroy()
- subcompositor.get_subsurface(subsurface, surface, parent)

Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3449
2022-06-21 14:00:48 +03:00
Kirill Primak 77951968dc subsurface: unlock cached state on commit if desynced
wl_subsurface::set_desync description states: "If cached state exists when
wl_surface.commit is called in desynchronized mode, the pending state is
added to the cached state, and applied as a whole."

This commit reintroduces an implementation of said behavior, previously
removed in 7daf6da9ac05be2cb74c0983e3caee0b21db75d4.

Strictly speaking, this logic isn't fully correct, as the cached state
and the pending state are applied individually instead, if the cached
state isn't locked by anything else. However, the end result is still
the same.

This commit fixes the issue with Firefox permission popups.
2022-01-25 22:41:30 +03:00
Simon Ser 1d1b845410 subcompositor: destroy subsurface with parent
When the parent surface is destroyed, also destroy the child
wl_subsurface. No need to handle the wlr_subsurface.parent == NULL
case anymore.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/1709
2022-01-20 15:18:10 +00:00
Simon Ser 7ce966a5d4 subcompositor: document subsurface_from_resource 2022-01-20 15:18:10 +00: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 617eb4fb93 surface: deprecate wlr_surface.h 2022-01-13 10:06:41 +00:00
Kirill Primak 36b5d5888c surface: move impl to types/wlr_{sub,}compositor.c 2022-01-13 10:06:41 +00:00
Kirill Primak b6f43ab2e1 subcompositor: split out from compositor 2022-01-13 10:06:41 +00:00