diff options
| author | Leon Henrik Plickat <leonhenrik.plickat@stud.uni-goettingen.de> | 2021-12-10 23:40:48 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-10 23:40:48 +0100 |
| commit | d93ee2c27e66522e1a3d20ad26a4a19733f28aab (patch) | |
| tree | f65e2b2e2cec24e1f52dd5e0b698b35522beb48f | |
| parent | 93afdb32bf544b0c6879138138aefee16c9864d2 (diff) | |
| download | river-d93ee2c27e66522e1a3d20ad26a4a19733f28aab.tar.gz river-d93ee2c27e66522e1a3d20ad26a4a19733f28aab.tar.xz | |
Cursor: improve output focus handling on button press
This patch allows to focus outputs by clicking on the empty background and by
clicking on layer surfaces without keyboard interactivity. This makes it
possible to use the cursor to focus outputs with no visible views.
This also fixes problems with pointer interactive layer surfaces (for example
launchers and docks) on non-focused outputs.
| -rw-r--r-- | river/Cursor.zig | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/river/Cursor.zig b/river/Cursor.zig index e67e7d5..74f586e 100644 --- a/river/Cursor.zig +++ b/river/Cursor.zig @@ -255,16 +255,25 @@ fn handleButton(listener: *wl.Listener(*wlr.Pointer.event.Button), event: *wlr.P } }, .layer_surface => |layer_surface| { + self.seat.focusOutput(layer_surface.output); // If a keyboard inteactive layer surface has been clicked on, // give it keyboard focus. if (layer_surface.wlr_layer_surface.current.keyboard_interactive == .exclusive) { - self.seat.focusOutput(layer_surface.output); self.seat.setFocusRaw(.{ .layer = layer_surface }); + } else { + self.seat.focus(null); } + server.root.startTransaction(); }, .xwayland_unmanaged => assert(build_options.xwayland), } _ = self.seat.wlr_seat.pointerNotifyButton(event.time_msec, event.button, event.state); + } else if (server.root.output_layout.outputAt(self.wlr_cursor.x, self.wlr_cursor.y)) |wlr_output| { + // If the user clicked on empty space of an output, focus it. + const output = @intToPtr(*Output, wlr_output.data); + self.seat.focusOutput(output); + self.seat.focus(null); + server.root.startTransaction(); } } |
