Commit Graph

98 Commits

Author SHA1 Message Date
tiosgz ce66244fd2 surface_at: check if surfaces are mapped 2021-10-02 11:38:40 +02:00
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 597ba2b932 surface: add addon set 2021-09-21 16:48:31 +02:00
Simon Ser ba0525c5c0 surface: drop wlr_surface_state.buffer_resource
Instead, use wlr_surface_state.buffer only.
2021-09-06 14:21:23 -04:00
Kirill Primak 90e62390d9 surface: move subsurface lists to state 2021-09-06 17:37:08 +02:00
Simon Ser 3ac99fa4dc subsurface: move parent link to state
Move the wlr_subsurface parent link to the subsurface state.

This is a dumb find/replace operation. This shouldn't result in
any behavior change.
2021-09-06 17:37:08 +02:00
Simon Ser 56b6b80b9a subsurface: rename wlr_subsurface_state to wlr_subsurface_parent_state
Add a comment to explain the difference.
2021-09-06 17:37:08 +02:00
Simon Ser 3f9e4f7a44 surface: kill wlr_surface.previous
This wlr_surface_state field was a special case because we don't
want to save the whole current state: for instance, the wlr_buffer
must not be saved or else wouldn't get released soon enough.

Let's just inline the state fields we need instead.
2021-08-11 18:13:12 +02:00
Simon Zeni d086501fba types/wlr_surface: get buffer size from wlr_buffer_import 2021-07-09 23:16:39 +02:00
Simon Zeni e192d87731 move wlr_box from /types to /util 2021-07-06 21:43:17 +02: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 9e58301df7 surface: allow placing subsurfaces below parent
Prior to this commit, subsurfaces could only be placed above their
parent. Any place_{above,below} request involving the parent would
fail with a protocol error.

However the Wayland protocol allows using the parent surface in the
place_{above,below} requests, and allows subsurfaces to be placed
below their parent.

Weston's implementation adds a dummy wl_list node in the subsurface
list. However this is potentially dangerous: iterating the list
requires making sure the dummy wl_list node is checked for, otherwise
memory corruption will happen.

Instead, split the list in two: one for subsurfaces above the parent,
the other for subsurfaces below.

Tested with wleird's subsurfaces demo client.

Closes: https://github.com/swaywm/wlroots/issues/1865
2021-06-03 14:04:07 +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 8ecc557ab0 subsurface: use cached surface state 2021-03-25 19:34:47 +01:00
Simon Ser e0258f4506 surface: introduce cached states
Cached states allow a surface commit to be delayed. They are useful for:

- Subsurfaces
- The upcoming transactions protocol [1]
- Explicit synchronization

