Commit Graph

79 Commits

Author SHA1 Message Date
Alexander Orzechowski 1b0694b794 treewide: Migrate from sizeof(struct) to sizeof(*pointer) where practical 2023-10-03 01:51:07 -04:00
Simon Ser 2926acf60d tinywl: set minimum wlroots version in Makefile 2023-09-01 00:28:55 +09:00
Rose Hudson f5917f0247 scene_output_layout: make output adding explicit
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3709
2023-08-22 11:53:28 +02:00
Kirill Primak 10ba8ebc70 Don't assume xdg_surface.{toplevel,popup} is non-NULL
This assumption will become incorrect with future commits.
2023-08-21 16:30:29 +00:00
Rose Hudson 214df8eda0 scene_output: optionally record and report timings 2023-07-10 09:57:02 +00:00
Simon Ser 9e6431dc3b tinywl: enable new outputs 2023-06-27 16:26:30 +00:00
Simon Ser be05097968 output: add wlr_output_state_init()
This changes the semantics of wlr_output_state. Instead of having
fields with uninitialized memory when missing from the committed
bitflag, all fields are always initialized (and maybe NULL/empty),
just like we do in wlr_surface_state. This reduces the chances of
footguns when reading a field, and removes the need to check for
the committed bitfield everywhere.

A new wlr_output_state_init() function takes care of initializing
the Pixman region.
2023-06-23 18:07:26 +00:00
Simon Ser da04b066ea cursor: add wlr_cursor_set_xcursor()
This keeps track of the last set XCursor. If it hasn't changed,
skip the texture upload.

In the future, support for animated XCursors can be added.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3436
2023-06-15 18:28:43 +02:00
Alexander Orzechowski 73ca1ea48a tinywl: Drop usage of wlr_output.pending 2023-06-13 09:19:51 +00:00
Kirill Primak b0437fc416 xdg-shell: use unified map logic 2023-06-02 17:26:18 +00:00
Alexander Orzechowski d5320e5f20 tinywl: Release everything before destroy
This makes -Db_sanatize=address happy.
2023-05-02 10:48:31 -04: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 3a200aa279 tinywl: init server to zeros
This fixes e.g. accessing grabbed_view on a toplevel unmap if no
toplevel was grabbed before.
2023-03-04 17:01:11 +03:00
Alexander Orzechowski 7b32c25a4f wlr_scene: Rename wlr_scene_surface_from_buffer
This renames it to wlr_scene_surface_try_from_buffer to be more clear
that this function can return NULL. This is inline with the rest of
wlroots[1].

[1] https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3991
2023-02-04 02:57:42 -05:00
Simon Ser 711a1a3ed4 xdg-shell: convert to try_from
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/884
2023-02-01 20:12:49 +01:00
Simon Ser 3668c9d86c examples, tinywl: use "default" cursor instead of "left_ptr"
"left_ptr" is the X11 name, "default" is the cursor spec name.
2023-02-01 15:00:42 +01:00
Simon Ser 90d7bce994 tinywl: fix extra whitespace 2023-01-24 00:14:22 +01:00
Alexander Orzechowski e0b2bf2a6b tinywl: Nuke view->{x, y}
Instead use the scene node position.
2023-01-04 01:47:49 -05:00
Kirill Primak 825f1b2dc6 tinywl: handle wlr_output.events.request_state 2022-12-06 09:05:32 +00:00
Simon Ser 41b7acbab7 backend: return wlr_session in wlr_backend_autocreate() call
Up until now, wlr_backend_autocreate() created the wlr_session and
then stuffed it into struct wlr_multi_backend so that compositors
can grab it later.

This is an abuse of wlr_multi_backend and the wlr_backend API:
wlr_backend_get_session() and wlr_multi_backend.session only exist
to accomodate the needs of wlr_backend_autocreate(). What's more,
the DRM and libinput backends don't implement
wlr_backend_impl.get_session.

