labwc/include/xwayland.h
Consolatis 6c1ca61ee7 Keep xwayland stacking order in sync when switching workspaces
Until we expose the workspaces to xwayland we need a way to
ensure that xwayland views on the current workspace are always
stacked above xwayland views on other workspaces.

If we fail to do so, issues arise in scenarios where we change
the mouse focus but do not change the (xwayland) stacking order.

Reproducer:
- If followMouse is enabled, raiseOnFocus must be disabled
- Open at least two xwayland windows which allow scrolling
  (some X11 terminal with 'man man' for example)
- Switch to another workspace, open another xwayland window
  which allows scrolling and maximize it
- Switch back to the previous workspace with the two windows
- Move the mouse to the xwayland window that does *not* have
  focus
- Start scrolling
- All scroll events should end up on the maximized window on
  the other workspace

This patch fixes the issue by simply raising all windows from
the current workspace again in their original stacking order
when switching workspaces.

Reported-by: Domo via IRC (thanks!)
2023-11-21 22:31:05 +01:00

58 lines
1.6 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef LABWC_XWAYLAND_H
#define LABWC_XWAYLAND_H
#include "config.h"
#if HAVE_XWAYLAND
#include "view.h"
struct wlr_compositor;
struct xwayland_unmanaged {
struct server *server;
struct wlr_xwayland_surface *xwayland_surface;
struct wlr_scene_node *node;
struct wl_list link;
struct wl_listener request_activate;
struct wl_listener request_configure;
/* struct wl_listener request_fullscreen; */
struct wl_listener set_geometry;
struct wl_listener map;
struct wl_listener unmap;
struct wl_listener destroy;
struct wl_listener set_override_redirect;
};
struct xwayland_view {
struct view base;
struct wlr_xwayland_surface *xwayland_surface;
/* Events unique to XWayland views */
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;
/* Not (yet) implemented */
/* struct wl_listener set_role; */
/* struct wl_listener set_window_type; */
/* 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);
#endif /* HAVE_XWAYLAND */
#endif /* LABWC_XWAYLAND_H */