mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
view: implement cascade placement policy
Adds following settings:
<placement>
<policy>cascade</policy>
<cascadeOffset x="40" y="30" />
</placement>
"Cascade" policy places a new window at the center of the screen like
"center" policy, but possibly shifts its position to bottom-right so the
new window doesn't cover existing windows.
The algorithm is copied from KWin's implementation:
df9f8f8346/src/placement.cpp (L589)
Also added some helper functions to manipulate `wlr_box`.
This commit is contained in:
parent
3be8fe25f3
commit
46ec513630
10 changed files with 199 additions and 17 deletions
|
|
@ -5,6 +5,7 @@
|
|||
#include <wlr/util/edges.h>
|
||||
#include <wlr/util/box.h>
|
||||
#include "common/border.h"
|
||||
#include "common/box.h"
|
||||
#include "common/macros.h"
|
||||
#include "config/rcxml.h"
|
||||
#include "edges.h"
|
||||
|
|
@ -466,9 +467,8 @@ edges_find_outputs(struct border *nearest_edges, struct view *view,
|
|||
struct wlr_box usable =
|
||||
output_usable_area_in_layout_coords(o);
|
||||
|
||||
struct wlr_box ol;
|
||||
if (!wlr_box_intersection(&ol, &origin, &usable) &&
|
||||
!wlr_box_intersection(&ol, &target, &usable)) {
|
||||
if (!box_intersects(&origin, &usable)
|
||||
&& !box_intersects(&target, &usable)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue