Commit graph

2047 commits

Author SHA1 Message Date
Kirill Primak
694b8c6683 scene: add missing output damage listener
This is necessary to handle damage coming from the backend and software
cursors.
2022-06-29 21:19:38 +03:00
Kirill Primak
97f0347780 scene: switch to wlr_damage_ring 2022-06-29 18:54:27 +03:00
Kirill Primak
e0accb2d50 types: add wlr_damage_ring
wlr_damage_ring is effectively wlr_output_damage untied from wlr_output.
2022-06-29 18:54:21 +03:00
Simon Ser
10a821a87d output: fix missing buffer when using direct scanout
When using direct scanout back_buffer is NULL. We'd emit a commit
event with WLR_OUTPUT_STATE_BUFFER set but with a NULL buffer field,
which is non-sensical.
2022-06-29 17:42:57 +02:00
Kenny Levinsen
03dc7e2df5 wlr_{keyboard,pointer,touch}: Update event docs
Events used by our input devices were recently renamed from wlr_event_* to
wlr_*_event, but the documentation and a single point of use was not updated
accordingly.

Regressed by: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3484
2022-06-28 09:50:30 +00:00
Isaac Freund
91943a68a6 wlr_input_device: remove anon union field
This union is unnecessary since the recent input device refactor and can
now be replaced by wlr_*_from_input_device() functions.
2022-06-21 18:42:07 +00:00
Kirill Primak
5c4384a133 xdg-popup: use configure fields 2022-06-21 15:14:37 +00:00
Kirill Primak
8d2fa15e9d xdg-toplevel: post no memory on strdup() fail 2022-06-21 17:37:45 +03: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
Rouven Czerwinski
2a1d7d40f4 cursor: re-enable NULL buffer for cursor
The previous wlr_output_cursor_set_image() allows setting a NULL buffer for the
cursor to hide it. This functionality was used by sway to hide the cursor,
restore the original semantics by allowing NULL buffers again by avoiding the
wlr_buffer allocation in case we have NULL pixels and handing a NULL wlr_buffer
to wlr_output_cursor_set_buffer().
2022-06-20 10:20:55 +02:00
Simon Ser
d89285f783 output-management-v1: add wlr_output_head_v1_state_apply()
This function applies a configuration sent by a client on a
struct wlr_output_state.
2022-06-17 21:05:51 +00: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
Kirill Primak
e7b217efb9 xdg-shell: improve shell version check 2022-06-11 20:22:54 +03:00
Johan Malm
d57d2e0e36 scene/layer_shell_v1.c: fix bug in width/height calculations
...in wlr_scene_layer_surface_v1_configure()

Reproduce bug with waybar by setting `"margin": 5,`
in ~/.config/waybar/config. It will result in the right edge of the panel
extending outside the edge of the output.

The bug can also be reproduced with gtk-layer-demo by anchoring
left/right/top/bottom and setting respective margins

