YaLTeR/niri

Damage for sticky windows is not computed correctly

phuhl opened this issue · 11 comments

Sticky windows with transparent parts have the wrong background when switching windows below them. Could not take a screenshot of it, hat to take a foto. Upper notification was produced on a dark background, then I moved focus to emacs (white background). Second notification was produced directly on bright background. Note how the corners of the first are dark, but should be white.

damage

System Information

niri version: niri 0.1.3 (v0.1.3-31-g4740682)

GPU: Intel® Iris® Xe Graphics

CPU: 13th Gen Intel® Core™ i7-1360P (18 MB cache, 12 cores, up to 5.00 GHz Turbo)
https://wiki.archlinux.org/title/Dell_XPS_13_Plus_(9320)

The window is a GTK window. Here is the glade file, that produced it: https://github.com/phuhl/linux_notification_center/blob/feature/wayland/notification.glade

Here is some haskell code that configures the window:

when (layerShellSupported && not isLayered) $ do
    LayerShell.initForWindow mainWindow
    LayerShell.setLayer mainWindow LayerOverlay
    LayerShell.autoExclusiveZoneEnable mainWindow
    LayerShell.setExclusiveZone mainWindow 0
    LayerShell.setNamespace mainWindow "deadd-notification-center"

if layerShellSupported then do
    LayerShell.setMonitor mainWindow monitor
    LayerShell.setMargin mainWindow EdgeRight
      (fromIntegral distanceRight)
    LayerShell.setMargin mainWindow EdgeTop hBefore
    LayerShell.setAnchor mainWindow EdgeRight True
    LayerShell.setAnchor mainWindow EdgeTop True
    else
    windowMove mainWindow
      (screenW - fromIntegral
       (configWidthNoti config + distanceRight))
      hBefore

Hope that helps.

Weird because I use a semitransparent mako for notifications, which also uses layer-shell, and it seems to work fine so far.

That could be caused by wrongly set opaque regions by the client. Can you provide a WAYLAND_DEBUG log of the client?

How would I obtain those?

How would I obtain those?

libwayland has an integrated debug output which can be enabled by setting the WAYLAND_DEBUG environment variable. Running a client with WAYLAND_DEBUG=1 or WAYLAND_DEBUG=client should print out all requests sent to the compositor and events received from the compositor. For example WAYLAND_DEBUG=client weston-terminal would produce an output similar to this:

~ WAYLAND_DEBUG=client weston-terminal
[ 875915.992]  -> wl_display@1.get_registry(new id wl_registry@2)
[ 875916.006]  -> wl_display@1.sync(new id wl_callback@3)
[ 875916.319] wl_display@1.delete_id(3)
[ 875916.337] wl_registry@2.global(1, "wl_compositor", 6)
[ 875916.343]  -> wl_registry@2.bind(1, "wl_compositor", 3, new id [unknown]@4)
[ 875916.347] wl_registry@2.global(2, "wl_subcompositor", 1)
[ 875916.350]  -> wl_registry@2.bind(2, "wl_subcompositor", 1, new id [unknown]@5)
[ 875916.354] wl_registry@2.global(3, "xdg_wm_base", 6)
[ 875916.357]  -> wl_registry@2.bind(3, "xdg_wm_base", 5, new id [unknown]@6)
[ 875916.360] wl_registry@2.global(6, "zwlr_layer_shell_v1", 4)
[ 875916.363] wl_registry@2.global(7, "ext_session_lock_manager_v1", 1)
[ 875916.365] wl_registry@2.global(8, "wl_shm", 1)
[ 875916.368]  -> wl_registry@2.bind(8, "wl_shm", 1, new id [unknown]@7)
[ 875916.371] wl_registry@2.global(9, "zxdg_output_manager_v1", 3)
[ 875916.374] wl_registry@2.global(10, "zwp_tablet_manager_v2", 1)
[ 875916.380]  -> wl_registry@2.bind(10, "zwp_tablet_manager_v2", 1, new id [unknown]@8)
[ 875916.383] wl_registry@2.global(11, "zwp_pointer_gestures_v1", 3)
[ 875916.386] wl_registry@2.global(12, "zwp_relative_pointer_manager_v1", 1)
[ 875916.389]  -> wl_registry@2.bind(12, "zwp_relative_pointer_manager_v1", 1, new id [unknown]@9)
[ 875916.392] wl_registry@2.global(13, "zwp_pointer_constraints_v1", 1)
[ 875916.395]  -> wl_registry@2.bind(13, "zwp_pointer_constraints_v1", 1, new id [unknown]@10)
[ 875916.398] wl_registry@2.global(14, "ext_idle_notifier_v1", 1)
[ 875916.401] wl_registry@2.global(15, "zwp_idle_inhibit_manager_v1", 1)
[ 875916.404] wl_registry@2.global(16, "wl_data_device_manager", 3)
[ 875916.407]  -> wl_registry@2.bind(16, "wl_data_device_manager", 3, new id [unknown]@11)
[ 875916.410] wl_registry@2.global(17, "zwp_primary_selection_device_manager_v1", 1)
[ 875916.413] wl_registry@2.global(18, "zwlr_data_control_manager_v1", 2)
[ 875916.419] wl_registry@2.global(19, "wp_presentation", 1)
[ 875916.422] wl_registry@2.global(20, "wp_security_context_manager_v1", 1)
[ 875916.424] wl_registry@2.global(21, "zwp_text_input_manager_v3", 1)
[ 875916.427] wl_registry@2.global(22, "zwp_input_method_manager_v2", 1)
[ 875916.429] wl_registry@2.global(23, "zwp_virtual_keyboard_manager_v1", 1)
[ 875916.432] wl_registry@2.global(24, "zwlr_foreign_toplevel_manager_v1", 3)
[ 875916.434] wl_registry@2.global(25, "zwlr_screencopy_manager_v1", 1)
[ 875916.437] wl_registry@2.global(26, "wp_viewporter", 1)
[ 875916.440]  -> wl_registry@2.bind(26, "wp_viewporter", 1, new id [unknown]@12)
[ 875916.444] wl_registry@2.global(27, "zxdg_exporter_v2", 1)
[ 875916.452] wl_registry@2.global(28, "zxdg_importer_v2", 1)

Got it. Sorry for the delay.