[1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/26
2021-03-25 19:34:47 +01:00
Simon Ser 7ac76aba8a surface: introduce commit sequence numbers
Very similar to output commit sequence numbers. Can be useful to
reference a specific commit.
2021-03-25 19:34:47 +01:00
Isaac Freund 83fdfa511d docs: wlr_surface_from_resource cannot return NULL
Surfaces never become inert.
2021-01-05 12:22:47 +01:00
Isaac Freund f6fc4c2883 subsurface: handle NULL parent in get_root_surface 2020-12-22 15:55:05 +01:00
Kenny Levinsen ebecc5404b surface: Make send_enter store entered outputs
wlr_surface_send_enter now stores outputs that have been entered.
Combined with a new 'bind' event on wlr_output, this allows us to delay
enter events as necessary until the respective wl_output global has been
bound.

Closes: https://github.com/swaywm/wlroots/issues/2466
2020-11-23 10:58:50 +01:00
Simon Ser c618a76540 surface: introduce wlr_surface_get_buffer_source_box
This helper allows compositors to retrieve the buffer source box in
buffer-local coordinates.
2020-06-17 09:10:54 -06:00
Simon Ser eb22ae97b0 surface: add wlr_surface_state.viewport
This field contains the viewport source and destination parameters. It's
intended to be updated by a third-party protocol, for instance
viewporter.
2020-06-17 09:10:54 -06:00
Simon Ser 8afc1ed68c Introduce wlr_client_buffer
Split out the client/resource handling out of wlr_buffer by introducing
wlr_client_buffer. Make wlr_buffer an interface so that compositors can
create their own wlr_buffers (e.g. backed by GBM, like glider [1]).

[1]: c66847dd1c/include/gbm_allocator.h (L7)
2020-03-06 21:32:06 +01: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 943e918a96
subsurface: add map/unmap events
Fixes https://github.com/swaywm/wlroots/issues/1414
2019-02-17 12:01:15 +01:00
Drew DeVault d7b010024a
Merge pull request #1261 from arandomhuman/damage-control
Fix damage tracking for surfaces with transforms
2018-11-04 14:31:17 +01:00
emersion dec303bea6
surface: fix wlr_surface_get_effective_damage to give surface coords
Transforms were applied, but scale wasn't.
2018-11-04 11:13:10 +01:00
random human 3e0a0f3c3a
wlr_surface: add wlr_surface_get_effective_damage
This calculates and returns the effective damage of the surface in
surface coordinates, including the client damage (in buffer
coordinates), and damage induced by resize or move events.
2018-10-04 02:19:09 +05:30
Las 6367e0bc93 Add wlr_surface::input_region member
This is analogous to the opaque_region member.

In addition the code for setting the opaque region is cleaned up.
2018-09-18 10:14:33 +02: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 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 5bb272d7f3 surface: add wlr_surface.opaque_region 2018-07-13 10:54:51 +01:00
emersion 33db4263a0
surface: replace wlr_surface_set_role_committed with wlr_surface_role 2018-07-07 22:45:16 +01:00
emersion 226306ed45
surface: rename wlr_surface_state.buffer to buffer_resource 2018-07-04 19:12:18 +01:00
emersion 012e38fbe5
surface: add wlr_surface.previous 2018-07-04 19:12:18 +01:00
emersion 78555abba3
surface: move position and scale out of wlr_surface_state 2018-07-04 19:12:17 +01:00
emersion 233bfe2f4f
surface: do not monkey-patch state damage 2018-07-04 19:12:17 +01:00
emersion adf0423f7c
surface: better buffer position handling 2018-07-04 19:12:17 +01:00
emersion e6399c61b7
surface: fix WLR_SURFACE_STATE_BUFFER_DAMAGE value 2018-07-04 19:12:17 +01:00
emersion 3c0d672ebd
surface: make pending and current embedded structs 2018-07-04 19:12:17 +01:00
emersion 64836ddfe7
surface: remove wlr_surface_state.subsurface_position 2018-07-04 19:12:17 +01:00
emersion 3ee86b6105
surface: rename invalid state 2018-07-04 19:12:16 +01:00
emersion 0e3b35c87e
Merge pull request #1072 from emersion/surface-remove-matrices
surface: remove matrices
2018-06-20 21:29:17 +01:00
emersion 831b7297a4
surface: remove matrices
These were unused.
2018-06-20 21:01:35 +01:00
emersion a6c0e25d36
surface: remove wlr_frame_callback
This removes the need to allocate a structure for frame callbacks.
wl_resource_get_link is used instead.
2018-06-20 20:00:23 +01:00
emersion 0378d143d9
surface: remove wlr_surface.texture
The texture is managed by the surface's wlr_buffer now. In
particular, the buffer can destroy the texture early if it becomes
invalid.
2018-06-13 19:38:10 +01:00
emersion e4933ab445
Introduce wlr_buffer 2018-06-08 20:06:13 +01:00
Timidger 2eb8b240e1
Added data field to wlr_subsurface 2018-06-02 15:57:44 -07: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
morganamilo 6305e6327f
Fix typos in comments and strings 2018-05-03 21:59:43 +01:00
emersion 43012f3740
compositor: redesign how resources are managed
All public resource creators now take a new ID for the resource
and an optional list where the resource link is added. When the
resource is destroyed it is its own responsibility to remove
itself from the list. This removes the need for the caller to add
a destroy listener.

This commit fixes a few segfaults with resources not removed from
the list when destroyed.
2018-04-26 17:51:06 +01:00