Relates-to: https://github.com/labwc/labwc/issues/382
2022-06-08 20:13:55 +00:00
Simon Ser
96b594110d matrix: remove wlr_matrix_projection()
69477051cc ("matrix: deprecate wlr_matrix_projection") marked it
as deprecated. 1 year later, we can now remove it from our public
API.
2022-06-08 19:27:36 +00:00
Simon Ser
c2e4ba1dd0 output: use state setters in wlr_output_set_* 2022-06-08 18:29:58 +02:00
Simon Ser
43a9b0fbb9 output: compare state before commit
Before calling wlr_output_impl.{test,commit}, perform a cheap
comparison between the current and candidate state. Unset any
fields which didn't change.
2022-06-08 18:29:58 +02:00
Simon Ser
6688a3d9ea output: add output state setters
This ensures compositors don't forget to set the committed flag
or the mode_type when setting a field.
2022-06-08 18:22:32 +02:00
Consolatis
0173275f7e scene/output_layout: Fix crash in scene_output_layout_output_destroy
Closes: #3448
2022-06-07 20:58:41 +02:00
Simon Ser
09498499f6 output: fix make/model/serial memory leak
These have been turned into `char *` in be86145322 ("output: turn
make/model/serial into char *"), but forgot to add the cleanup
logic.
2022-06-07 18:16:48 +02:00
Isaac Freund
0deef6fe44 output: fix leak of empty back buffer lock
This refactors output_ensure_buffer() to not mutate the state passed,
making the previous subtle behavior much more explicit.

Fixes: d483dd2f ("output: add wlr_output_commit_state")
Closes: #3442
2022-06-07 15:30:08 +00:00
Simon Ser
99f63b03e7 Remove remaining wl_signal_emit calls
Replace them with wlr_signal_emit_safe, which correctly handles
cases where a listener removes another listener.

Reported-by: Isaac Freund <ifreund@ifreund.xyz>
2022-06-05 10:36:11 +00:00
Alexander Orzechowski
808e660291 wlr_output_commit_state: Make sure to clear the back buffer
Fixes: #3445
2022-06-05 07:41:11 +00:00
Alexander Orzechowski
cc5a02e75d wlr_scene_buffer: Update primary_output on output destroy 2022-06-02 10:33:04 -04:00
Alexander Orzechowski
4772eec93d wlr_scene_buffer: Call output enter/leave after primary_output calculation 2022-06-02 10:33:04 -04:00
Simon Ser
e383c1f1db xdg-shell: add support for v4
This adds a configure_bounds event to let the client know of the
preferred maximum window geometry size.
2022-06-01 18:18:54 +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
Kirill Primak
1284f85da4 scene/output-layout: add initial outputs 2022-06-01 09:49:25 +00:00
Kirill Primak
0c2eed533e scene/output-layout: improve ownership logic
This commit ensures that outputs that weren't created by the output
layout helper aren't destroyed on the output layout change.

Consider the following piece of logic:

// struct wlr_output *o1, *o2;
// struct wlr_scene *scene;
// struct wlr_output_layout *layout;
wlr_scene_attach_output_layout(scene, layout);
wlr_output_layout_add_auto(layout, o1);
struct wlr_scene_output *so2 = wlr_scene_output_create(scene, o2);
wlr_output_layout_move(layout, o1, 100, 200);
// so2 is invalid now
2022-06-01 09:49:25 +00:00
Kirill Primak
d3bc17d5d1 scene: add wlr_scene_output.events.destroy 2022-06-01 09:49:25 +00:00
Simon Ser
638c5cda51 output: drop wlr_output_cursor.events.destroy
Compositors can just listen to wlr_output.events.destroy instead.
2022-05-31 11:40:47 +00:00
Simon Ser
1ab3e582ac output: re-implement set_image with set_buffer
Avoids having two code-paths doing the same thing.
2022-05-31 11:40:47 +00:00
Simon Ser
459a642e83 output: introduce wlr_output_cursor_set_buffer
This will supersede wlr_output_cursor_set_image, and then later
also supersede wlr_output_cursor_set_surface.
2022-05-31 11:40:47 +00:00
Simon Ser
e3e2a34cd8 output: remove noop backend check in wlr_output_cursor_set_image
The noop backend doesn't exist anymore.
2022-05-31 11:40:47 +00:00
Alexander Orzechowski
71f8a48d38 wlr_scene: Move children list from wlr_scene_node to wlr_scene_tree 2022-05-31 09:14:28 +00:00
Alexander Orzechowski
cb2dbc327e wlr_scene: Inline wlr_scene_node_state
This seems like nothing interesting was done with this. Let's simplify
and allow us some flexibility in the future.
2022-05-31 09:14:28 +00:00
Alexander Orzechowski
ccd0f85c2a wlr_scene: Only allow parenting on a wlr_scene_tree 2022-05-31 09:14:28 +00:00
Alexander Orzechowski
9eb71146ae wlr_scene: Refactor wlr_scene (the root element) to encase a wlr_scene_tree
Co-authored-by: Isaac Freund <mail@isaacfreund.com>
2022-05-31 09:14:28 +00:00
Simon Ser
43020963d4 relative-pointer-v1: don't allocate when inert
When the wl_pointer the zwp_relative_pointer_v1 is created with is
inert, don't allocate any struct, just leave the resource's data
pointer NULL.
2022-05-30 21:57:12 +00:00
Simon Ser
1feb8edd21 relative-pointer-v1: remove unnecessary log messages
Logging when a client creates or destroys an object is a bit too
chatty.
2022-05-30 21:57:12 +00:00
Simon Ser
17fbf60bd1 relative-pointer-v1: remove unnecessary comments
We don't do this in other implementations, so it feels out of place.
2022-05-30 21:57:12 +00:00
Consolatis
98c5f58a38 wlr_scene: Fix scaling with default source_box
Default to texture instead of destination_box geometry.
2022-05-30 16:17:31 +00:00
Rouven Czerwinski
988fe5bda9 relative_pointer: handle inert pointer objects
Since 5e0ef70cc0 ("seat: Create inert objects for missing capabilities")
wlroots can create inert seat objects when the capability is currently missing
for the client but it had the capablity before. The client hoever will happily
handover the wl_pointer resource to the relative_pointer implementation,
creating a NULL pointer dereference when trying to access the seat_client which
is set to NULL for inert objects.

Since the protocol does not contain an error for such requests, we hand out an
relative_pointer handle with the seat set to NULL.
We also need to check whether there is an associated seat in
send_relative_motion and need to tweak the destroy notifier in case no seat is
available.

This way we can hand out a valid relative_pointer resource and don't crash the
compositor when trying to access an inert seat pointer resource in
relative_pointer.

Relevant WAYLAND_DEBUG=1 when testing a client and switching VT every second:
[2619872.442] wl_seat@30.capabilities(3)
[2619872.460]  -> wl_seat@30.get_pointer(new id wl_pointer@36)
[2619872.484] wl_data_device@25.selection(nil)
[2619872.504] zwp_primary_selection_device_v1@26.selection(nil)
[2619874.995] wl_seat@12.capabilities(3)
[2619875.035]  -> wl_compositor@5.create_surface(new id wl_surface@37)
[2619875.088]  -> wl_seat@12.get_pointer(new id wl_pointer@29)
[2619875.105]  -> zwp_relative_pointer_manager_v1@8.get_relative_pointer(new id zwp_relative_pointer_v1@27, wl_pointer@29)
[2619875.127]  -> wl_compositor@5.create_surface(new id wl_surface@35)
[2619875.139]  -> wl_seat@12.get_pointer(new id wl_pointer@43)
[2619981.180] wl_seat@12.capabilities(2)
[2619981.214]  -> zwp_relative_pointer_v1@27.destroy()
[2619981.226]  -> wl_pointer@29.release()
[2619981.236]  -> wl_surface@37.destroy()
[2619981.247]  -> wl_pointer@43.release()
[2619981.254]  -> wl_surface@35.destroy()
[2619981.262] wl_seat@12.capabilities(0)
[2619981.285]  -> wl_keyboard@33.release()
[2619987.316] wl_seat@30.capabilities(2)
[2619987.336]  -> wl_pointer@36.release()
[2619987.363] wl_seat@30.capabilities(0)
[2619987.371]  -> wl_keyboard@34.release()
[2621932.880] wl_display@1.delete_id(41)
[2621932.903] wl_display@1.delete_id(40)
[2621932.910] wl_display@1.delete_id(27)
[2621932.917] wl_display@1.delete_id(29)
[2621932.924] wl_display@1.delete_id(37)
[2621932.930] wl_display@1.delete_id(43)
[2621932.944] wl_display@1.delete_id(35)
[2621932.950] wl_display@1.delete_id(33)
[2621932.959] wl_seat@12.capabilities(2)
[2621932.976]  -> wl_seat@12.get_keyboard(new id wl_keyboard@33)
[2621936.875] wl_seat@12.capabilities(3)
[2621936.893]  -> wl_compositor@5.create_surface(new id wl_surface@35)
[2621936.931]  -> wl_seat@12.get_pointer(new id wl_pointer@43)
[2621936.945]  -> zwp_relative_pointer_manager_v1@8.get_relative_pointer(new id zwp_relative_pointer_v1@37, wl_pointer@43)
[2621936.965]  -> wl_compositor@5.create_surface(new id wl_surface@29)
[2621936.987]  -> wl_seat@12.get_pointer(new id wl_pointer@27)
[2621942.796] wl_data_device@25.selection(nil)
[2621942.817] zwp_primary_selection_device_v1@26.selection(nil)
[2621942.823] wl_seat@30.capabilities(2)
2022-05-30 14:10:22 +00:00
Simon Ser
d483dd2f4c output: add wlr_output_commit_state
Same as wlr_output_commit, but takes a wlr_output_state.
2022-05-30 11:40:34 +02:00
Simon Ser
501ac5398d output: add output_state_{init,finish} 2022-05-30 11:40:34 +02:00
Simon Ser
b21c26a1c9 output: add wlr_output_event_precommit.state 2022-05-30 11:34:57 +02:00
Simon Ser
c4253fef9c output: add wlr_output_test_state
Same as wlr_output_test, but takes a wlr_output_state argument.
2022-05-30 11:34:57 +02:00
Simon Ser
9e25d3074d output: pass wlr_output_state to rendering functions
No functional change.
2022-05-30 11:34:57 +02:00
Simon Ser
927661d246 output: pass wlr_output_state to output_pending_resolution 2022-05-30 11:34:57 +02:00
Simon Ser
25dd3cc0cd output: pass wlr_output_state to backend
Groundwork for the following commits. The goal is to allow users
to specify their own wlr_output_state instead of wlr_output.pending.
2022-05-30 11:34:57 +02:00
Kirill Primak
c1ec71903c xdg-shell: bump version to 3 2022-05-27 13:31:30 +00:00
Kirill Primak
1761c3bbe2 xdg-popup: add reposition support 2022-05-27 13:31:30 +00:00
Kirill Primak
8a0835c59c xdg-positioner: add v3 parameters 2022-05-27 13:31:30 +00:00
Kirill Primak
6f1fce9cb4 xdg-popup: use current/pending state pattern 2022-05-27 13:31:30 +00:00
Kirill Primak
4a968576e4 xdg-popup: add proper configure flow 2022-05-27 13:31:30 +00:00
Simon Ser
4d7f1aeb73 linux-dmabuf-v1: fix MOD_INVALID handling in feedback tranches
[1] has changed wlr_drm_format to remove the assumption that
MOD_INVALID is always implicitly enabled. MOD_INVALID is now part
of the modifier list just like any other modifier.

The patch adding support for linux-dmabuf-v1 feedback has been
written a lot of time before [1], and hasn't been updated accordingly
when merged. This results in MOD_INVALID being advertised twice [2] and
other index bugs.

Fix these issues by removing special-casing for MOD_INVALID.

[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3231
[2]: https://github.com/swaywm/sway/issues/7028
2022-05-26 13:45:24 +00:00
Simon Ser
be86145322 output: turn make/model/serial into char *
This allows the make/model/serial to be NULL when unset, and allows
them to be longer than the hardcoded array length.

This is a breaking change: compositors need to handle the new NULL
case, and we stop setting make/model to useless "headless" or
"wayland" strings.
2022-05-26 13:36:06 +00:00
Alexander Orzechowski
41124592dd wlr_scene: Hook up HIGHLIGHT logic
This will display red translucent rectangles on the screen regions that
have been damaged. These rectangles will fade out over the span of 250
msecs. If the area is damaged again while the region is fading out,
the timer is reset.

Let's also disable direct scan out when this option is enabled, or else
we won't be able to render the highlight damage regions.
2022-05-23 15:58:49 -04:00
Alexander Orzechowski
b6fc882782 wlr_scene: Hook up RERENDER logic 2022-05-23 15:43:18 -04:00
Alexander Orzechowski
17f5414b1a wlr_scene: Parse out WLR_SCENE_DEBUG_DAMAGE 2022-05-23 15:43:18 -04:00
Manuel Stoeckl
9cae874513 screencopy-v1: Fix frame stride for formats with bpp != 32 2022-05-23 07:37:24 +00:00
Kirill Primak
ee122c9c2a scene/output: check for NULL in destructor 2022-05-23 07:33:49 +00:00
Guido Günther
17b2b06633 seat: Allow to cancel touches
After cancelation we destroy the touch points associated with this
surface as the Wayland spec says:

No further events are sent to the clients from that particular gesture.
Touch cancellation applies to all touch points currently active on this
client's surface. The client is responsible for finalizing the touch
points, future touch points on this surface may re-use the touch point
ID.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/2999
2022-05-22 09:43:33 +00:00
Alexander Orzechowski
dc9bc5683a wlr_scene: Refactor wlr_scene_surface to be a helper on top of wlr_scene_buffer 2022-05-19 14:26:50 -04:00
Alexander Orzechowski
5f43e1732a wlr_scene: Introduce addons to scene nodes 2022-05-19 14:25:34 -04:00
Alexander Orzechowski
20cc1ce0b9 wlr_scene: Change out surface specific iterator functions
Instead iterate over wlr_scene_buffer
2022-05-19 14:24:05 -04:00
Alexander Orzechowski
5f56246571 wlr_scene: Pull scene_node_get_root into a private header
We will need this for surface emulation on buffers.
2022-05-19 14:24:05 -04:00
Alexander Orzechowski
39c059b70e wlr_scene: Make scene_buffer_from_node public 2022-05-19 14:24:05 -04:00
Alexander Orzechowski
73a656e8ac wlr_scene: Add a function to also specify damage when applying a buffer to wlr_scene_buffer 2022-05-19 14:24:05 -04:00
Alexander Orzechowski
34be5da072 wlr_scene: Add a way to choose when input interactions happen on a buffer 2022-05-19 14:24:05 -04:00
Alexander Orzechowski
09c7fe0f90 wlr_scene: Add frame_done signal for wlr_scene_buffer
Let's also change the name of the function. Motivation [1].

[1] https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3496#note_1357824
2022-05-19 14:23:10 -04:00
Alexander Orzechowski
a53eccf2af wlr_scene: Add primary_output property to wlr_scene_buffer 2022-05-19 14:21:22 -04:00
Alexander Orzechowski
dfeb1309a8 wlr_scene: Add presentation signal for wlr_scene_buffer 2022-05-19 14:21:21 -04:00
Alexander Orzechowski
7e383c6a6a wlr_scene: Make wlr_scene_render_output private
This function sidesteps damage tracking and output awareness on
buffers/surfaces. This function isn't a great fit for the API.

Let's also inline the function and simplify it.
2022-05-19 14:17:51 -04:00
Alexander Orzechowski
933ff0e60c wlr_scene: Fix missing calls to scene_node_update_outputs
There were a couple places this was missing
 - on mode change of an output. If the resolution changes for example
   nodes may fall out of the view.
 - on commits on an output for scale or transform changes
 - when the transform of a buffer is changed. If the dest size is not
 set, the buffer may have been rotated potentially changing its size
 if the buffer width != height
2022-05-19 14:17:51 -04:00
Alexander Orzechowski
c46b53d0b0 wlr_scene: Add output_enter/output_leave signals
When we destroy a scene buffer, let's make sure that we call
output_leave signals before we finish the node which will call destroy
listeners.
2022-05-19 14:17:51 -04:00
Alexander Orzechowski
6ddb9e51bd wlr_scene_output: Send output leave events before destroying the output 2022-05-19 14:17:51 -04:00
Alexander Orzechowski
61dab42c70 wlr_scene: Add setter for buffer of a wlr_scene_buffer 2022-05-19 14:17:51 -04:00
Alexander Orzechowski
039a31df9a wlr_scene: Allow buffer in wlr_scene_buffer to be NULL
This is useful to emulate an unmapped surface.
2022-05-19 14:16:52 -04:00
Simon Ser
8fe3aa29da xdg-shell: specify version in wlr_xdg_shell_create
With protocol additions such as [1], compositors currently have no
way to opt out of the version upgrade. The protocol upgrade will
always be backwards-compatible but may require new compositor
features.

The status quo doesn't make it possible to ship a protocol addition
without breaking the wlroots API. This will be an issue for API
stabilization [2].

To address this, let compositors provide a maximum version in the
function creating the global. We need to support all previous versions
of the interface anyways because of older clients.

This mechanism works the same way as Wayland clients passing a version
in wl_global.bind.

[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3514
[2]: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/1008

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3397
2022-05-15 15:44:40 +00:00
Kirill Primak
8b0d4947cc xdg-toplevel: store states on the stack 2022-05-10 19:19:08 +03:00
Simon Ser
410c08cdc6 drm-lease-v1: skip device on wlr_drm_backend_get_non_master_fd failure
On some setups, wlr_drm_backend_get_non_master_fd may fail because
of permission issues. Instead of exposing a bogus global, bail out.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3391
2022-05-02 15:44:16 +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
Ferdinand Bachmann
d3a2ea33e5 types/seat/wlr_seat.c: fix focused_client being null after seat_client recreation 2022-04-16 20:56:30 +02:00
Ferdinand Bachmann
2d4e813530 types/wlr_pointer_gestures_v1.c: get client from seat client instead of resource 2022-04-16 20:53:52 +02:00
Ferdinand Bachmann
eedb9df531 types/wlr_pointer_gestures_v1: null-check both focused_surface and focused_client
(fixes #3385)
2022-04-15 16:06:16 +02:00
Kirill Primak
4ba8458255 scene/output-layout: fix scene destroy handler 2022-04-14 06:51:39 +00:00
Kirill Primak
dec2565f2b xdg-toplevel: don't schedule configures on state requests 2022-04-13 17:00:06 +00:00
Kirill Primak
04aa44b4df xdg-foreign-v2: treat unmapped parents as NULL 2022-04-13 16:48:15 +00:00
Kirill Primak
dac040f87f xdg-foreign-v1: treat unmapped parents as NULL 2022-04-13 16:48:15 +00:00
Kirill Primak
bf3f60ff73 xdg-toplevel: treat unmapped parents as NULL 2022-04-13 16:48:15 +00:00
Guido Günther
dd03d839ab xdg-activation: Deduplicate token creation code
There were three places initializing a token:

- wlr_xdg_activation_v1_add_token
- wlr_xdg_activation_token_v1_create
- activation_handle_get_activation_token

The initialization of the token.destroy was missing in the first one. To
prevent these functions from getting out of sync move the token creation
into a common function.

Fixes 4c59f7d4 ("xdg-activation: Allow to submit tokens")
2022-03-26 17:28:51 +01:00
Leonardo Hernández Hernández
4519117a68 seat: take wlr_keyboard in wlr_seat_set_keyboard()
Signed-off-by: Leonardo Hernández Hernández <leohdz172@protonmail.com>
2022-03-23 13:08:41 +00:00
Guido Günther
4cc2a03620 layer-shell: Make wlr_layer_surface_v1_from_resource public
This allows compositors to leverage the `wl_instance_of` based type
check.
2022-03-23 09:19:43 +00:00
Simon Zeni
aaf787ee56 types/wlr_touch: uniformize events name 2022-03-17 18:16:14 +00:00
Simon Zeni
e732c5c895 types/wlr_tablet_tool: uniformize events name 2022-03-17 18:16:14 +00:00
Simon Zeni
9a17200446 types/wlr_keyboard: uniformize events name 2022-03-17 18:16:14 +00:00
Simon Zeni
bd6c000d14 types/wlr_pointer: uniformize events name 2022-03-17 18:16:14 +00:00
Simon Zeni
a92e5f8d46 types/wlr_input_device: move output_name field to wlr_pointer and wlr_touch 2022-03-17 13:44:18 -04:00
Alexander Orzechowski
74381f3bc3 types/wlr_output: Handle subpixel hints through output commits 2022-03-16 18:41:49 +00:00
Simon Ser
68f2f8cf92 Revert "scene: try to import buffers as textures before rendering"
This reverts commit 3db1bcbe64.

Since [1], importing buffers as textures before wlr_renderer_begin isn't
necessary anymore.

[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3464
2022-03-16 16:42:45 +00:00
Kirill Primak
2d623724c3 xdg-positioner: fix sliding regression
This commit fixes a regression introduced in
511f137f8f where GTK tooltips wouldn't be
unconstrained due to no gravity on x axis being set, in which case the
behavior is ambiguous, by sliding to the right/bottom.
2022-03-15 18:08:29 +00:00
Simon Zeni
4c8ecfcd4a types/wlr_virtual_pointer_v1: remove destroy event
The destroy event from the pointer base wlr_input_device must be used
2022-03-11 20:02:21 +00:00
Simon Zeni
45c8771735 types/wlr_virtual_keyboard_v1: remove destroy event
The destroy event from the keyboard base wlr_input_device must be used
2022-03-11 20:02:21 +00:00
Simon Zeni
eae8952e17 types/wlr_keyboard: remove destroy event
The destroy event from the base wlr_input_device must be used
2022-03-11 20:02:21 +00:00
David96
7a2c96dcbd types/wlr_tablet_tool: remove name ambiguity
It wasn't clear in the backend whether to use name or base.name, change
it so base.name has to be used.

Fixes https://github.com/swaywm/sway/issues/6884
2022-03-11 11:49:41 +01:00
Sebastian Krzyszkowiak
13fcdba75c wlr_output_layout_contains_point: handle outputs that aren't in the layout
Instead of crashing, return `false` when the specified output isn't part
of the layout, as we can be sure that it doesn't contain the specified
point.
2022-03-11 06:49:49 +00:00
Alexander Orzechowski
f330759ba4 wlr_output_damage: Don't schedule a new frame if damage region does not intersect with output
This fixed adaptive sync issues with wlr_scene. Scenes don't check
if the damage region intersects with an output when calling
wlr_output_damage_add.

This is especially important for multi output.
2022-03-08 14:05:36 +00:00
Alexander Orzechowski
fbd4d40318 wlr_output_damage: Use wlr_output_damage_add for wlr_output_damage_add_box 2022-03-08 14:05:36 +00:00
Simon Zeni
cfed039c9a types/wlr_input_device: move init and finish function to private API 2022-03-07 16:37:41 +00:00
Simon Zeni
1bb2631c5c types/wlr_input_device: remove wlr_input_device_destroy 2022-03-07 16:37:41 +00:00
Simon Zeni
10cbb9fbe1 interface/wlr_touch: rework destroy sequence
The destroy callback in wlr_touch_impl has been removed. The function
`wlr_touch_finish` has been introduced to clean up the resources owned by a
wlr_touch.

`wlr_input_device_destroy` no longer destroys the wlr_touch, attempting to
destroy a wlr_touch will result in a no-op.

The field `name` has been added to the wlr_touch_impl to be able to identify
a given wlr_touch device.
2022-03-07 16:37:41 +00:00
Simon Zeni
8d3cb94b41 interface/wlr_tablet_tool: rework destroy sequence
The destroy callback in wlr_tablet_tool_impl has been removed. The function
`wlr_tablet_tool_finish` has been introduced to clean up the resources owned by
a wlr_tablet_tool.

`wlr_input_device_destroy` no longer destroys the wlr_tablet_tool, attempting to
destroy a wlr_tablet_tool will result in a no-op.

The field `name` has been added to the wlr_tablet_tool_impl to be able to
identify a given wlr_tablet_tool device.
2022-03-07 16:37:41 +00:00
Simon Zeni
a5b032cb1e interface/wlr_tablet_pad: rework destroy sequence
The destroy callback in wlr_tablet_pad_impl has been removed. The function
`wlr_tablet_pad_finish` has been introduced to clean up the resources owned by a
wlr_tablet_pad.

`wlr_input_device_destroy` no longer destroys the wlr_tablet_pad, attempting to
destroy a wlr_tablet_pad will result in a no-op.

The field `name` has been added to the wlr_tablet_pad_impl to be able to identify
a given wlr_tablet_pad device.
2022-03-07 16:37:41 +00:00
Simon Zeni
0d2be496a8 interface/wlr_switch: rework destroy sequence
The destroy callback in wlr_switch_impl has been removed. The function
`wlr_switch_finish` has been introduced to clean up the resources owned by a
wlr_switch.

`wlr_input_device_destroy` no longer destroys the wlr_switch, attempting to
destroy a wlr_switch will result in a no-op.

The field `name` has been added to the wlr_switch_impl to be able to identify
a given wlr_switch device.
2022-03-07 16:37:41 +00:00
Simon Zeni
51cd3c0726 interface/wlr_pointer: rework destroy sequence
The destroy callback in wlr_pointer_impl has been removed. The function
`wlr_pointer_finish` has been introduced to clean up the resources owned by a
wlr_pointer.

`wlr_input_device_destroy` no longer destroys the wlr_pointer, attempting to
destroy a wlr_pointer will result in a no-op.

The field `name` has been added to the wlr_pointer_impl to be able to identify
a given wlr_pointer device.
2022-03-07 16:37:41 +00:00
Simon Zeni
7dc4a3ecd7 interface/wlr_keyboard: rework destroy sequence
The destroy member in wlr_keyboard_impl has been removed. The function
`wlr_keyboard_finish` has been introduce to clean up the resources owned by a
wlr_keyboard.

`wlr_input_device_destroy` no longer destroys the wlr_keyboard, attempting to
destroy a wlr_keyboard will result in a no-op.

The field `name` has been added to the wlr_keyboard_impl to be able to identify
a given wlr_keyboard device.
2022-03-07 16:37:41 +00:00
Simon Ser
39b68ea47a buffer: extract interface to separate header
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3389
2022-03-03 15:39:05 +01:00
Simon Zeni
c84744321e types/wlr_virtual_pointer_v1: fix wlr_pointer destroy sequence 2022-02-28 22:02:57 +00:00
Simon Zeni
cdb3e80b39 types/wlr_virtual_keyboard_v1: fix wlr_keyboard destroy sequence 2022-02-28 22:02:57 +00:00
Simon Zeni
e279266f71 interfaces: remove wlr_input_device_impl 2022-02-22 14:23:46 -05:00
Simon Zeni
1acc931cf0 types/wlr_switch: constify impl 2022-02-21 13:53:40 -05:00
Simon Zeni
f1181c34ed types/wlr_tablet_pad: constify impl 2022-02-21 13:53:40 -05:00
Kirill Primak
511f137f8f xdg-positioner: rewrite unconstraining, untie from xdg-popup 2022-02-21 17:26:51 +00:00
Kirill Primak
5879e77d68 xdg-positioner: rename structs
To be consistent with other wlr_xdg_* structs,
wlr_xdg_positioner_resource is renamed to wlr_xdg_positioner and made
public, and wlr_xdg_positioner is renamed to wlr_xdg_positioner_rules.
Functions which operated on wlr_xdg_positioner were renamed and updated
accordingly.
2022-02-21 17:26:51 +00:00
Kirill Primak
b5b15b2625 xdg-{toplevel,popup}: extract destructors 2022-02-21 17:26:51 +00:00
Simon Zeni
edfb332b24 types/wlr_touch: add base wlr_input_device
wlr_touch now owns its wlr_input_device. It will be initialized when the
tablet tool is initialized, and finished when the touch is destroyed.
2022-02-21 17:11:32 +00:00
Simon Zeni
7dfee50350 types/wlr_tablet_tool: add base wlr_input_device
wlr_tablet_tool owns its wlr_input_device. It will be initialized when the
tablet tool is initialized, and finished when the tablet tool is destroyed.
2022-02-21 17:11:32 +00:00
Simon Zeni
a662743610 types/wlr_tablet_pad: add base wlr_input_device
wlr_tablet_pad owns its wlr_input_device. It will be initialized when the
tablet pad is initialized, and finished when the tablet pad is destroyed.
2022-02-21 17:11:32 +00:00
Simon Zeni
0f3b38365d types/wlr_switch: add base wlr_input_device
wlr_switch owns its wlr_input_device. It will be initialized when the
switch is initialized, and finished when the switch is destroyed.
2022-02-21 17:11:32 +00:00
Simon Zeni
d5480efc7a types/wlr_pointer: add base wlr_input_device
wlr_pointer owns its wlr_input_device. It will be initialized when the
pointer is initialized, and finished when the pointer is destroyed.
2022-02-21 17:11:32 +00:00
Simon Zeni
a1978b1299 types/wlr_keyboard: add base wlr_input_device
wlr_keyboard owns its base wlr_input_device. It will be initialized when the
keyboard is initialized, and finished when the keyboard is destroyed.
2022-02-21 17:11:32 +00:00
Simon Zeni
130c3bcf63 types/wlr_input_device: call the specialized input device destroy function on destroy
In case the `wlr_input_device` is not owned by a specialized input device, the
function will finish the wlr_input_device and call it's implementation destroy
function if an implementation has been supplied, or simply free it.
2022-02-21 17:11:32 +00:00
Simon Zeni
fd80329c53 interfaces/wlr_input_device: introduce wlr_input_device_finish
This function releases the wlr_input_device allocated memory (it's name and
it's output name), and signals its destroy event.
2022-02-21 17:11:32 +00:00
Simon Zeni
71577e351e types/wlr_input_device: default vendor and product id to 0
vendor and product id are set when needed by the libinput backend
2022-02-21 17:11:32 +00:00
Roman Gilg
cff4abc5b1 output: clear buffer created for test
When calling wlr_output_test an empty buffer might be created. This implicitly
changes the pending state of the output. Ensure that such a change is only
temporarily and clear such an empty buffer before returning the test result.
2022-02-21 15:58:29 +00:00
Isaac Freund
252b2348bd
wlr_cursor: constify map to region box arguments 2022-02-05 16:32:38 +01:00
Kirill Primak
c1a2c09ade xdg-popup: send invalid_positioner to the right resource 2022-02-02 21:06:12 +03:00
Kirill Primak
7ed60c54a0 xdg-surface: avoid emitting signals with their owner object
https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/1008#note_1139647
2022-02-02 21:06:12 +03:00
Kirill Primak
34a71eae31 xdg-shell: drop wlr_xdg_toplevel_set_fullscreen_event
Instead, compositors can read relevant values from
wlr_xdg_toplevel.requested.
2022-02-02 21:06:12 +03:00
Kirill Primak
fd3a2a0906 xdg-surface: minor consistency renaming 2022-02-02 21:06:12 +03:00
Kirill Primak
88f3040438 xdg-popup: destroy popup-less grab
This also fixes a seat destruction segfaulting if xdg-shell was
destroyed first.
2022-02-02 21:06:12 +03:00
Kirill Primak
d2b36b7bd1 xdg-shell: fix potential use-after-free 2022-02-02 21:06:12 +03:00
Kirill Primak
c35d14ecfa xdg-shell: extract role-specific unmap logic 2022-02-02 21:06:12 +03:00
Kirill Primak
e59aa3e0e7 xdg-toplevel: change object type in event structs
This commit replaces wlr_xdg_toplevel_*_event::surface with a toplevel
field.
2022-02-02 21:06:12 +03:00
Kirill Primak
1e4c1a3b58 xdg-toplevel: change parent type to xdg-toplevel
This commit changes wlr_xdg_toplevel::parent type from wlr_xdg_surface
to wlr_xdg_toplevel.
2022-02-02 21:06:12 +03:00
Kirill Primak
27c8865a4d xdg-shell: unify function arguments' names
`wlr_xdg_surface`s are now named "surface" everywhere, and
`wlr_surface`s are called "wlr_surface".
2022-02-02 21:06:12 +03:00
Kirill Primak
41412cadbe xdg-popup: fix functions' main argument type
With this commit, `wlr_xdg_popup_*()` functions now expect
a `wlr_xdg_popup` instead of a `wlr_xdg_surface`.
2022-02-02 21:06:12 +03:00
Kirill Primak
affe0d8713 xdg-toplevel: fix functions' main argument type
With this commit, `wlr_xdg_toplevel_*()` functions now expect
a `wlr_xdg_toplevel` instead of a `wlr_xdg_surface`.
2022-02-02 21:06:11 +03:00
Kirill Primak
ee52c32915 xdg-shell: fix create_xdg_popup() param type 2022-02-02 21:04:59 +03:00