Skip to content

Commit

Permalink
Don't make views float when resizing or moving
Browse files Browse the repository at this point in the history
  • Loading branch information
mmskv committed Jan 7, 2022
1 parent a340a60 commit 67bb432
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
19 changes: 6 additions & 13 deletions river/Cursor.zig
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,9 @@ pub fn enterMode(self: *Self, mode: enum { move, resize }, view: *View) void {

self.seat.focus(view);

// Don't float nonfloating views
if (!view.current.float) return;

switch (mode) {
.move => self.mode = .{ .move = .{ .view = view } },
.resize => {
Expand All @@ -719,19 +722,9 @@ pub fn enterMode(self: *Self, mode: enum { move, resize }, view: *View) void {
},
}

// Automatically float all views being moved by the pointer, if
// their dimensions are set by a layout generator. If however the views
// are unarranged, leave them as non-floating so the next active
// layout can affect them.
if (!view.current.float and view.output.current.layout != null) {
view.pending.float = true;
view.float_box = view.current.box;
view.applyPending();
} else {
// The View.applyPending() call in the other branch starts
// the transaction needed after the seat.focus() call above.
server.root.startTransaction();
}
// The View.applyPending() call in the other branch starts
// the transaction needed after the seat.focus() call above.
server.root.startTransaction();

// Clear cursor focus, so that the surface does not receive events
self.seat.wlr_seat.pointerNotifyClearFocus();
Expand Down
2 changes: 2 additions & 0 deletions river/command/move.zig
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ pub fn move(
return Error.InvalidPhysicalDirection;

const view = getView(seat) orelse return;
if (!view.current.float) return;
switch (direction) {
.up => view.move(0, -delta),
.down => view.move(0, delta),
Expand Down Expand Up @@ -91,6 +92,7 @@ pub fn resize(
return Error.InvalidOrientation;

const view = getView(seat) orelse return;
if (!view.current.float) return;
const border_width = @intCast(i32, server.config.border_width);
const output_box = view.output.getEffectiveResolution();
switch (orientation) {
Expand Down

0 comments on commit 67bb432

Please sign in to comment.