$ WAYLAND_DEBUG=client deadd-notification-center
[3118067.495]  -> wl_display@1.get_registry(new id wl_registry@2)
[3118067.506]  -> wl_display@1.sync(new id wl_callback@3)
[3118067.741] wl_display@1.delete_id(3)
[3118067.758] wl_registry@2.global(1, "wl_compositor", 6)
[3118067.763]  -> wl_registry@2.bind(1, "wl_compositor", 3, new id [unknown]@4)
[3118067.769] wl_registry@2.global(2, "wl_subcompositor", 1)
[3118067.773]  -> wl_registry@2.bind(2, "wl_subcompositor", 1, new id [unknown]@5)
[3118067.776] wl_registry@2.global(3, "xdg_wm_base", 6)
[3118067.779] wl_registry@2.global(4, "zxdg_decoration_manager_v1", 1)
[3118067.785] wl_registry@2.global(5, "org_kde_kwin_server_decoration_manager", 1)
[3118067.788]  -> wl_registry@2.bind(5, "org_kde_kwin_server_decoration_manager", 1, new id [unknown]@6)
[3118067.791] wl_registry@2.global(6, "zwlr_layer_shell_v1", 4)
[3118067.794] wl_registry@2.global(7, "ext_session_lock_manager_v1", 1)
[3118067.797] wl_registry@2.global(8, "wl_shm", 1)
[3118067.799]  -> wl_registry@2.bind(8, "wl_shm", 1, new id [unknown]@7)
[3118067.804] wl_registry@2.global(9, "zxdg_output_manager_v1", 3)
[3118067.807]  -> wl_registry@2.bind(9, "zxdg_output_manager_v1", 3, new id [unknown]@8)
[3118067.811]  -> wl_display@1.sync(new id wl_callback@9)
[3118067.814] wl_registry@2.global(10, "zwp_tablet_manager_v2", 1)
[3118067.817]  -> wl_registry@2.bind(10, "zwp_tablet_manager_v2", 1, new id [unknown]@10)
[3118067.822] wl_registry@2.global(11, "zwp_pointer_gestures_v1", 3)
[3118067.824]  -> wl_registry@2.bind(11, "zwp_pointer_gestures_v1", 1, new id [unknown]@11)
[3118067.827] wl_registry@2.global(12, "zwp_relative_pointer_manager_v1", 1)
[3118067.830] wl_registry@2.global(13, "zwp_pointer_constraints_v1", 1)
[3118067.833] wl_registry@2.global(14, "ext_idle_notifier_v1", 1)
[3118067.835] wl_registry@2.global(15, "zwp_idle_inhibit_manager_v1", 1)
[3118067.838] wl_registry@2.global(16, "wl_data_device_manager", 3)
[3118067.842]  -> wl_registry@2.bind(16, "wl_data_device_manager", 3, new id [unknown]@12)
[3118067.846] wl_registry@2.global(17, "zwp_primary_selection_device_manager_v1", 1)
[3118067.849]  -> wl_registry@2.bind(17, "zwp_primary_selection_device_manager_v1", 1, new id [unknown]@13)
[3118067.852] wl_registry@2.global(18, "zwlr_data_control_manager_v1", 2)
[3118067.855] wl_registry@2.global(19, "wp_presentation", 1)
[3118067.858] wl_registry@2.global(20, "wp_security_context_manager_v1", 1)
[3118067.860] wl_registry@2.global(21, "zwp_text_input_manager_v3", 1)
[3118067.863] wl_registry@2.global(22, "zwp_input_method_manager_v2", 1)
[3118067.866] wl_registry@2.global(23, "zwp_virtual_keyboard_manager_v1", 1)
[3118067.869] wl_registry@2.global(24, "zwlr_foreign_toplevel_manager_v1", 3)
[3118067.871] wl_registry@2.global(25, "zwlr_screencopy_manager_v1", 1)
[3118067.874] wl_registry@2.global(26, "wp_viewporter", 1)
[3118067.877] wl_registry@2.global(27, "zxdg_exporter_v2", 1)
[3118067.880] wl_registry@2.global(28, "zxdg_importer_v2", 1)
[3118067.883] wl_registry@2.global(29, "zwlr_gamma_control_manager_v1", 1)
[3118067.886] wl_registry@2.global(30, "wl_seat", 9)
[3118067.889] wl_registry@2.global(31, "wp_cursor_shape_manager_v1", 1)
[3118067.893] wl_registry@2.global(32, "wp_drm_lease_device_v1", 1)
[3118067.896] wl_registry@2.global(33, "wl_drm", 2)
[3118067.899] wl_registry@2.global(34, "zwp_linux_dmabuf_v1", 5)
[3118067.901] wl_registry@2.global(35, "wl_output", 4)
[3118067.904]  -> wl_registry@2.bind(35, "wl_output", 2, new id [unknown]@14)
[3118067.940]  -> zxdg_output_manager_v1@8.get_xdg_output(new id zxdg_output_v1@15, wl_output@14)
[3118067.944]  -> wl_display@1.sync(new id wl_callback@16)
[3118067.946] wl_registry@2.global(36, "wl_output", 4)
[3118067.949]  -> wl_registry@2.bind(36, "wl_output", 2, new id [unknown]@17)
[3118067.953]  -> zxdg_output_manager_v1@8.get_xdg_output(new id zxdg_output_v1@18, wl_output@17)
[3118067.957]  -> wl_display@1.sync(new id wl_callback@19)
[3118067.960] wl_registry@2.global(37, "wl_output", 4)
[3118067.963]  -> wl_registry@2.bind(37, "wl_output", 2, new id [unknown]@20)
[3118067.966]  -> zxdg_output_manager_v1@8.get_xdg_output(new id zxdg_output_v1@21, wl_output@20)
[3118067.969]  -> wl_display@1.sync(new id wl_callback@22)
[3118067.971] wl_callback@3.done(0)
[3118068.016]  -> wl_shm@7.create_pool(new id wl_shm_pool@3, fd 79, 2304)
[3118068.108]  -> wl_shm_pool@3.resize(8704)
[3118068.175]  -> wl_shm_pool@3.resize(21504)
[3118068.278]  -> wl_shm_pool@3.resize(47104)
[3118068.417]  -> wl_shm_pool@3.resize(98304)
[3118068.711]  -> wl_shm_pool@3.resize(200704)
[3118069.401]  -> wl_shm_pool@3.resize(405504)
[3118070.587]  -> wl_shm_pool@3.resize(815104)
[3118072.548]  -> wl_shm_pool@3.resize(1634304)
[3118079.788]  -> wl_registry@2.bind(30, "wl_seat", 5, new id [unknown]@23)
[3118081.380]  -> wl_compositor@4.create_surface(new id wl_surface@24)
[3118081.389]  -> zwp_primary_selection_device_manager_v1@13.get_device(new id zwp_primary_selection_device_v1@25, wl_seat@23)
[3118081.391]  -> wl_data_device_manager@12.get_data_device(new id wl_data_device@26, wl_seat@23)
[3118081.435]  -> wl_compositor@4.create_surface(new id wl_surface@27)
[3118081.437]  -> zwp_tablet_manager_v2@10.get_tablet_seat(new id zwp_tablet_seat_v2@28, wl_seat@23)
[3118081.440]  -> wl_display@1.sync(new id wl_callback@29)
[3118081.911] wl_display@1.delete_id(9)
[3118081.919] wl_display@1.delete_id(16)
[3118081.922] wl_display@1.delete_id(19)
[3118081.924] wl_display@1.delete_id(22)
[3118081.925] wl_display@1.delete_id(29)
[3118081.927] org_kde_kwin_server_decoration_manager@6.default_mode(2)
[3118081.931] wl_shm@7.format(0)
[3118081.933] wl_shm@7.format(1)
[3118081.934] wl_callback@9.done(0)
[3118081.937] wl_output@14.geometry(5120, 0, 290, 180, 0, "Unknown", "Unknown", 0)
[3118081.944] wl_output@14.mode(3, 3840, 2400, 59994)
[3118081.947] wl_output@14.scale(2)
[3118081.950] wl_output@14.done()
[3118081.963] zxdg_output_v1@15.logical_position(5120, 0)
[3118081.966] zxdg_output_v1@15.logical_size(1920, 1200)
[3118081.968] zxdg_output_v1@15.name("eDP-1")
[3118081.970] zxdg_output_v1@15.description("Unknown - Unknown - eDP-1")
[3118081.972] wl_output@14.done()
[3118081.976] wl_callback@16.done(0)
[3118081.979] wl_output@17.geometry(2560, 0, 600, 340, 0, "Unknown", "Unknown", 0)
[3118081.983] wl_output@17.mode(3, 2560, 1440, 59951)
[3118081.986] wl_output@17.scale(1)
[3118081.988] wl_output@17.done()
[3118081.992] zxdg_output_v1@18.logical_position(2560, 0)
[3118081.994] zxdg_output_v1@18.logical_size(2560, 1440)
[3118081.996] zxdg_output_v1@18.name("DP-6")
[3118081.998] zxdg_output_v1@18.description("Unknown - Unknown - DP-6")
[3118081.999] wl_output@17.done()
[3118082.003] wl_callback@19.done(0)
[3118082.005] wl_output@20.geometry(0, 0, 600, 340, 0, "Unknown", "Unknown", 0)
[3118082.010] wl_output@20.mode(3, 2560, 1440, 59951)
[3118082.013] wl_output@20.scale(1)
[3118082.016] wl_output@20.done()
[3118082.019] zxdg_output_v1@21.logical_position(0, 0)
[3118082.021] zxdg_output_v1@21.logical_size(2560, 1440)
[3118082.023] zxdg_output_v1@21.name("DP-7")
[3118082.026] zxdg_output_v1@21.description("Unknown - Unknown - DP-7")
[3118082.029] wl_output@20.done()
[3118082.032] wl_callback@22.done(0)
[3118082.035] wl_seat@23.name("seat0")
[3118082.037] wl_seat@23.capabilities(7)
[3118082.041]  -> wl_seat@23.get_pointer(new id wl_pointer@22)
[3118082.051]  -> zwp_pointer_gestures_v1@11.get_swipe_gesture(new id zwp_pointer_gesture_swipe_v1@19, wl_pointer@22)
[3118082.055]  -> zwp_pointer_gestures_v1@11.get_pinch_gesture(new id zwp_pointer_gesture_pinch_v1@16, wl_pointer@22)
[3118082.060]  -> wl_seat@23.get_keyboard(new id wl_keyboard@9)
[3118082.067]  -> wl_seat@23.get_touch(new id wl_touch@30)
[3118082.077] wl_callback@29.done(0)
[3118082.081]  -> wl_registry@2.bind(3, "xdg_wm_base", 6, new id [unknown]@29)
notificationDaemon started
[3118101.862]  -> wl_display@1.get_registry(new id wl_registry@31)
[3118101.870]  -> wl_display@1.sync(new id wl_callback@32)
[3118102.461] wl_display@1.delete_id(32)
[3118102.469] wl_keyboard@9.keymap(1, fd 81, 66463)
[3118103.819] wl_keyboard@9.repeat_info(30, 200)
[3118103.823] wl_registry@31.global(1, "wl_compositor", 6)
[3118103.828] wl_registry@31.global(2, "wl_subcompositor", 1)
[3118103.829] wl_registry@31.global(3, "xdg_wm_base", 6)
[3118103.831]  -> wl_registry@31.bind(3, "xdg_wm_base", 2, new id [unknown]@33)
[3118103.833] wl_registry@31.global(4, "zxdg_decoration_manager_v1", 1)
[3118103.834] wl_registry@31.global(5, "org_kde_kwin_server_decoration_manager", 1)
[3118103.835] wl_registry@31.global(6, "zwlr_layer_shell_v1", 4)
[3118103.837]  -> wl_registry@31.bind(6, "zwlr_layer_shell_v1", 4, new id [unknown]@34)
[3118103.838] wl_registry@31.global(7, "ext_session_lock_manager_v1", 1)
[3118103.840] wl_registry@31.global(8, "wl_shm", 1)
[3118103.841] wl_registry@31.global(9, "zxdg_output_manager_v1", 3)
[3118103.842] wl_registry@31.global(10, "zwp_tablet_manager_v2", 1)
[3118103.843] wl_registry@31.global(11, "zwp_pointer_gestures_v1", 3)
[3118103.844] wl_registry@31.global(12, "zwp_relative_pointer_manager_v1", 1)
[3118103.845] wl_registry@31.global(13, "zwp_pointer_constraints_v1", 1)
[3118103.847] wl_registry@31.global(14, "ext_idle_notifier_v1", 1)
[3118103.848] wl_registry@31.global(15, "zwp_idle_inhibit_manager_v1", 1)
[3118103.849] wl_registry@31.global(16, "wl_data_device_manager", 3)
[3118103.850] wl_registry@31.global(17, "zwp_primary_selection_device_manager_v1", 1)
[3118103.851] wl_registry@31.global(18, "zwlr_data_control_manager_v1", 2)
[3118103.852] wl_registry@31.global(19, "wp_presentation", 1)
[3118103.853] wl_registry@31.global(20, "wp_security_context_manager_v1", 1)
[3118103.855] wl_registry@31.global(21, "zwp_text_input_manager_v3", 1)
[3118103.856] wl_registry@31.global(22, "zwp_input_method_manager_v2", 1)
[3118103.858] wl_registry@31.global(23, "zwp_virtual_keyboard_manager_v1", 1)
[3118103.860] wl_registry@31.global(24, "zwlr_foreign_toplevel_manager_v1", 3)
[3118103.862] wl_registry@31.global(25, "zwlr_screencopy_manager_v1", 1)
[3118103.863] wl_registry@31.global(26, "wp_viewporter", 1)
[3118103.865] wl_registry@31.global(27, "zxdg_exporter_v2", 1)
[3118103.866] wl_registry@31.global(28, "zxdg_importer_v2", 1)
[3118103.868] wl_registry@31.global(29, "zwlr_gamma_control_manager_v1", 1)
[3118103.869] wl_registry@31.global(30, "wl_seat", 9)
[3118103.872] wl_registry@31.global(31, "wp_cursor_shape_manager_v1", 1)
[3118103.873] wl_registry@31.global(32, "wp_drm_lease_device_v1", 1)
[3118103.875] wl_registry@31.global(33, "wl_drm", 2)
[3118103.877] wl_registry@31.global(34, "zwp_linux_dmabuf_v1", 5)
[3118103.878] wl_registry@31.global(35, "wl_output", 4)
[3118103.881] wl_registry@31.global(36, "wl_output", 4)
[3118103.882] wl_registry@31.global(37, "wl_output", 4)
[3118103.883] wl_callback@32.done(0)


