]> git.mdlowis.com Git - proto/labwc.git/commit
view: ensure that floating views don't overlap top panels
authorJohn Lindgren <john@jlindgren.net>
Fri, 3 Nov 2023 16:38:07 +0000 (12:38 -0400)
committerJohan Malm <johanmalm@users.noreply.github.com>
Sun, 5 Nov 2023 15:03:13 +0000 (15:03 +0000)
commit57075ce864ff39ae812c21fe78c8575ee571178d
tree58af560f52595200c98743fcc7f67dbe1a41ce39
parent984aeb0b0bf8858217528342baab0b28889fa699
view: ensure that floating views don't overlap top panels

The top_left_edge_boundary_check() function in xwayland.c ensures that
views trying to position themselves at 0,0 don't end up with a titlebar
offscreen. However, it doesn't take into account the usable area and
thus these views can still end up overlapping a top panel.

Also, there is no good reason for top_left_edge_boundary_check() to be
xwayland-specific. This logic should really be part of
view_adjust_for_layout_change().

To fix all this, add a new view_adjust_floating_geometry() function,
which replaces the existing similar (and duplicated) logic in
view_apply_natural_geometry() and view_adjust_for_layout_change().

view_adjust_for_layout_change() is already being called from xwayland's
set_initial_position(), so top_left_edge_boundary_check() is now
redundant and can just be deleted.

Lightly tested with waybar and feh --geometry 640x480+0+0. The feh
window is now correctly positioned below waybar, even if started before
waybar (in that case, the feh window is moved when waybar starts).
include/view.h
src/view.c
src/xwayland.c