Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package wlroots for openSUSE:Factory checked in at 2023-02-11 21:57:55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/wlroots (Old) and /work/SRC/openSUSE:Factory/.wlroots.new.1848 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "wlroots" Sat Feb 11 21:57:55 2023 rev:25 rq:1064383 version:0.16.2 Changes: -------- --- /work/SRC/openSUSE:Factory/wlroots/wlroots.changes 2022-12-28 10:54:37.868140838 +0100 +++ /work/SRC/openSUSE:Factory/.wlroots.new.1848/wlroots.changes 2023-02-11 21:58:23.660022585 +0100 @@ -1,0 +2,22 @@ +Sat Feb 11 11:20:07 UTC 2023 - Dirk Müller <dmuel...@suse.com> + +- update to 0.16.2: + * xcursors: Alias existing cursor defaults to cursor-spec cursor + names + * xdg-activation: accept pointer focus for new tokens + * xwayland/xwm: unpair even if surface is NULL + * backend/x11: fix delta_discrete value + * backend/x11: fix initial value of wlr_x11_buffer.n_busy + * backend/drm: disable all CRTCs after VT switch + * render/vulkan: fix vkCmdClearAttachments validation error + * backend/drm: set "max bpc" property based on pixel format + * xdg-shell: reset added/committed flag on unmap + * backend/wayland: don't cache next item when destroying buffers + * output: don't attach buffer on first commit if disabled + * backend/wayland: allow superseding a previous commit + * backend/wayland: update output mode after commit is done + * render/gles2: default to highp if available + * build: bump version to 0.16.2 + * render/vulkan: use correct source offset in read_pixels + +------------------------------------------------------------------- Old: ---- wlroots-0.16.1.tar.gz wlroots-0.16.1.tar.gz.sig New: ---- wlroots-0.16.2.tar.gz wlroots-0.16.2.tar.gz.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ wlroots.spec ++++++ --- /var/tmp/diff_new_pack.HHehxn/_old 2023-02-11 21:58:24.008024752 +0100 +++ /var/tmp/diff_new_pack.HHehxn/_new 2023-02-11 21:58:24.016024802 +0100 @@ -1,7 +1,7 @@ # # spec file for package wlroots # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,7 +24,7 @@ %bcond_without xcb_errors Name: wlroots -Version: 0.16.1 +Version: 0.16.2 Release: 0 Summary: Modular Wayland compositor library License: MIT ++++++ wlroots-0.16.1.tar.gz -> wlroots-0.16.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlroots-0.16.1/backend/drm/atomic.c new/wlroots-0.16.2/backend/drm/atomic.c --- old/wlroots-0.16.1/backend/drm/atomic.c 2022-12-25 16:50:12.000000000 +0100 +++ new/wlroots-0.16.2/backend/drm/atomic.c 2023-02-10 23:29:59.000000000 +0100 @@ -1,4 +1,5 @@ #define _POSIX_C_SOURCE 200809L +#include <drm_fourcc.h> #include <stdlib.h> #include <stdio.h> #include <wlr/util/log.h> @@ -142,6 +143,44 @@ return true; } +static uint64_t max_bpc_for_format(uint32_t format) { + switch (format) { + case DRM_FORMAT_XRGB2101010: + case DRM_FORMAT_ARGB2101010: + case DRM_FORMAT_XBGR2101010: + case DRM_FORMAT_ABGR2101010: + return 10; + case DRM_FORMAT_XBGR16161616F: + case DRM_FORMAT_ABGR16161616F: + case DRM_FORMAT_XBGR16161616: + case DRM_FORMAT_ABGR16161616: + return 16; + default: + return 8; + } +} + +static uint64_t pick_max_bpc(struct wlr_drm_connector *conn, struct wlr_drm_fb *fb) { + if (fb == NULL) { + return 0; + } + + uint32_t format = DRM_FORMAT_INVALID; + struct wlr_dmabuf_attributes attribs = {0}; + if (wlr_buffer_get_dmabuf(fb->wlr_buf, &attribs)) { + format = attribs.format; + } + + uint64_t target_bpc = max_bpc_for_format(format); + if (target_bpc < conn->max_bpc_bounds[0]) { + target_bpc = conn->max_bpc_bounds[0]; + } + if (target_bpc > conn->max_bpc_bounds[1]) { + target_bpc = conn->max_bpc_bounds[1]; + } + return target_bpc; +} + static void commit_blob(struct wlr_drm_backend *drm, uint32_t *current, uint32_t next) { if (*current == next) { @@ -286,8 +325,8 @@ atomic_add(&atom, conn->id, conn->props.content_type, DRM_MODE_CONTENT_TYPE_GRAPHICS); } - if (modeset && active && conn->props.max_bpc != 0 && conn->max_bpc > 0) { - atomic_add(&atom, conn->id, conn->props.max_bpc, conn->max_bpc); + if (modeset && active && conn->props.max_bpc != 0 && conn->max_bpc_bounds[1] != 0) { + atomic_add(&atom, conn->id, conn->props.max_bpc, pick_max_bpc(conn, plane_get_next_fb(crtc->primary))); } atomic_add(&atom, crtc->id, crtc->props.mode_id, mode_id); atomic_add(&atom, crtc->id, crtc->props.active, active); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlroots-0.16.1/backend/drm/backend.c new/wlroots-0.16.2/backend/drm/backend.c --- old/wlroots-0.16.1/backend/drm/backend.c 2022-12-25 16:50:12.000000000 +0100 +++ new/wlroots-0.16.2/backend/drm/backend.c 2023-02-10 23:29:59.000000000 +0100 @@ -103,6 +103,21 @@ wlr_log(WLR_INFO, "DRM fd resumed"); scan_drm_connectors(drm, NULL); + // The previous DRM master leaves KMS in an undefined state. We need + // to restore out own state, but be careful to avoid invalid + // configurations. The connector/CRTC mapping may have changed, so + // first disable all CRTCs, then light up the ones we were using + // before the VT switch. + // TODO: use the atomic API to improve restoration after a VT switch + for (size_t i = 0; i < drm->num_crtcs; i++) { + struct wlr_drm_crtc *crtc = &drm->crtcs[i]; + + if (drmModeSetCrtc(drm->fd, crtc->id, 0, 0, 0, NULL, 0, NULL) != 0) { + wlr_log_errno(WLR_ERROR, "Failed to disable CRTC %"PRIu32" after VT switch", + crtc->id); + } + } + struct wlr_drm_connector *conn; wl_list_for_each(conn, &drm->outputs, link) { struct wlr_output_mode *mode = NULL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlroots-0.16.1/backend/drm/drm.c new/wlroots-0.16.2/backend/drm/drm.c --- old/wlroots-0.16.1/backend/drm/drm.c 2022-12-25 16:50:12.000000000 +0100 +++ new/wlroots-0.16.2/backend/drm/drm.c 2023-02-10 23:29:59.000000000 +0100 @@ -1242,10 +1242,10 @@ wlr_conn->output.non_desktop = non_desktop; } - wlr_conn->max_bpc = 0; + memset(wlr_conn->max_bpc_bounds, 0, sizeof(wlr_conn->max_bpc_bounds)); if (wlr_conn->props.max_bpc != 0) { if (!introspect_drm_prop_range(drm->fd, wlr_conn->props.max_bpc, - NULL, &wlr_conn->max_bpc)) { + &wlr_conn->max_bpc_bounds[0], &wlr_conn->max_bpc_bounds[1])) { wlr_log(WLR_ERROR, "Failed to introspect 'max bpc' property"); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlroots-0.16.1/backend/wayland/backend.c new/wlroots-0.16.2/backend/wayland/backend.c --- old/wlroots-0.16.1/backend/wayland/backend.c 2022-12-25 16:50:12.000000000 +0100 +++ new/wlroots-0.16.2/backend/wayland/backend.c 2023-02-10 23:29:59.000000000 +0100 @@ -451,8 +451,10 @@ wlr_output_destroy(&output->wlr_output); } - struct wlr_wl_buffer *buffer, *tmp_buffer; - wl_list_for_each_safe(buffer, tmp_buffer, &wl->buffers, link) { + // Avoid using wl_list_for_each_safe() here: destroying a buffer may + // have the side-effect of destroying the next one in the list + while (!wl_list_empty(&wl->buffers)) { + struct wlr_wl_buffer *buffer = wl_container_of(wl->buffers.next, buffer, link); destroy_wl_buffer(buffer); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlroots-0.16.1/backend/wayland/output.c new/wlroots-0.16.2/backend/wayland/output.c --- old/wlroots-0.16.1/backend/wayland/output.c 2022-12-25 16:50:12.000000000 +0100 +++ new/wlroots-0.16.2/backend/wayland/output.c 2023-02-10 23:29:59.000000000 +0100 @@ -43,7 +43,12 @@ static void surface_frame_callback(void *data, struct wl_callback *cb, uint32_t time) { struct wlr_wl_output *output = data; - assert(output); + + if (cb == NULL) { + return; + } + + assert(output->frame_callback == cb); wl_callback_destroy(cb); output->frame_callback = NULL; @@ -282,11 +287,6 @@ return false; } - if (state->committed & WLR_OUTPUT_STATE_MODE) { - wlr_output_update_custom_mode(wlr_output, - state->custom_mode.width, state->custom_mode.height, 0); - } - if (state->committed & WLR_OUTPUT_STATE_BUFFER) { struct wp_presentation_feedback *wp_feedback = NULL; if (output->backend->presentation != NULL) { @@ -300,10 +300,8 @@ } if (output->frame_callback != NULL) { - wlr_log(WLR_ERROR, "Skipping buffer swap"); - return false; + wl_callback_destroy(output->frame_callback); } - output->frame_callback = wl_surface_frame(output->surface); wl_callback_add_listener(output->frame_callback, &frame_listener, output); @@ -357,6 +355,11 @@ wl_display_flush(output->backend->remote_display); + if (state->committed & WLR_OUTPUT_STATE_MODE) { + wlr_output_update_custom_mode(wlr_output, + state->custom_mode.width, state->custom_mode.height, 0); + } + return true; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlroots-0.16.1/backend/x11/input_device.c new/wlroots-0.16.2/backend/x11/input_device.c --- old/wlroots-0.16.1/backend/x11/input_device.c 2022-12-25 16:50:12.000000000 +0100 +++ new/wlroots-0.16.2/backend/x11/input_device.c 2023-02-10 23:29:59.000000000 +0100 @@ -47,9 +47,9 @@ .time_msec = time, .source = WLR_AXIS_SOURCE_WHEEL, .orientation = WLR_AXIS_ORIENTATION_VERTICAL, - // 15 is a typical value libinput sends for one scroll + // Most mice use a 15 degree angle per scroll click .delta = delta * 15, - .delta_discrete = delta, + .delta_discrete = delta * WLR_POINTER_AXIS_DISCRETE_STEP, }; wl_signal_emit_mutable(&output->pointer.events.axis, &ev); wl_signal_emit_mutable(&output->pointer.events.frame, &output->pointer); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlroots-0.16.1/backend/x11/output.c new/wlroots-0.16.2/backend/x11/output.c --- old/wlroots-0.16.1/backend/x11/output.c 2022-12-25 16:50:12.000000000 +0100 +++ new/wlroots-0.16.2/backend/x11/output.c 2023-02-10 23:29:59.000000000 +0100 @@ -250,6 +250,7 @@ return NULL; } buffer->buffer = wlr_buffer_lock(wlr_buffer); + buffer->n_busy = 1; buffer->pixmap = pixmap; buffer->x11 = x11; wl_list_insert(&output->buffers, &buffer->link); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlroots-0.16.1/include/backend/drm/drm.h new/wlroots-0.16.2/include/backend/drm/drm.h --- old/wlroots-0.16.1/include/backend/drm/drm.h 2022-12-25 16:50:12.000000000 +0100 +++ new/wlroots-0.16.2/include/backend/drm/drm.h 2023-02-10 23:29:59.000000000 +0100 @@ -108,7 +108,7 @@ char name[24]; drmModeConnection status; uint32_t id; - uint64_t max_bpc; + uint64_t max_bpc_bounds[2]; struct wlr_drm_lease *lease; struct wlr_drm_crtc *crtc; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlroots-0.16.1/include/xcursor/cursor_data.h new/wlroots-0.16.2/include/xcursor/cursor_data.h --- old/wlroots-0.16.1/include/xcursor/cursor_data.h 2022-12-25 16:50:12.000000000 +0100 +++ new/wlroots-0.16.2/include/xcursor/cursor_data.h 2023-02-10 23:29:59.000000000 +0100 @@ -551,4 +551,19 @@ { "xterm", 9, 16, 4, 8, 2400 }, { "hand1", 13, 16, 12, 0, 2544 }, { "watch", 16, 16, 15, 9, 2752 }, + + /* https://www.freedesktop.org/wiki/Specifications/cursor-spec/ */ + { "sw-resize", 16, 16, 1, 14, 0 }, + { "se-resize", 16, 16, 14, 14, 256 }, + { "s-resize", 15, 16, 7, 14, 512 }, + { "all-scroll", 16, 16, 8, 8, 752 }, + { "default", 10, 16, 1, 1, 1008 }, + { "w-resize", 16, 15, 1, 7, 1168 }, + { "e-resize", 16, 15, 14, 7, 1408 }, + { "nw-resize", 16, 16, 1, 1, 1648 }, + { "ne-resize", 16, 16, 14, 1, 1904 }, + { "n-resize", 15, 16, 7, 1, 2160 }, + { "text", 9, 16, 4, 8, 2400 }, + { "pointer", 13, 16, 12, 0, 2544 }, + { "wait", 16, 16, 15, 9, 2752 }, }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlroots-0.16.1/meson.build new/wlroots-0.16.2/meson.build --- old/wlroots-0.16.1/meson.build 2022-12-25 16:50:12.000000000 +0100 +++ new/wlroots-0.16.2/meson.build 2023-02-10 23:29:59.000000000 +0100 @@ -1,7 +1,7 @@ project( 'wlroots', 'c', - version: '0.16.1', + version: '0.16.2', license: 'MIT', meson_version: '>=0.59.0', default_options: [ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlroots-0.16.1/render/gles2/shaders/quad.frag new/wlroots-0.16.2/render/gles2/shaders/quad.frag --- old/wlroots-0.16.1/render/gles2/shaders/quad.frag 2022-12-25 16:50:12.000000000 +0100 +++ new/wlroots-0.16.2/render/gles2/shaders/quad.frag 2023-02-10 23:29:59.000000000 +0100 @@ -1,4 +1,9 @@ +#ifdef GL_FRAGMENT_PRECISION_HIGH +precision highp float; +#else precision mediump float; +#endif + varying vec4 v_color; varying vec2 v_texcoord; uniform vec4 color; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlroots-0.16.1/render/gles2/shaders/tex_external.frag new/wlroots-0.16.2/render/gles2/shaders/tex_external.frag --- old/wlroots-0.16.1/render/gles2/shaders/tex_external.frag 2022-12-25 16:50:12.000000000 +0100 +++ new/wlroots-0.16.2/render/gles2/shaders/tex_external.frag 2023-02-10 23:29:59.000000000 +0100 @@ -1,6 +1,11 @@ #extension GL_OES_EGL_image_external : require +#ifdef GL_FRAGMENT_PRECISION_HIGH +precision highp float; +#else precision mediump float; +#endif + varying vec2 v_texcoord; uniform samplerExternalOES texture0; uniform float alpha; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlroots-0.16.1/render/gles2/shaders/tex_rgba.frag new/wlroots-0.16.2/render/gles2/shaders/tex_rgba.frag --- old/wlroots-0.16.1/render/gles2/shaders/tex_rgba.frag 2022-12-25 16:50:12.000000000 +0100 +++ new/wlroots-0.16.2/render/gles2/shaders/tex_rgba.frag 2023-02-10 23:29:59.000000000 +0100 @@ -1,4 +1,9 @@ +#ifdef GL_FRAGMENT_PRECISION_HIGH +precision highp float; +#else precision mediump float; +#endif + varying vec2 v_texcoord; uniform sampler2D tex; uniform float alpha; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlroots-0.16.1/render/gles2/shaders/tex_rgbx.frag new/wlroots-0.16.2/render/gles2/shaders/tex_rgbx.frag --- old/wlroots-0.16.1/render/gles2/shaders/tex_rgbx.frag 2022-12-25 16:50:12.000000000 +0100 +++ new/wlroots-0.16.2/render/gles2/shaders/tex_rgbx.frag 2023-02-10 23:29:59.000000000 +0100 @@ -1,4 +1,9 @@ +#ifdef GL_FRAGMENT_PRECISION_HIGH +precision highp float; +#else precision mediump float; +#endif + varying vec2 v_texcoord; uniform sampler2D tex; uniform float alpha; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlroots-0.16.1/render/vulkan/renderer.c new/wlroots-0.16.2/render/vulkan/renderer.c --- old/wlroots-0.16.1/render/vulkan/renderer.c 2022-12-25 16:50:12.000000000 +0100 +++ new/wlroots-0.16.2/render/vulkan/renderer.c 2023-02-10 23:29:59.000000000 +0100 @@ -822,6 +822,10 @@ struct wlr_vk_renderer *renderer = vulkan_get_renderer(wlr_renderer); VkCommandBuffer cb = renderer->cb; + if (renderer->scissor.extent.width == 0 || renderer->scissor.extent.height == 0) { + return; + } + VkClearAttachment att = { .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT, .colorAttachment = 0u, @@ -1123,11 +1127,6 @@ VK_ACCESS_TRANSFER_READ_BIT); if (blit_supported) { - VkOffset3D blit_size = { - .x = width, - .y = height, - .z = 1 - }; VkImageBlit image_blit_region = { .srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT, .srcSubresource.layerCount = 1, @@ -1135,10 +1134,17 @@ .x = src_x, .y = src_y, }, - .srcOffsets[1] = blit_size, + .srcOffsets[1] = { + .x = src_x + width, + .y = src_y + height, + }, .dstSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT, .dstSubresource.layerCount = 1, - .dstOffsets[1] = blit_size + .dstOffsets[1] = { + .x = width, + .y = height, + .z = 1, + } }; vkCmdBlitImage(cb, src_image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, dst_image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlroots-0.16.1/types/output/render.c new/wlroots-0.16.2/types/output/render.c --- old/wlroots-0.16.1/types/output/render.c 2022-12-25 16:50:12.000000000 +0100 +++ new/wlroots-0.16.2/types/output/render.c 2023-02-10 23:29:59.000000000 +0100 @@ -199,6 +199,11 @@ return true; } + bool enabled = output->enabled; + if (state->committed & WLR_OUTPUT_STATE_ENABLED) { + enabled = state->enabled; + } + // If we're lighting up an output or changing its mode, make sure to // provide a new buffer bool needs_new_buffer = false; @@ -211,7 +216,7 @@ if (state->committed & WLR_OUTPUT_STATE_RENDER_FORMAT) { needs_new_buffer = true; } - if (state->allow_artifacts && output->commit_seq == 0) { + if (state->allow_artifacts && output->commit_seq == 0 && enabled) { // On first commit, require a new buffer if the compositor called a // mode-setting function, even if the mode won't change. This makes it // so the swapchain is created now. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlroots-0.16.1/types/wlr_xdg_activation_v1.c new/wlroots-0.16.2/types/wlr_xdg_activation_v1.c --- old/wlroots-0.16.1/types/wlr_xdg_activation_v1.c 2022-12-25 16:50:12.000000000 +0100 +++ new/wlroots-0.16.2/types/wlr_xdg_activation_v1.c 2023-02-10 23:29:59.000000000 +0100 @@ -115,9 +115,10 @@ } if (token->surface != NULL && - token->surface != token->seat->keyboard_state.focused_surface) { + token->surface != token->seat->keyboard_state.focused_surface && + token->surface != token->seat->pointer_state.focused_surface) { wlr_log(WLR_DEBUG, "Rejecting token commit request: " - "surface doesn't have keyboard focus"); + "surface doesn't have focus"); goto error; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlroots-0.16.1/types/xdg_shell/wlr_xdg_popup.c new/wlroots-0.16.2/types/xdg_shell/wlr_xdg_popup.c --- old/wlroots-0.16.1/types/xdg_shell/wlr_xdg_popup.c 2022-12-25 16:50:12.000000000 +0100 +++ new/wlroots-0.16.2/types/xdg_shell/wlr_xdg_popup.c 2023-02-10 23:29:59.000000000 +0100 @@ -449,6 +449,8 @@ popup->seat = NULL; } + + popup->committed = false; } void destroy_xdg_popup(struct wlr_xdg_popup *popup) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlroots-0.16.1/types/xdg_shell/wlr_xdg_toplevel.c new/wlroots-0.16.2/types/xdg_shell/wlr_xdg_toplevel.c --- old/wlroots-0.16.1/types/xdg_shell/wlr_xdg_toplevel.c 2022-12-25 16:50:12.000000000 +0100 +++ new/wlroots-0.16.2/types/xdg_shell/wlr_xdg_toplevel.c 2023-02-10 23:29:59.000000000 +0100 @@ -521,6 +521,8 @@ toplevel->requested.fullscreen = false; toplevel->requested.maximized = false; toplevel->requested.minimized = false; + + toplevel->added = false; } void destroy_xdg_toplevel(struct wlr_xdg_toplevel *toplevel) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wlroots-0.16.1/xwayland/xwm.c new/wlroots-0.16.2/xwayland/xwm.c --- old/wlroots-0.16.1/xwayland/xwm.c 2022-12-25 16:50:12.000000000 +0100 +++ new/wlroots-0.16.2/xwayland/xwm.c 2023-02-10 23:29:59.000000000 +0100 @@ -384,11 +384,30 @@ i, property); } +static void xsurface_unpair(struct wlr_xwayland_surface *surface, + bool destroy_role_object) { + if (surface->mapped) { + wl_signal_emit_mutable(&surface->events.unmap, surface); + surface->mapped = false; + xwm_set_net_client_list(surface->xwm); + } + + // Make sure we're not on the unpaired surface list or we + // could be assigned a surface during surface creation that + // was mapped before this unmap request. + wl_list_remove(&surface->unpaired_link); + wl_list_init(&surface->unpaired_link); + surface->surface_id = 0; + + if (destroy_role_object && surface->surface != NULL) { + wlr_surface_destroy_role_object(surface->surface); + } + surface->surface = NULL; +} + static void xwayland_surface_destroy( struct wlr_xwayland_surface *xsurface) { - if (xsurface->surface != NULL) { - wlr_surface_destroy_role_object(xsurface->surface); - } + xsurface_unpair(xsurface, true); wl_signal_emit_mutable(&xsurface->events.destroy, xsurface); @@ -851,19 +870,7 @@ assert(wlr_surface->role == &xwayland_surface_role); struct wlr_xwayland_surface *surface = wlr_surface->role_data; - if (surface->mapped) { - wl_signal_emit_mutable(&surface->events.unmap, surface); - surface->mapped = false; - xwm_set_net_client_list(surface->xwm); - } - - // Make sure we're not on the unpaired surface list or we - // could be assigned a surface during surface creation that - // was mapped before this unmap request. - wl_list_remove(&surface->unpaired_link); - wl_list_init(&surface->unpaired_link); - surface->surface_id = 0; - surface->surface = NULL; + xsurface_unpair(surface, false); } static const struct wlr_surface_role xwayland_surface_role = { @@ -1077,10 +1084,7 @@ return; } - if (xsurface->surface != NULL) { - wlr_surface_destroy_role_object(xsurface->surface); - } - + xsurface_unpair(xsurface, true); xsurface_set_wm_state(xsurface, XCB_ICCCM_WM_STATE_WITHDRAWN); }