[3120923.460]  -> wl_compositor@4.create_surface(new id wl_surface@32)
[3120923.558]  -> wl_surface@32.attach(nil, 0, 0)
[3120923.562]  -> zwlr_layer_shell_v1@34.get_layer_surface(new id zwlr_layer_surface_v1@35, wl_surface@32, wl_output@20, 3, "deadd-notification-center")
[3120923.566]  -> zwlr_layer_surface_v1@35.set_keyboard_interactivity(0)
[3120923.567]  -> zwlr_layer_surface_v1@35.set_exclusive_zone(0)
[3120923.568]  -> zwlr_layer_surface_v1@35.set_anchor(9)
[3120923.570]  -> zwlr_layer_surface_v1@35.set_margin(50, 50, 0, 0)
[3120923.571]  -> zwlr_layer_surface_v1@35.set_size(500, 86)
[3120923.573]  -> wl_surface@32.commit()
[3120923.575]  -> wl_display@1.sync(new id wl_callback@36)
[3120924.131] wl_display@1.delete_id(36)
[3120924.135] wl_surface@32.enter(wl_output@20)
[3120924.137]  -> wl_surface@32.set_buffer_scale(1)
[3120924.141] zwlr_layer_surface_v1@35.configure(187827, 500, 86)
[3120924.143]  -> zwlr_layer_surface_v1@35.ack_configure(187827)
[3120924.149] wl_callback@36.done(0)
[3120925.319]  -> wl_shm@7.create_pool(new id wl_shm_pool@36, fd 82, 172000)
[3120925.328]  -> wl_shm_pool@36.create_buffer(new id wl_buffer@37, 0, 500, 86, 2000, 0)
[3120925.956]  -> wl_surface@32.attach(wl_buffer@37, 0, 0)
[3120925.961]  -> wl_surface@32.set_buffer_scale(1)
[3120925.963]  -> wl_surface@32.damage(0, 0, 500, 86)
[3120925.965]  -> wl_compositor@4.create_region(new id wl_region@38)
[3120925.967]  -> wl_region@38.add(0, 0, 500, 86)
[3120925.968]  -> wl_surface@32.set_opaque_region(wl_region@38)
[3120925.970]  -> wl_region@38.destroy()
[3120925.972]  -> wl_surface@32.set_input_region(nil)
[3120925.978]  -> wl_surface@32.frame(new id wl_callback@39)
[3120925.982]  -> wl_surface@32.commit()
[3120939.029] wl_display@1.delete_id(38)
[3120939.035] wl_display@1.delete_id(39)
[3120939.036] wl_callback@39.done(10622574)
[3130928.471]  -> zwlr_layer_surface_v1@35.destroy()
[3130928.584]  -> wl_surface@32.destroy()
[3130931.200] discarded [unknown]@32.[event 1](0 fd, 12 byte)
[3130931.314] wl_display@1.delete_id(35)
[3130931.336] wl_display@1.delete_id(32)
[3130931.346] wl_buffer@37.release()
[3130931.365]  -> wl_buffer@37.destroy()
[3130931.376]  -> wl_shm_pool@36.destroy()

I added two empty lines before the creation of the effected window.

The new niri has a debug key binding to enable opaque region display. Could you check if this window is covered in blue? In that case the niri behavior is expected, and it would be likely a client bug.

This log seems to imply so as well:

[3120925.328]  -> wl_shm_pool@36.create_buffer(new id wl_buffer@37, 0, 500, 86, 2000, 0)
[3120925.956]  -> wl_surface@32.attach(wl_buffer@37, 0, 0)
[3120925.961]  -> wl_surface@32.set_buffer_scale(1)
[3120925.963]  -> wl_surface@32.damage(0, 0, 500, 86)
[3120925.965]  -> wl_compositor@4.create_region(new id wl_region@38)
[3120925.967]  -> wl_region@38.add(0, 0, 500, 86)
[3120925.968]  -> wl_surface@32.set_opaque_region(wl_region@38)

Everything seems to be green, including the window and it's corners. Not sure what that means...

That's toggle-debug-tint; could you try debug-toggle-opaque-regions instead?

Sorry, didn't read properly. Tried that, yes, the corners are indeed blue. Seems to be a client bug then. Thanks anyways!