Commit Graph

64 Commits

Author SHA1 Message Date
Simon Ser 0e5034d8ba compositor: add wlr_compositor_set_renderer()
Allows compositors to switch the wlr_renderer at runtime.

Useful for handling GPU resets.
2024-03-14 14:34:44 +01:00
Simon Ser 3075e6a6f9 compositor: use compositor to get renderer
This allows us to remove the renderer destroy listener. The
listener was buggy: compositors can't destroy surface resources on
their own.

The wlr_compositor will always outlive the wlr_surface, so no need
for a destroy listener.
2024-03-14 12:29:01 +00:00
Simon Ser 508d8c9a01 compositor: handle renderer destroy
Don't leave a stale renderer pointer behind.
2024-03-14 12:29:01 +00:00
Kirill Primak 7dfbd87771 compositor: drop wlr_surface.external_damage 2024-02-01 14:51:43 +00:00
Kirill Primak 4688a371e0 compositor: don't get buffer from pending buffer resource too early
Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3795
2024-01-27 17:48:07 +03:00
Kirill Primak 0052078bd3 compositor: introduce wlr_surface_reject_pending() 2024-01-27 12:05:05 +00:00
Simon Ser 7e1ae5548c compositor: add wlr_surface_role.client_commit 2023-12-25 11:47:15 +01:00
Simon Ser d847516765 compositor: add wlr_surface_synced
A lot of protocols extend the wl_surface state. Such protocols need
to synchronize their extended state with wl_surface.commit and
cached states. Add a new utility for this purpose.
2023-12-25 11:47:15 +01:00
Simon Ser 34d5af4172 compositor: add wlr_surface_state_has_buffer() 2023-12-25 11:47:15 +01:00
Simon Ser 43734f7c62 compositor: fix wlr_surface_has_buffer() doc comment
The function does not check whether the upload succeeded: it does
not check the wlr_client_buffer.
2023-12-25 11:47:14 +01:00
Simon Ser 66b6c349e7 compositor: remove unnecessary wlr_surface.has_buffer
No need to store this bit, we can infer it from buffer_width and
buffer_height.
2023-12-25 11:43:41 +01:00
Simon Ser 6a2ff0dffe compositor: drop surface precommit event
This is unused.
2023-12-04 19:32:44 +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 7661ab2bf1 compositor: deprecate wlr/types/wlr_region.h
The only function in that header is now also declared in
wlr/types/wlr_compositor.h.
2023-11-24 15:09:31 +03:00
Kirill Primak 4d2e310122 compositor: add wlr_surface.unmap_commit
This flag can be used to figure out whether a particular commit has
unmapped the surface. Private state for now in case we find a better
way to track this.
2023-10-26 14:57:10 +00:00
Kirill Primak a09d649439 docs: replace the less commonly used "::" with "." 2023-10-02 22:10:16 +03:00
Simon Ser 72787db98a compositor: drop wlr_surface_destroy_role_object()
This function is now unnecessary.
2023-08-21 18:56:09 +02:00
Kirill Primak 42a5b6f62a compositor: add "mapped" flag doc 2023-07-26 20:39:03 +00: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 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 1bf245e0fe compositor: improve role-specific documentation 2023-06-08 20:03:18 +02:00
Kirill Primak 4c9eb6839d compositor: add a note about ignored input regions 2023-06-06 13:27:11 +03: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 6b40e08148 compositor: introduce unified map logic 2023-06-02 17:26:18 +00: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
Simon Ser 512deebd82 compositor: add wlr_surface.events.precommit 2022-12-05 10:51:46 +01:00
Simon Ser c4727240af compositor: document wlr_surface_{enter,leave,send_frame_done} 2022-12-03 16:52:32 +00: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 359df5ef84 compsitor: document wlr_compositor_create() 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
Kirill Primak 756260ac05 compositor: introduce wlr_surface_destroy_role_object() 2022-11-06 14:16:05 +03:00
Simon Ser f8ae564906 compositor: fix wlr_surface_set_role return value docs
It returns a bool, not an int.
2022-09-05 15:34:19 +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 28d89779af Reformat doc comments
Unify the way we document our APIs. See CONTRIBUTING.md for the
rules.
2022-05-25 14:22:58 +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 e94e16ba5d surface: move decl to wlr_{sub,}compositor.h 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 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
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
emersion a5b8ea90d2
surface: fix destroyed subsurfaces handling
wlr_subsurface_from_wlr_surface can return NULL if the wl_surface is still
alive and if the wl_subsurface has been destroyed. Make sure we check for NULL.

Fixes https://github.com/swaywm/sway/issues/3195
2018-11-26 23:17:52 +01: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 deeca53e33
Rename wl_resources to resource, wl_global to global 2018-07-08 19:21:31 +01:00
Dominique Martinet c263f7ca29 s/wlr_subsurface_from_surface/wlr_subsurface_from_wlr_surface/
This was the only x_from_wlr_surface function that lacked the wlr_ prefix,
let's have an API as uniform as possible.
2018-06-30 21:21:13 +09:00