xwayland: treat X11 panel views as if fixedPosition rule is set

This commit is contained in:
John Lindgren 2023-11-27 17:11:29 -05:00 committed by Johan Malm
parent 0a5255f062
commit 83e67b32b6
4 changed files with 33 additions and 2 deletions

View file

@ -35,7 +35,9 @@ interactive_begin(struct view *view, enum input_mode mode, uint32_t edges)
return;
}
if (window_rules_get_property(view, "fixedPosition") == LAB_PROP_TRUE) {
/* Prevent moving/resizing fixed-position and panel-like views */
if (window_rules_get_property(view, "fixedPosition") == LAB_PROP_TRUE
|| view_has_strut_partial(view)) {
return;
}

View file

@ -593,7 +593,9 @@ view_adjust_floating_geometry(struct view *view, struct wlr_box *geometry)
return false;
}
if (window_rules_get_property(view, "fixedPosition") == LAB_PROP_TRUE) {
/* Avoid moving panels out of their own reserved area ("strut") */
if (window_rules_get_property(view, "fixedPosition") == LAB_PROP_TRUE
|| view_has_strut_partial(view)) {
return false;
}
@ -1550,6 +1552,14 @@ view_is_related(struct view *view, struct wlr_surface *surface)
return false;
}
bool
view_has_strut_partial(struct view *view)
{
assert(view);
return view->impl->has_strut_partial &&
view->impl->has_strut_partial(view);
}
const char *
view_get_string_prop(struct view *view, const char *prop)
{

View file

@ -103,6 +103,14 @@ xwayland_view_wants_focus(struct view *view)
return VIEW_WANTS_FOCUS_NEVER;
}
static bool
xwayland_view_has_strut_partial(struct view *view)
{
struct wlr_xwayland_surface *xsurface =
xwayland_surface_from_view(view);
return (bool)xsurface->strut_partial;
}
static struct wlr_xwayland_surface *
top_parent_of(struct view *view)
{
@ -786,6 +794,7 @@ static const struct view_impl xwayland_view_impl = {
.is_related = xwayland_view_is_related,
.get_size_hints = xwayland_view_get_size_hints,
.wants_focus = xwayland_view_wants_focus,
.has_strut_partial = xwayland_view_has_strut_partial,
};
void