sway/include/sway/layers.h
Lars-Ragnar A. Haugen 0356a020c1 layer-shell: handle popup reposition for unconstraining
Layer shell popups were missing a handler for the xdg_popup reposition
event. When a client (e.g. GTK4) creates a popup and then sends a
reposition request, wlroots resets the scheduled geometry back to the
positioner's original value. Without a reposition handler, the
unconstrained geometry computed on the initial commit was lost, causing
popups such as tooltips to render outside the screen viewport.

This was most visible with GTK4 layer shell apps (e.g. taskbars) where
tooltips would appear below the bottom edge of the screen instead of
being flipped/slid into the visible area.

Also switch the destroy listener from wlr_popup->base->events.destroy
to wlr_popup->events.destroy so that cleanup runs before wlroots
asserts that all popup signal listeners have been removed.

Fixes #8518
2026-02-28 22:56:37 +01:00

48 lines
1.1 KiB
C

#ifndef _SWAY_LAYERS_H
#define _SWAY_LAYERS_H
#include <stdbool.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_layer_shell_v1.h>
#include "sway/tree/view.h"
struct sway_layer_surface {
struct wl_listener map;
struct wl_listener unmap;
struct wl_listener surface_commit;
struct wl_listener node_destroy;
struct wl_listener new_popup;
bool mapped;
struct wlr_scene_tree *popups;
struct sway_popup_desc desc;
struct sway_output *output;
struct wl_list link; // sway_output.layer_surfaces
struct wlr_scene_layer_surface_v1 *scene;
struct wlr_scene_tree *tree;
struct wlr_layer_surface_v1 *layer_surface;
};
struct sway_layer_popup {
struct wlr_xdg_popup *wlr_popup;
struct wlr_scene_tree *scene;
struct sway_layer_surface *toplevel;
struct wl_listener destroy;
struct wl_listener new_popup;
struct wl_listener commit;
struct wl_listener reposition;
};
struct sway_output;
struct wlr_layer_surface_v1 *toplevel_layer_surface_from_surface(
struct wlr_surface *surface);
void arrange_layers(struct sway_output *output);
void destroy_layers(struct sway_output *output);
#endif