Instead, return the struct wlr_session to the compositor in the
wlr_backend_autocreate() call. wlr_backend_get_session() will be
removed in the next commit.
2022-11-15 21:16:25 +00:00
Kirill Primak b7623694ac tinywl: handle view unmap while grabbed
Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3372
2022-11-07 20:09:25 +03:00
Simon Zeni 517ea218c6 tinywl: exit on backend, renderer or allocator creation failure 2022-06-28 13:43:36 +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
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
Kirill Primak 75d31509db tinywl: use xdg-shell v3 2022-05-27 13:31:30 +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
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
Simon Ser fa9b61004b tinywl: don't crash when there is no keyboard
Running with WLR_BACKENDS=headless, there is no keyboard device.
Avoid crashes like so:

    ../tinywl/tinywl.c:136:2: runtime error: member access within null pointer of type 'struct wlr_keyboard'
    ../tinywl/tinywl.c:136:2: runtime error: member access within null pointer of type 'struct wlr_keyboard'
    AddressSanitizer:DEADLYSIGNAL
    =================================================================
    ==331107==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000120 (pc 0x556ed03e4e99 bp 0x7ffce834bc10 sp 0x7ffce834bbb0 T0)
    ==331107==The signal is caused by a READ memory access.
    ==331107==Hint: address points to the zero page.
        #0 0x556ed03e4e99 in focus_view ../tinywl/tinywl.c:136
        #1 0x556ed03eb3be in xdg_toplevel_map ../tinywl/tinywl.c:603
        #2 0x7f75d6f768db in wlr_signal_emit_safe ../util/signal.c:29
        #3 0x7f75d6e9cac7 in xdg_surface_role_commit ../types/xdg_shell/wlr_xdg_surface.c:315
        #4 0x7f75d6eb6944 in surface_commit_state ../types/wlr_compositor.c:466
        #5 0x7f75d6eb7b02 in surface_handle_commit ../types/wlr_compositor.c:523
        #6 0x7f75d5714d49  (/usr/lib/libffi.so.8+0x6d49)
        #7 0x7f75d5714266  (/usr/lib/libffi.so.8+0x6266)
        #8 0x7f75d68cb322  (/usr/lib/libwayland-server.so.0+0xd322)
        #9 0x7f75d68c65cb  (/usr/lib/libwayland-server.so.0+0x85cb)
        #10 0x7f75d68c91c9 in wl_event_loop_dispatch (/usr/lib/libwayland-server.so.0+0xb1c9)
        #11 0x7f75d68c6d36 in wl_display_run (/usr/lib/libwayland-server.so.0+0x8d36)
        #12 0x556ed03eef55 in main ../tinywl/tinywl.c:905
        #13 0x7f75d5d2330f in __libc_start_call_main (/usr/lib/libc.so.6+0x2d30f)
        #14 0x7f75d5d233c0 in __libc_start_main@GLIBC_2.2.5 (/usr/lib/libc.so.6+0x2d3c0)
        #15 0x556ed03e46e4 in _start (/home/simon/src/wlroots/build/tinywl/tinywl+0x136e4)
2022-05-10 16:37:21 +00:00
xiaoyaobing cb012c5cb5 tinywl/tinywl: clean up tinywl_output when wlr_output is gone
Add destroy event processing.

Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3416
2022-05-06 20:05:17 +03:00
Kirill Primak dec2565f2b xdg-toplevel: don't schedule configures on state requests 2022-04-13 17:00:06 +00:00
Kirill Primak 578e5614d4 tinywl: remove outdated non-feature from README.md
Now that tinywl uses wlr_scene under the hood, damage tracking comes for
free.
2022-04-01 14:22:28 +00:00
Kirill Primak 62fbf3f4ba tinywl: don't generate xdg-shell-protocol.c
It's unused, and wlroots-based compositors don't need to do this anyway.
2022-04-01 11:51:24 +03: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
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 64fe6ab300 tinywl: init cursor_mode
valgrind complains on a use-before-init for the cursor mode.
2022-03-17 17:16:47 +00:00
Simon Zeni 9d8dc026e5 tinywl: destroy keyboard on wlr_input_device event 2022-03-07 16:37:41 +00: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
Isaac Freund 89dc9a4496 tinywl: fix check whether client is focused or not
Currently this check is too strict and denies the move/resize request
if a subsurface of the client has pointer focus.
2022-01-14 20:17:22 +00:00
Kirill Primak b6f43ab2e1 subcompositor: split out from compositor 2022-01-13 10:06:41 +00:00
Isaac Freund 1c3e0816f3
scene: fix wlr_scene_send_frame_done() API
This doesn't work if scene outputs are not used as the primary output of
scene surfaces will always be NULL.

Therefore, take a wlr_scene_output instead of separate wlr_scene and
wlr_output arguments and rename the function to
wlr_scene_output_send_frame_done().

The actual behavior of the function is unchanged.
2021-12-13 17:26:22 +01:00
Isaac Freund ad01cdf0b2 tinywl: use wlr_scene_send_frame_done() 2021-12-13 15:21:05 +00:00
Quantum 812ab2e716 Fix uninitialized variable errors in release mode
When using `meson --buildtype=release`, `-Wextra -Werror` is passed.
This includes `-Werror=maybe-uninitialized`, which complains about
the instances fixed in this commit.
2021-12-01 02:39:14 -05:00
Isaac Freund a44b2af672
tinywl: use wlr_scene 2021-11-30 22:06:42 +01:00
Simon Zeni 52c34e8253 tinywl: build with meson if examples option is enabled 2021-11-19 16:42:14 +00:00
Simon Zeni ee210758fc tinywl: init output render before commit 2021-11-19 10:44:51 -05:00
Simon Zeni a6538ced35 tinywl: autocreate allocator and init output 2021-11-18 09:37:57 -05:00
Elyes HAOUAS dc3d1530bf Fix spelling errors
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
2021-10-02 10:22:13 +02:00
Isaac Freund f2f3df9fb1 tinywl: simplify logic for sending pointer events 2021-08-20 16:32:28 +02:00