Simon Ser
72787db98a
compositor: drop wlr_surface_destroy_role_object()
...
This function is now unnecessary.
2023-08-21 18:56:09 +02:00
Simon Ser
c74f89d4f8
Avoid using memcpy() to copy structs
...
We can just use a regular assignment instead. This is more
type-safe since there is no need to provide the struct size.
The remaining memcpy() calls perform array copies or copies from
void pointers (which may be unaligned).
2023-08-03 14:40:28 +00:00
Simon Ser
7a9f8d8d6b
Use struct initializers instead of memset()
...
This is a bit more type-safe.
2023-07-07 17:31:11 +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
fc9b58e84d
compositor: don't call role unmap hook without an object
2023-06-23 11:54:05 +00:00
Kirill Primak
0f67580aab
compositor: introduce wlr_surface_set_role_object()
2023-06-23 11:54:05 +00:00
Kirill Primak
0040c78c0b
compositor: fix wlr_surface_set_role() error messages
2023-06-23 11:54:05 +00:00
Kirill Primak
753f3cc4fa
compositor: add wlr_surface_role.no_object
...
This commit allows to make a role as not represented by an object,
which fixes calling role commit handlers for roles like cursor
surfaces.
Fixes: 099b9de752
2023-06-14 14:06:28 +00:00
Kirill Primak
37b5f8a89e
compositor: unmap subsurfaces too on unmap
...
Similar to 49e9be62ae
.
2023-06-05 19:14:35 +00:00
Kirill Primak
b61d5922f1
compositor: notify subsurfaces about a commit in the rendering order
...
This is the default order used across wlroots unless the reversed order
specifically is required (e.g. in wlr_surface_surface_at()).
2023-06-03 14:36:41 +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
d086ee1b9e
compositor: remove wlr_surface_role.precommit
...
It was previously used to handle unmapping properly but is obsolete now.
2023-06-02 21:04:16 +03:00
Kirill Primak
c590bb600f
subcompositor: use unified map logic
2023-06-02 17:26:18 +00:00
Kirill Primak
6b40e08148
compositor: introduce unified map logic
2023-06-02 17:26:18 +00:00
Alexander Orzechowski
ec796afb6e
wlr_compositor: Decide opacity from new has_buffer flag.
...
`wlr_surface_get_texture` will always return NULL if the compositor was
not given a renderer.
2023-05-04 11:53:26 +02:00
Alexander Orzechowski
394accbe4a
wlr_compositer: Keep track if surface has committed a buffer before.
...
This would break if you are running with a NULL renderer.
2023-05-04 11:53:26 +02:00
Simon Ser
dae2deb3c9
compositor: add wlr_surface_set_preferred_buffer_transform()
...
References: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/220
2023-04-14 17:07:26 +02:00
Simon Ser
42edd36785
compositor: add wlr_surface_set_preferred_buffer_scale()
...
References: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/220
2023-04-14 17:07:26 +02:00
Simon Ser
0bb574239d
compositor: pass version in wlr_compositor_create
...
This allows wlroots to support newer versions of the interface
without breaking the API.
2023-04-14 17:07:26 +02:00
Kirill Primak
87e7584dd4
compositor: use defunct_role_object error
2023-04-14 17:04:00 +02: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
Simon Ser
512deebd82
compositor: add wlr_surface.events.precommit
2022-12-05 10:51:46 +01:00
Simon Ser
42016fa262
compositor: make renderer optional
...
This is a first step towards moving texture uploading out of
wlr_compositor.
This commit allows compositors to opt-out of the texture uploading
by passing a NULL wlr_renderer. An immediate user of this is
gamescope, which currently implements a stub wlr_renderer just to
make wlr_compositor happy.
2022-11-24 21:55:24 +00:00
Simon Ser
1978a91717
compositor: release current buffer after commit event
...
Some compositors may want to access the original buffer in their
commit handler.
2022-11-24 21:55:24 +00:00
Simon Ser
258bf9be1e
compositor: drop wlr_surface.{sx,sy}
...
The concept of a persistent accumulated surface offset is wrong
from a protocol point-of-view. wl_surface.offset is tied to a
commit, its interpretation depends on the surface role.
For example, with the following sequence:
wl_surface@1.offset(1, 1)
wl_surface@1.commit()
wl_pointer@2.set_cursor(wl_surface@1, 42, 42)
The final cursor hotspot is (42, 42): the commit which happened
before the set_cursor request has no impact on the hotspot
computation.
The wlr_output_cursor logic already uses wlr_surface.current.{dx,dy}.
wlr_scene's drag icon doesn't, update it accordingly.
2022-11-15 13:41:09 +00:00
Simon Ser
c5d79bfb26
region: constify
2022-11-11 23:11:17 +00:00
Kirill Primak
388de59df3
compositor: use the correct input region
2022-11-07 21:06:12 +00:00
Kirill Primak
c09d3450d4
compositor: enforce surface destruction order
2022-11-06 17:00:00 +03: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
756260ac05
compositor: introduce wlr_surface_destroy_role_object()
2022-11-06 14:16:05 +03:00
Kirill Primak
3abedaf211
subcompositor: move+rename subsurface_parent_commit()
2022-09-12 18:44:36 +00:00
Alexander Orzechowski
138d21464d
wlr_compositor: Don't leak region32 when calculating opaque region
2022-08-30 03:03:21 -04:00
Alexander Orzechowski
525506559a
wlr_compositor: Use wlr_fbox_equal
2022-08-25 19:00:13 -04:00
Alexander Orzechowski
ef4baea0e2
Use wl_signal_emit_mutable
2022-08-18 07:16:16 -04:00
Simon Ser
c2359d0321
surface: implement wl_surface.offset
...
References: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/123
2022-08-12 11:27:33 +02:00
Simon Ser
42d68d7532
surface: add WLR_SURFACE_STATE_OFFSET
...
This indicates whether the surface offset has changed.
2022-08-12 11:20:44 +02:00
Simon Ser
29291cb47c
render/texture: drop wlr_texture_is_opaque
...
Whether a texture is opaque or not doesn't depend on the renderer
at all, it just depends on the source buffer. Instead of forcing
all renderers to implement wlr_texture_impl.is_opaque, let's move
this in common code and use the wlr_buffer format to know whether
a texture will be opaque.
2022-06-16 14:43:24 +02:00
Simon Ser
18595000f3
compositor: send WL_SURFACE_ERROR_INVALID_SIZE for non-cursor surfaces
...
See the discussion at [1]: there's no easy way to fix libwayland-cursor
without a new API. Sending the error for other roles will prevent the
same client bug from appearing elsewhere.
[1]: https://gitlab.freedesktop.org/wayland/wayland/-/issues/194
2022-06-01 12:56:42 +00:00
Simon Ser
6c350799b2
Zero-initialize structs in init functions
...
Ensures there is no field left to its previous undefined value after
calling an init function.
2022-04-28 10:09:50 +02:00
Kirill Primak
da2491d416
compositor: damage the whole buffer on viewport src change
...
wp_viewporter protocol doesn't seem to say anything about damage, but
Firefox assumes that wp_viewport::set_source alone is enough to damage
the whole surface, and that assumption kinda makes sense, so let's do
that.
2022-01-22 12:09:48 +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
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
Simon Ser
7cbcc65ad0
surface: make wlr_subsurface_create private
...
Same as [1], but for wlr_subsurface.
[1]: https://github.com/swaywm/wlroots/pull/2814
2021-06-29 10:32:17 -04:00
Simon Ser
a9e5df44d8
surface: remove resource_list arg from surface_create
...
This is never used.
2021-04-06 14:57:44 +02:00
Simon Ser
c430cd7d53
surface: make wlr_surface_create private
...
This is not meant to be exposed in the public API, just like
wlr_region_create [1].
[1]: https://github.com/swaywm/wlroots/pull/2662
2021-04-06 14:57:44 +02:00
Simon Ser
a39dc1f7a8
region: remove resource_list arg from region_create
...
This is never used.
2021-02-02 23:42:53 +01:00