aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
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-02-02xdg-shell: fix create_xdg_popup() param typeKirill Primak
2022-02-02xdg-shell: rename surface role handlersKirill Primak
2022-02-02xdg-foreign: Fix crash on destroy of degenerate surfaceAlexander Orzechowski
I am running a custom compiled version of chromium with a patch to get it up and running on sway git at the moment, and in that development build I compiled there is a bug where the browser will crash if you try to open a file select dialog. When this crash happens, chromium will not close, but instead will remain open and impossible to close unless you send a SIGKILL signal to the process. However, sway will crash to tty when you send the SIGKILL. I have a hunch that when chromium is opening the file select dialog it is creating some sort of a xdg toplevel surface. But it freezes before it fully initializes the surface. When the SIGKILL signal is given, sway/wlroots will try to free the xdg_toplevel surface but because it hasn't fully initialized due to the frozen window, it segfaults. Don't be fooled by the assert, the assert is not firing, the surface pointer is indeed NULL here. * thread #1, name = 'sway', stop reason = signal SIGSEGV: invalid address (fault address: 0x28) frame #0: 0x00007ffff78b9041 libwlroots.so.11`wlr_xdg_toplevel_set_parent(surface=0x0000000000000000, parent=0x0000000000000000) at wlr_xdg_toplevel.c:159:37 156 157 void wlr_xdg_toplevel_set_parent(struct wlr_xdg_surface *surface, 158 struct wlr_xdg_surface *parent) { -> 159 assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL); 160 assert(!parent || parent->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL); 161 162 if (surface->toplevel->parent) { (lldb) up error: sway {0x0003442a}: DIE has DW_AT_ranges(DW_FORM_sec_offset 0x67) attribute, but range extraction failed (invalid range list offset 0x67), please file a bug and attach the file at the start of this error message error: sway {0x0003442a}: DIE has DW_AT_ranges(DW_FORM_sec_offset 0x67) attribute, but range extraction failed (invalid range list offset 0x67), please file a bug and attach the file at the start of this error message frame #1: 0x00007ffff78e176e libwlroots.so.11`destroy_imported(imported=0x000055555626d570) at wlr_xdg_foreign_v1.c:154:3 151 wl_list_for_each_safe(child, child_tmp, &imported->children, link) { 152 struct wlr_xdg_surface *xdg_child = 153 wlr_xdg_surface_from_wlr_surface(child->surface); -> 154 wlr_xdg_toplevel_set_parent(xdg_child, NULL); 155 } 156 157 wl_list_remove(&imported->exported_destroyed.link); (lldb) up frame #2: 0x00007ffff78e1b9d libwlroots.so.11`xdg_imported_handle_resource_destroy(resource=0x00005555562555a0) at wlr_xdg_foreign_v1.c:280:2 277 struct wl_resource *resource) { 278 struct wlr_xdg_imported_v1 *imported = xdg_imported_from_resource(resource); 279 if (!imported) { -> 280 return; 281 } 282 283 destroy_imported(imported); (lldb) up frame #3: 0x00007ffff794989a libwayland-server.so.0`___lldb_unnamed_symbol211 + 154 libwayland-server.so.0`___lldb_unnamed_symbol211: -> 0x7ffff794989a <+154>: andl $0x1, %r13d 0x7ffff794989e <+158>: je 0x7ffff79498b0 ; <+176> 0x7ffff79498a0 <+160>: addq $0x8, %rsp 0x7ffff79498a4 <+164>: movl $0x1, %eax (lldb) up frame #4: 0x00007ffff794fec0 libwayland-server.so.0`___lldb_unnamed_symbol290 + 64 libwayland-server.so.0`___lldb_unnamed_symbol290: -> 0x7ffff794fec0 <+64>: cmpl $0x1, %eax 0x7ffff794fec3 <+67>: jne 0x7ffff794fed3 ; <+83> 0x7ffff794fec5 <+69>: addq $0x8, %rbx 0x7ffff794fec9 <+73>: cmpq %rbx, %r13 (lldb) up frame #5: 0x00007ffff79503e0 libwayland-server.so.0`___lldb_unnamed_symbol300 + 32 libwayland-server.so.0`___lldb_unnamed_symbol300: -> 0x7ffff79503e0 <+32>: cmpl $0x1, %eax 0x7ffff79503e3 <+35>: je 0x7ffff79503f0 ; <+48> 0x7ffff79503e5 <+37>: popq %rbx 0x7ffff79503e6 <+38>: popq %r12 (lldb) up frame #6: 0x00007ffff794a30e libwayland-server.so.0`wl_client_destroy + 126 libwayland-server.so.0`wl_client_destroy: -> 0x7ffff794a30e <+126>: movq %r12, %rdi 0x7ffff794a311 <+129>: callq 0x7ffff7950150 ; ___lldb_unnamed_symbol293 0x7ffff794a317 <+135>: movq 0x8(%rbp), %rdi 0x7ffff794a31b <+139>: callq *0xdc77(%rip) (lldb) up frame #7: 0x00007ffff794a3f7 libwayland-server.so.0`___lldb_unnamed_symbol214 + 119 libwayland-server.so.0`___lldb_unnamed_symbol214: -> 0x7ffff794a3f7 <+119>: movq 0x28(%rsp), %rax 0x7ffff794a3fc <+124>: subq %fs:0x28, %rax 0x7ffff794a405 <+133>: jne 0x7ffff794a727 ; <+935> 0x7ffff794a40b <+139>: addq $0x38, %rsp (lldb) up frame #8: 0x00007ffff794d1ca libwayland-server.so.0`wl_event_loop_dispatch + 202 libwayland-server.so.0`wl_event_loop_dispatch: -> 0x7ffff794d1ca <+202>: addq $0xc, %r15 0x7ffff794d1ce <+206>: cmpq %r15, %rbp 0x7ffff794d1d1 <+209>: jne 0x7ffff794d1b8 ; <+184> 0x7ffff794d1d3 <+211>: movq 0x8(%rsp), %rcx (lldb) up frame #9: 0x00007ffff794ad37 libwayland-server.so.0`wl_display_run + 39 libwayland-server.so.0`wl_display_run: -> 0x7ffff794ad37 <+39>: movl 0x8(%rbx), %eax 0x7ffff794ad3a <+42>: testl %eax, %eax 0x7ffff794ad3c <+44>: jne 0x7ffff794ad20 ; <+16> 0x7ffff794ad3e <+46>: popq %rbx (lldb) up frame #10: 0x000055555557689a sway`server_run(server=0x00005555555f26c0) at server.c:307:2 304 wlr_backend_destroy(server->backend); 305 return false; 306 } -> 307 308 return true; 309 } 310 (lldb) up frame #11: 0x0000555555575a93 sway`main(argc=3, argv=0x00007fffffffe978) at main.c:431:2 428 swaynag_show(&config->swaynag_config_errors); 429 } 430 -> 431 server_run(&server); 432 433 shutdown: 434 sway_log(SWAY_INFO, "Shutting down sway");
2022-02-02ext-session-lock-v1: new protocol implementationIsaac Freund
This implements the new ext-session-lock-v1 protocol [1]. [1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/131
2022-02-01scene: Add layer_shell_v1 helperKenny Levinsen
This helper behaves similar to the xdg_shell helper, and additionally provides a little assistance for positioning and exclusive_zone management.
2022-02-01scene: try to import buffers as textures before renderingSimon Ser
The wlroots APIs currently don't allow importing/uploading a buffer during rendering operations. Scene-graph buffer nodes need to turn their wlr_buffer into a wlr_texture at some point. It's not always possible to do so at wlr_scene_buffer creation time because the scene-graph may have zero outputs at this point, thus no way to grab a wlr_renderer. Instead, add scene-graph buffers to a pending list and try to import them in wlr_scene_output_commit. References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3354
2022-01-31cursor: ensure mapping box is always initializedKirill Primak
Commit 498f30aad100ca616640c7bcbf11ab8ef7d48c45 changed the logic of get_mapping() in types/wlr_cursor.c to use updated version of wlr_output_layout_get_box(). However, the case where c_device isn't NULL but doesn't have output or geometry mappings wasn't handled properly, resulting in leaving the output value uninitialized. This commit fixes `c_device != NULL` branch by returning from the function only when a mapping is found. Fixes https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3369
2022-01-31xcursor: garbage collect XcursorLibraryLoadImagesVlad Zahorodnii
XcursorLibraryLoadImages is unused, let's drop it. Same as [1]. [1]: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/206 Co-authored-by: Simon Ser <contact@emersion.fr>
2022-01-31cursor: store mapped_box as valueKirill Primak
2022-01-31output-layout: remove useless types/fieldsKirill Primak
2022-01-31output-layout: make wlr_output_layout_get_box() take a box as parameterKirill Primak
Closes https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/812
2022-01-28xdg-output: remove dead codeIsaac Freund
wlroots current requires wayland-protocols 1.24, so this if is no longer needed and hasn't been for a while.
2022-01-25subsurface: unlock cached state on commit if desyncedKirill Primak
wl_subsurface::set_desync description states: "If cached state exists when wl_surface.commit is called in desynchronized mode, the pending state is added to the cached state, and applied as a whole." This commit reintroduces an implementation of said behavior, previously removed in 7daf6da9ac05be2cb74c0983e3caee0b21db75d4. Strictly speaking, this logic isn't fully correct, as the cached state and the pending state are applied individually instead, if the cached state isn't locked by anything else. However, the end result is still the same. This commit fixes the issue with Firefox permission popups.
2022-01-22compositor: damage the whole buffer on viewport src changeKirill Primak
wp_viewporter protocol doesn't seem to say anything about damage, but Firefox assumes that wp_viewport::set_source alone is enough to damage the whole surface, and that assumption kinda makes sense, so let's do that.
2022-01-20subcompositor: destroy subsurface with parentSimon Ser
When the parent surface is destroyed, also destroy the child wl_subsurface. No need to handle the wlr_subsurface.parent == NULL case anymore. Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/1709
2022-01-20subcompositor: document subsurface_from_resourceSimon Ser
2022-01-20editorconfig: set max_line_lengthSimon Ser
See [1]. CONTRIBUTING.md says: > Try to keep your lines under 80 columns, but you can go up to 100 if it > improves readability. [1]: https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#max_line_length
2022-01-19render/vulkan: log physical device driver nameSimon Ser
This can be useful to figure out why a required feature is missing, e.g. as in [1]. We check VK_EXT_physical_device_drm availability after printing the driver name. [1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3358
2022-01-19scene_graph: Simplify computation for offset of new surfaces.Alexander Orzechowski
This became possible after the usage of wlr_surface_send_frame_done.
2022-01-19scene_graph: remove unused outputs listAlexander Orzechowski
2022-01-19scene_graph: use wlr_scene_output_send_frame_doneAlexander Orzechowski
2022-01-17foreign-toplevel: send enter if needed on output bindIsaac Freund
Currently the output enter event is never sent if the client has not yet bound the output, which happens every time the compositor creates a new output. To fix this, listen for the output bind event and inform clients as if needed.
2022-01-16input_method_v2: improve mapping detectionTadeo Kondrak
Detect NULL commits before the surface is actually committed, allowing the surface to be properly damaged on unmap.
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-13surface: improve role precommit hookKirill Primak
Now the role precommit hook is called before the commit, not on wl_surface.commit request, and takes a state which is to be applied.
2022-01-13surface: deprecate wlr_surface.hKirill Primak
2022-01-13surface: move decl to wlr_{sub,}compositor.hKirill Primak
2022-01-13surface: move impl to types/wlr_{sub,}compositor.cKirill Primak
2022-01-13surface: introduce events.client_commitKirill Primak
wlr_surface.events.client_commit is fired when wl_surface.commit request is received.
2022-01-13subcompositor: split out from compositorKirill Primak
2022-01-09readme: drop mention of the Sway projectSimon Ser
wlroots has historically been started as a Sway project, but these days many wlroots contributors are working on other compositors. wlroots now also has its own namespace on gitlab.freedesktop.org. Let's remove the mention about Sway in the README, to make it clearer that Sway isn't treated in a special manner when it comes to wlroots development.
2022-01-08scene/subsurface_tree: fix handling subsurface destructionKirill Primak
This commit renames map/unmap listeners to clarify that they handle subsurface events, and ensures the node is always destroyed before the subsurface. Without this patch, wl_list_remove() would operate on listener links in already freed memory. glibc is usually lenient to bugs like this, but musl isn't.
2022-01-05render/gles2: don't constrain shm formats to ones that support readingThomas Hebb
commit 44e8451cd93e ("render/gles2: hide shm formats without GL support") added the is_gles2_pixel_format_supported() function to render/gles2/pixel_format.c, whose stated purpose is to "check whether the renderer has the needed GL extensions to read a given pixel format." It then used that function to filter the pixel formats returned by get_gles2_shm_formats(). The result of this change is that RGB formats are no longer reported for GL drivers that don't implement EXT_read_format_bgra, even when those formats are supported for rendering (which they have to be for wlr_gles2_renderer_create() to succeed). This is a pretty clear regression, since wlr_renderer_init_wl_shm() fails when either of WL_SHM_FORMAT_ARGB8888 or WL_SHM_FORMAT_XRGB8888 are missing. To fix the regression, change is_gles2_pixel_format_supported() to accept all pixel formats that support rendering, regardless of whether we can read them or not, and move the check for EXT_read_format_bgra back into gles2_read_pixels(). (There's already a check for this extension in gles2_preferred_read_format(), so we're not breaking any abstraction that wasn't already broken.) Tested on the NVIDIA 495.46 proprietary driver, which doesn't support EXT_read_format_bgra. Fixes: 44e8451cd93e ("render/gles2: hide shm formats without GL support")
2021-12-26vulkan: Fix imported image layoutnyorain
2021-12-23scene: schedule an output frame on wl_surface.frameSimon Ser
Some clients (e.g. mpv, Firefox) request a new wl_surface.frame callback without damaging their surface. When this happens, schedule a new output frame. Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3350
2021-12-20wlr_texture: remove wlr_texture_from_wl_drm() from headerIsaac Freund
This function was already removed in e5b5592a but it was forgotten to remove it from the header.
2021-12-20backend: error out in autocreate without libinput supportSimon Ser
The libinput backend is now optional. However, this means that a user building wlroots without the correct libinput dependencies will end up with a compositor which doesn't respond to input events. wlr_backend_autocreate is supposed to return a sensible setup, so in this case let's just error out and explain what happened. Users can suppress the check by setting WLR_LIBINPUT_NO_DEVICES=1 (already used to suppress the zero input device case inside the libinput backend). Compositors which really want to create a bare DRM backend can easily create it manually instead of using wlr_backend_autocreate.
2021-12-19build: simplify Meson subproject fallbacksSimon Ser
All of these projects use meson.override_dependency() so we can stop referencing their internal variable name to grab the depndencies we need.
2021-12-17Remove wlr_box.h redirectionSimon Ser
Compositors should've all been updated to use the new header by now.
2021-12-17build: bump soversionSimon Ser
According to [1] this should be done at each release with breaking ABI changes. [1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/wikis/Core-contributor-guide#releasing-a-new-version Fixes: 7360810f2e5c ("build: bump to version 0.16.0")
2021-12-17layer-shell: fix type of marginsIsaac Freund
These currently use uint32_t while they are an int32_t in the protocol.
2021-12-17build: bump to version 0.16.0Simon Ser
2021-12-15backend/wayland: add basic linux-dmabuf feedback supportSimon Ser
This patch makes it so we bind to zwp_linux_dmabuf_v1 version 4 and we use it to grab the main device. v4 sends supported formats via a table so we need to handle this as well. v4 allows wlroots to remove the requirement for Mesa's internal wl_drm interface.
2021-12-15layer-shell: don't set committed flag if the property didn't changeStacy Harper
This fixes configure loop in Sway when clients re-send same properties on every configure event. Original issue: https://todo.sr.ht/~mil/sxmo-tickets/413
2021-12-14scene: add wlr_scene_set_presentation()Isaac Freund
This helper automates sending presentation feedback to clients based on the primary output of scene surfaces.
2021-12-14build: add subproject fallback for libdrmSimon Ser
2021-12-14backend/drm: use drmCloseBufferHandleSimon Ser
This has been added in [1] and allows us to close buffer handles without manually calling drmIoctl. [1]: https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/192
2021-12-14backend/drm: use drmModeFormatModifierBlobIterNextSimon Ser
This avoids open-coding our own logic. The resulting code is more readable. References: https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/146
2021-12-14util/global: remove wl_display arg from wlr_global_destroy_safeSimon Ser
Since [1], we can get the wl_display directly from the wl_global. [1]: https://gitlab.freedesktop.org/wayland/wayland/-/commit/2b22160fb690a76247aa9bd0be3069ff43e8239f