layer-shell: respect single anchor exclusive zones
This commit is contained in:
parent
341fe1e977
commit
24c0355ba8
@ -364,9 +364,7 @@ pub fn arrangeLayers(self: *Self) void {
|
|||||||
|
|
||||||
// Arrange all layer surfaces with exclusive zones, applying them to the
|
// Arrange all layer surfaces with exclusive zones, applying them to the
|
||||||
// usable box along the way.
|
// usable box along the way.
|
||||||
for (layer_idxs) |layer| {
|
for (layer_idxs) |layer| self.arrangeLayer(self.layers[layer], full_box, &usable_box, true);
|
||||||
self.arrangeLayer(self.layers[layer], full_box, &usable_box, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the the usable_box has changed, we need to rearrange the output
|
// If the the usable_box has changed, we need to rearrange the output
|
||||||
if (!std.meta.eql(self.usable_box, usable_box)) {
|
if (!std.meta.eql(self.usable_box, usable_box)) {
|
||||||
@ -375,9 +373,7 @@ pub fn arrangeLayers(self: *Self) void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Arrange the layers without exclusive zones
|
// Arrange the layers without exclusive zones
|
||||||
for (layer_idxs) |layer| {
|
for (layer_idxs) |layer| self.arrangeLayer(self.layers[layer], full_box, &usable_box, false);
|
||||||
self.arrangeLayer(self.layers[layer], full_box, &usable_box, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find the topmost layer surface in the top or overlay layers which
|
// Find the topmost layer surface in the top or overlay layers which
|
||||||
// requests keyboard interactivity if any.
|
// requests keyboard interactivity if any.
|
||||||
@ -431,9 +427,7 @@ fn arrangeLayer(
|
|||||||
|
|
||||||
// If the value of exclusive_zone is greater than zero, then it exclusivly
|
// If the value of exclusive_zone is greater than zero, then it exclusivly
|
||||||
// occupies some area of the screen.
|
// occupies some area of the screen.
|
||||||
if (exclusive != (current_state.exclusive_zone > 0)) {
|
if (exclusive != (current_state.exclusive_zone > 0)) continue;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the exclusive zone is set to -1, this means the the client would like
|
// If the exclusive zone is set to -1, this means the the client would like
|
||||||
// to ignore any exclusive zones and use the full area of the output.
|
// to ignore any exclusive zones and use the full area of the output.
|
||||||
@ -505,31 +499,36 @@ fn arrangeLayer(
|
|||||||
|
|
||||||
// Apply the exclusive zone to the current bounds
|
// Apply the exclusive zone to the current bounds
|
||||||
const edges = [4]struct {
|
const edges = [4]struct {
|
||||||
anchors: u32,
|
single: u32,
|
||||||
|
triple: u32,
|
||||||
to_increase: ?*i32,
|
to_increase: ?*i32,
|
||||||
to_decrease: ?*u32,
|
to_decrease: *u32,
|
||||||
margin: u32,
|
margin: u32,
|
||||||
}{
|
}{
|
||||||
.{
|
.{
|
||||||
.anchors = anchor_left | anchor_right | anchor_top,
|
.single = anchor_top,
|
||||||
|
.triple = anchor_top | anchor_left | anchor_right,
|
||||||
.to_increase = &usable_box.y,
|
.to_increase = &usable_box.y,
|
||||||
.to_decrease = &usable_box.height,
|
.to_decrease = &usable_box.height,
|
||||||
.margin = current_state.margin.top,
|
.margin = current_state.margin.top,
|
||||||
},
|
},
|
||||||
.{
|
.{
|
||||||
.anchors = anchor_left | anchor_right | anchor_bottom,
|
.single = anchor_bottom,
|
||||||
|
.triple = anchor_bottom | anchor_left | anchor_right,
|
||||||
.to_increase = null,
|
.to_increase = null,
|
||||||
.to_decrease = &usable_box.height,
|
.to_decrease = &usable_box.height,
|
||||||
.margin = current_state.margin.bottom,
|
.margin = current_state.margin.bottom,
|
||||||
},
|
},
|
||||||
.{
|
.{
|
||||||
.anchors = anchor_left | anchor_top | anchor_bottom,
|
.single = anchor_left,
|
||||||
|
.triple = anchor_left | anchor_top | anchor_bottom,
|
||||||
.to_increase = &usable_box.x,
|
.to_increase = &usable_box.x,
|
||||||
.to_decrease = &usable_box.width,
|
.to_decrease = &usable_box.width,
|
||||||
.margin = current_state.margin.left,
|
.margin = current_state.margin.left,
|
||||||
},
|
},
|
||||||
.{
|
.{
|
||||||
.anchors = anchor_right | anchor_top | anchor_bottom,
|
.single = anchor_right,
|
||||||
|
.triple = anchor_right | anchor_top | anchor_bottom,
|
||||||
.to_increase = null,
|
.to_increase = null,
|
||||||
.to_decrease = &usable_box.width,
|
.to_decrease = &usable_box.width,
|
||||||
.margin = current_state.margin.right,
|
.margin = current_state.margin.right,
|
||||||
@ -537,16 +536,13 @@ fn arrangeLayer(
|
|||||||
};
|
};
|
||||||
|
|
||||||
for (edges) |edge| {
|
for (edges) |edge| {
|
||||||
if (current_state.anchor & edge.anchors == edge.anchors and
|
if ((current_state.anchor == edge.single or current_state.anchor == edge.triple) and
|
||||||
current_state.exclusive_zone + @intCast(i32, edge.margin) > 0)
|
current_state.exclusive_zone + @intCast(i32, edge.margin) > 0)
|
||||||
{
|
{
|
||||||
const delta = current_state.exclusive_zone + @intCast(i32, edge.margin);
|
const delta = current_state.exclusive_zone + @intCast(i32, edge.margin);
|
||||||
if (edge.to_increase) |value| {
|
if (edge.to_increase) |value| value.* += delta;
|
||||||
value.* += delta;
|
edge.to_decrease.* -= @intCast(u32, delta);
|
||||||
}
|
break;
|
||||||
if (edge.to_decrease) |value| {
|
|
||||||
value.* -= @intCast(u32, delta);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user