view: sidestep transaction for float/fullscreen
Transactions are only useful when multiple views need to atomically change size together. Float/fullscreen views are independant of the layout and should bypass the transaction system.
This commit is contained in:
@ -39,8 +39,14 @@ pub fn toggleFloat(
|
||||
// Don't modify views which are the target of a cursor action
|
||||
if (seat.input_manager.isCursorActionTarget(view)) return;
|
||||
|
||||
if (!view.pending.float) view.pending.box = view.float_box;
|
||||
view.pending.float = !view.pending.float;
|
||||
|
||||
// If switching from layout to float, restore the previous floating dimensions
|
||||
if (view.pending.float) {
|
||||
view.pending.box = view.float_box;
|
||||
view.configure();
|
||||
}
|
||||
|
||||
view.output.root.arrange();
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,9 @@
|
||||
|
||||
const std = @import("std");
|
||||
|
||||
const c = @import("../c.zig");
|
||||
|
||||
const Box = @import("../Box.zig");
|
||||
const Error = @import("../command.zig").Error;
|
||||
const Seat = @import("../Seat.zig");
|
||||
|
||||
@ -35,7 +38,22 @@ pub fn toggleFullscreen(
|
||||
// Don't modify views which are the target of a cursor action
|
||||
if (seat.input_manager.isCursorActionTarget(view)) return;
|
||||
|
||||
view.setFullscreen(!seat.focused.view.pending.fullscreen);
|
||||
view.output.root.arrange();
|
||||
view.setFullscreen(!view.pending.fullscreen);
|
||||
|
||||
if (view.pending.fullscreen) {
|
||||
const output = view.output;
|
||||
view.pending.box = Box.fromWlrBox(
|
||||
c.wlr_output_layout_get_box(output.root.wlr_output_layout, output.wlr_output).*,
|
||||
);
|
||||
view.configure();
|
||||
} else if (view.pending.float) {
|
||||
// If transitioning from fullscreen -> float, return to the saved
|
||||
// floating dimensions.
|
||||
view.pending.box = view.float_box;
|
||||
view.configure();
|
||||
} else {
|
||||
// Transitioning to layout, arrange and start a transaction
|
||||
view.output.root.arrange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user