aboutsummaryrefslogtreecommitdiff
path: root/tinywl/tinywl.c
AgeCommit message (Collapse)Author
2023-04-14compositor: pass version in wlr_compositor_createSimon Ser
This allows wlroots to support newer versions of the interface without breaking the API.
2023-03-04tinywl: init server to zerosKirill Primak
This fixes e.g. accessing grabbed_view on a toplevel unmap if no toplevel was grabbed before.
2023-02-04wlr_scene: Rename wlr_scene_surface_from_bufferAlexander Orzechowski
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-01xdg-shell: convert to try_fromSimon Ser
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/884
2023-02-01examples, tinywl: use "default" cursor instead of "left_ptr"Simon Ser
"left_ptr" is the X11 name, "default" is the cursor spec name.
2023-01-24tinywl: fix extra whitespaceSimon Ser
2023-01-04tinywl: Nuke view->{x, y}Alexander Orzechowski
Instead use the scene node position.
2022-12-06tinywl: handle wlr_output.events.request_stateKirill Primak
2022-11-15backend: return wlr_session in wlr_backend_autocreate() callSimon Ser
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-07tinywl: handle view unmap while grabbedKirill Primak
Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3372
2022-06-28tinywl: exit on backend, renderer or allocator creation failureSimon Zeni
2022-06-21wlr_input_device: remove anon union fieldIsaac Freund
This union is unnecessary since the recent input device refactor and can now be replaced by wlr_*_from_input_device() functions.
2022-05-31wlr_scene: Only allow parenting on a wlr_scene_treeAlexander Orzechowski
2022-05-31wlr_scene: Refactor wlr_scene (the root element) to encase a wlr_scene_treeAlexander Orzechowski
Co-authored-by: Isaac Freund <mail@isaacfreund.com>
2022-05-27tinywl: use xdg-shell v3Kirill Primak
2022-05-19wlr_scene: Refactor wlr_scene_surface to be a helper on top of wlr_scene_bufferAlexander Orzechowski
2022-05-15xdg-shell: specify version in wlr_xdg_shell_createSimon Ser
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-10tinywl: don't crash when there is no keyboardSimon Ser
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-06tinywl/tinywl: clean up tinywl_output when wlr_output is gonexiaoyaobing
Add destroy event processing. Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3416
2022-04-13xdg-toplevel: don't schedule configures on state requestsKirill Primak
2022-03-23seat: take wlr_keyboard in wlr_seat_set_keyboard()Leonardo Hernández Hernández
Signed-off-by: Leonardo Hernández Hernández <leohdz172@protonmail.com>
2022-03-17types/wlr_keyboard: uniformize events nameSimon Zeni
2022-03-17types/wlr_pointer: uniformize events nameSimon Zeni
2022-03-17tinywl: init cursor_modeSimon Zeni
valgrind complains on a use-before-init for the cursor mode.
2022-03-07tinywl: destroy keyboard on wlr_input_device eventSimon Zeni
2022-02-02xdg-toplevel: fix functions' main argument typeKirill Primak
With this commit, `wlr_xdg_toplevel_*()` functions now expect a `wlr_xdg_toplevel` instead of a `wlr_xdg_surface`.
2022-01-14tinywl: fix check whether client is focused or notIsaac Freund
Currently this check is too strict and denies the move/resize request if a subsurface of the client has pointer focus.
2022-01-13subcompositor: split out from compositorKirill Primak
2021-12-13scene: fix wlr_scene_send_frame_done() APIIsaac Freund
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-13tinywl: use wlr_scene_send_frame_done()Isaac Freund
2021-12-01Fix uninitialized variable errors in release modeQuantum
When using `meson --buildtype=release`, `-Wextra -Werror` is passed. This includes `-Werror=maybe-uninitialized`, which complains about the instances fixed in this commit.
2021-11-30tinywl: use wlr_sceneIsaac Freund
2021-11-19tinywl: init output render before commitSimon Zeni
2021-11-18tinywl: autocreate allocator and init outputSimon Zeni
2021-10-02Fix spelling errorsElyes HAOUAS
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
2021-08-20tinywl: simplify logic for sending pointer eventsIsaac Freund
2021-04-19Stop specifying xkb_rule_namesSimon Ser
If a NULL xkb_rule_names pointer is passed to xkb_keymap_new_from_names, libxkbcommon will default to reading the XKB_* env variables. So there's no need to do it ourselves. Also s/xkb_map_new_from_names/xkb_keymap_new_from_names/ since the latter is more consistent with the returned struct name. [1]: https://xkbcommon.org/doc/current/structxkb__rule__names.html
2021-01-07tinywl: fix wlr_backend_autocreate callSimon Zeni
2020-11-11Replace wlr_key_state with wl_keyboard_key_stateIsaac Freund
There's no reason to have duplicate enums
2020-04-28tinywl: Fix wrong anchor point while resizing a windowGreg Depoire--Ferrer
Previously, when dragging the left border of a window with the mouse in tinywl, there was a bug where it snap the top level surface's geometry X coordinate directly to the position of the mouse, as if you started the resize right on the border. This also affected the other (right, top and bottom) borders. I think that the previous resize code was hard to understand. Honestly I have not spent a lot of time trying to understand why it didn't work and I wrote another resize algorithm instead: now, instead of working directly with widths and heights which are complicated, we work with the borders (left, right, top, bottom). This is easier to understand IMO. Note: I originally fixed this [in the waybox compositor](https://github.com/wizbright/waybox/pull/23) but then I realized that the code was taken from tinywl and that it had the same issues so I copied my fix for tinywl.
2020-04-28tinywl: handle request set selectionIsaac Freund
2020-04-28tinywl: remove unused variablesIsaac Freund
2020-04-23tinywl: fix geo_box bug in cursor resizingKalyan Sriram
While trying out the tinywl code, I found that the resize mode was behaving weirdly ... so I looked into code. Turns out the `begin_interactive` method stores the cursor position plus the geo_box position; however, `process_cursor_resize` wasn't taking this into account, causing windows to jump down in size unexpectedly when resized and lose alignment with the cursor. To fix this, I simply added a member to the `tinywl_server` struct that stores the geo_box when the mouse enters grab mode, and I referenced that data in the resize method. I considered polling for this data every time instead of storing it in the server struct, but 1) since changes in this value are not relevant and 2) it could potentially decrease performance (I don't know enough about wlroots to know how much) I decided to just store it. I can change this if desired.
2020-04-15tinywl: remove redundant create output global callIsaac Freund
2019-12-30tinywl: enable and commit output when modesettingSimon Ser
While at it, choose the preferred mode instead of the last one.
2019-07-27Remove all wayland-server.h includesSimon Ser
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-04-23output: refactor frame submission APISimon Ser
This is necessary for direct scan-out and other upcoming features. This patch changes the output API to look like the wl_surface API. Outputs now have some double-buffered state: the frame to be submitted (currently only wlr_renderer frames are supported) and the damaged region. To attach a pending frame, use wlr_output_attach_render. To set the pending damaged region, use wlr_output_set_damage. To submit the pending state, call wlr_output_commit. This will submit the pending frame to the backend. To migrate from the old API to the new one: - Replace wlr_output_make_current calls by wlr_output_attach_render - Replace wlr_output_swap_buffers calls by wlr_output_set_damage and wlr_output_commit
2019-03-02tinywl: send pointer frame eventsemersion
Fixes https://github.com/swaywm/wlroots/issues/1544
2019-02-26clang compile fix #1572athrungithub
clang consider error no enum handled, in BSD and Linux
2019-01-13Fix software cursor rendering for tinywl and some examplesAlexander Bakker