labwc/include/view-impl-common.h
tokyo4j 81204b0537 xwayland: notify correct window stacking order to xwayland
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.
2025-04-01 16:48:40 +09:00

23 lines
674 B
C

/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef LABWC_VIEW_IMPL_COMMON_H
#define LABWC_VIEW_IMPL_COMMON_H
/*
* Common code for view->impl functions
*
* Please note: only xdg-shell-toplevel-view and xwayland-view view_impl
* functions should call these functions.
*/
struct view;
void view_impl_map(struct view *view);
void view_impl_unmap(struct view *view);
/*
* Updates view geometry at commit based on current position/size,
* pending move/resize, and committed surface size. The computed
* position may not match pending.x/y exactly in some cases.
*/
void view_impl_apply_geometry(struct view *view, int w, int h);
#endif /* LABWC_VIEW_IMPL_COMMON_H */