aboutsummaryrefslogtreecommitdiff
path: root/tinywl/tinywl.c
AgeCommit message (Collapse)Author
2024-02-28pointer: use enum wl_pointer_button_stateSimon Ser
2024-02-15Define _POSIX_C_SOURCE globallySimon Ser
Stop trying to maintain a per-file _POSIX_C_SOURCE. Instead, require POSIX.1-2008 globally. A lot of core source files depend on that already. Some care must be taken on a few select files where we need a bit more than POSIX. Some files need XSI extensions (_XOPEN_SOURCE) and some files need BSD extensions (_DEFAULT_SOURCE). In both cases, these feature test macros imply _POSIX_C_SOURCE. Make sure to not define both these macros and _POSIX_C_SOURCE explicitly to avoid POSIX requirement conflicts (e.g. _POSIX_C_SOURCE says POSIX.1-2001 but _XOPEN_SOURCE says POSIX.1-2008). Additionally, there is one special case in render/vulkan/vulkan.c. That file needs major()/minor(), and these are system-specific. On FreeBSD, _POSIX_C_SOURCE hides system-specific symbols so we need to make sure it's not defined for this file. On Linux, we can explicitly include <sys/sysmacros.h> and ensure that apart from symbols defined there the file only uses POSIX toys.
2024-02-06xdg-shell: drop automatic surface configurationKirill Primak
Compositors now are expected to wait for an initial commit by checking wlr_xdg_surface.initial_commit on every surface commit and send (schedule) configure events manually.
2024-01-25backend: take wl_event_loop instead of wl_display in wlr_backend_autocreate()Simon Ser
2024-01-23seat/pointer: add support for axis_relative_direction eventSimon Ser
2023-12-07tinywl: check initialized instead of initial_commitKirill Primak
oops
2023-12-07tinywl: don't send configures to uninitialized xdg_surfacesKirill Primak
2023-11-23xdg-{shell,decoration}: improve eventsKirill Primak
This commit changes the behavior of `new_*` signals to better match their names (see https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3608). wlr_xdg_shell.events.new_surface is now emitted when an xdg_surface is created, and wlr_xdg_shell.events.new_{toplevel,popup} events are introduced to get notified when an xdg_{toplevel,popup} is created. Same applies to `wlr_xdg_decoration_manager_v1.events.new_toplevel_decoration`. As a result, wlr_xdg_surface.added and wlr_xdg_toplevel_decoration_v1.added are removed, as we no longer need to track whether the corresponding event was emitted. Additionally, this commit changes the behavior of wlr_xdg_surface.events.destroy: it is now emitted when the xdg_surface is destroyed, as the name suggests. wlr_xdg_{toplevel,popup}.events.destroy events are added to get notified when an xdg_{toplevel,popup} is destroyed.
2023-11-23output-layout: take wl_display in constructorSimon Ser
The output layout creates and destroys wl_output globals. We will soon need the wl_display to do so.
2023-11-14tinywl: don't use "I"/"my" in docsKirill Primak
2023-11-14tinywl: fix xdg_toplevel_destroy() docsKirill Primak
2023-11-14tinywl: stop using the word "view" to refer to toplevelsSimon Ser
"View" has been cargo-culted from Weston. In Weston, a view is not even necessarily a toplevel -- it's just a way to draw an arbitrary somewhere (a surface may be painted at multiple locations simultaneously). The Weston concept has been misunderstood and then was carried over to rootston, Sway, and tinywl. Let's just use the official Wayland wording instead.
2023-11-13tinywl: fix crash when previously focused surface is not a toplevelSimon Ser
It can be e.g. a popup. Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3754
2023-10-03treewide: Migrate from sizeof(struct) to sizeof(*pointer) where practicalAlexander Orzechowski
2023-08-22scene_output_layout: make output adding explicitRose Hudson
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3709
2023-08-21Don't assume xdg_surface.{toplevel,popup} is non-NULLKirill Primak
This assumption will become incorrect with future commits.
2023-07-10scene_output: optionally record and report timingsRose Hudson
2023-06-27tinywl: enable new outputsSimon Ser
2023-06-23output: add wlr_output_state_init()Simon Ser
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-15cursor: add wlr_cursor_set_xcursor()Simon Ser
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-13tinywl: Drop usage of wlr_output.pendingAlexander Orzechowski
2023-06-02xdg-shell: use unified map logicKirill Primak
2023-05-02tinywl: Release everything before destroyAlexander Orzechowski
This makes -Db_sanatize=address happy.
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.