mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
Before this commit, when a normal window is raised, xwayland thought it's above always-on-top (AOT) windows even though it's actually below AOT windows in the scene. This means mouse scroll events may be unexpectedly sent to normal windows below AOT windows even when the cursor is hovering over a AOT window. So this commit fixes it by notifying the correct stacking order (where AOT windows are placed above normal windows) to xwayland every time the stacking order is updated. Other benefits of this commit are: - It makes the code more readable and predictable by aggregating logic about stacking order management in xwayland (e.g. shaded windows or windows in other workspaces should be notified to xwayland as being placed at the bottom). - As server->last_raised_view is removed in the previous commit, we were notifying the stacking order to xwayland every time a window with dialog windows is clicked (not when clicking a topmost window without dialogs, due to some optimization in wlroots). This commit fixes this by caching the window stacking order in xwayland_view->stacking_order and notifying it to xwayland only when it's updated.
105 lines
2.8 KiB
C
105 lines
2.8 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
#ifndef LABWC_XWAYLAND_H
|
|
#define LABWC_XWAYLAND_H
|
|
#include "config.h"
|
|
|
|
#if HAVE_XWAYLAND
|
|
#include <assert.h>
|
|
#include <stdbool.h>
|
|
#include <xcb/xcb.h>
|
|
#include "common/macros.h"
|
|
#include "view.h"
|
|
|
|
struct wlr_compositor;
|
|
struct wlr_output;
|
|
struct wlr_output_layout;
|
|
|
|
static const char * const atom_names[] = {
|
|
"_NET_WM_WINDOW_TYPE_DESKTOP",
|
|
"_NET_WM_WINDOW_TYPE_DOCK",
|
|
"_NET_WM_WINDOW_TYPE_TOOLBAR",
|
|
"_NET_WM_WINDOW_TYPE_MENU",
|
|
"_NET_WM_WINDOW_TYPE_UTILITY",
|
|
"_NET_WM_WINDOW_TYPE_SPLASH",
|
|
"_NET_WM_WINDOW_TYPE_DIALOG",
|
|
"_NET_WM_WINDOW_TYPE_DROPDOWN_MENU",
|
|
"_NET_WM_WINDOW_TYPE_POPUP_MENU",
|
|
"_NET_WM_WINDOW_TYPE_TOOLTIP",
|
|
"_NET_WM_WINDOW_TYPE_NOTIFICATION",
|
|
"_NET_WM_WINDOW_TYPE_COMBO",
|
|
"_NET_WM_WINDOW_TYPE_DND",
|
|
"_NET_WM_WINDOW_TYPE_NORMAL",
|
|
};
|
|
|
|
static_assert(
|
|
ARRAY_SIZE(atom_names) == WINDOW_TYPE_LEN,
|
|
"Xwayland atoms out of sync");
|
|
|
|
extern xcb_atom_t atoms[WINDOW_TYPE_LEN];
|
|
|
|
struct xwayland_unmanaged {
|
|
struct server *server;
|
|
struct wlr_xwayland_surface *xwayland_surface;
|
|
struct wlr_scene_node *node;
|
|
struct wl_list link;
|
|
|
|
struct mappable mappable;
|
|
|
|
struct wl_listener associate;
|
|
struct wl_listener dissociate;
|
|
struct wl_listener request_activate;
|
|
struct wl_listener request_configure;
|
|
/* struct wl_listener request_fullscreen; */
|
|
struct wl_listener set_geometry;
|
|
struct wl_listener destroy;
|
|
struct wl_listener set_override_redirect;
|
|
};
|
|
|
|
struct xwayland_view {
|
|
struct view base;
|
|
struct wlr_xwayland_surface *xwayland_surface;
|
|
|
|
/* Used to detect stacking order updates */
|
|
int stacking_order;
|
|
|
|
/* Events unique to XWayland views */
|
|
struct wl_listener associate;
|
|
struct wl_listener dissociate;
|
|
struct wl_listener request_activate;
|
|
struct wl_listener request_configure;
|
|
struct wl_listener set_class;
|
|
struct wl_listener set_decorations;
|
|
struct wl_listener set_override_redirect;
|
|
struct wl_listener set_strut_partial;
|
|
struct wl_listener set_window_type;
|
|
struct wl_listener map_request;
|
|
|
|
/* Not (yet) implemented */
|
|
/* struct wl_listener set_role; */
|
|
/* struct wl_listener set_hints; */
|
|
};
|
|
|
|
void xwayland_unmanaged_create(struct server *server,
|
|
struct wlr_xwayland_surface *xsurface, bool mapped);
|
|
|
|
void xwayland_view_create(struct server *server,
|
|
struct wlr_xwayland_surface *xsurface, bool mapped);
|
|
|
|
void xwayland_adjust_stacking_order(struct server *server);
|
|
|
|
struct wlr_xwayland_surface *xwayland_surface_from_view(struct view *view);
|
|
|
|
void xwayland_server_init(struct server *server,
|
|
struct wlr_compositor *compositor);
|
|
void xwayland_server_finish(struct server *server);
|
|
|
|
void xwayland_adjust_usable_area(struct view *view,
|
|
struct wlr_output_layout *layout, struct wlr_output *output,
|
|
struct wlr_box *usable);
|
|
|
|
void xwayland_update_workarea(struct server *server);
|
|
|
|
void xwayland_reset_cursor(struct server *server);
|
|
|
|
#endif /* HAVE_XWAYLAND */
|
|
#endif /* LABWC_XWAYLAND_H */
|