Commit graph

11 commits

Author SHA1 Message Date
Ronan Pigott eaee087c17 seatop_default: handle focus for xwayland_unmanaged views 2019-11-04 23:56:27 +01:00
Kirill Chibisov 43bd8dc437 Fix tiled containers resize with mouse
Fixes regression introduced in 2c1a11016c
2019-10-23 17:21:09 +02:00
Versus Void 2c1a11016c Do not search for edges on subsurfaces, fix #4381
Subsurfaces (in most cases popups) aren't decorated by sway
and will never have any borders, but may be drawn beyond container
boundaries producing false positive when searching for edge.
So we want to skip edge search when handling mouse event on subsurface.
2019-09-05 17:41:23 +03:00
Brian Ashworth 187306640b seatop_default: only focus container on press
This matches i3's behavior of only focusing a container when pressed.
This allows for `bindsym button1 nop`, `bindsym BTN_LEFT nop`, or
`bindcode 272 nop` to be used to disable focusing when clicking on the
title (or with additional flags to bind{code,sym} other portions of
the container).

Without this additional condition, the user would need both
`bindsym button1 nop` and `bindsym --release button1 nop` to override
both the pressed and released behavior.
2019-09-04 16:48:34 -10:00
Antonin Décimo 813e120979 Remove redundant checks 2019-08-12 09:42:11 +09:00
Antonin Décimo 9be76e6b12 input: check pointer against nullptr 2019-08-12 09:42:11 +09:00
Alex Maese 3b3e0560be Fix a silly mistake 2019-04-28 21:07:47 +03:00
Alex Maese 5b454ac441 Don't send pointer motion when rebasing the cursor 2019-04-28 21:07:47 +03:00
Alex Maese 866a19b743 Clear pointer focus during move and resize seatops 2019-04-28 21:07:47 +03:00
Ryan Dwyer bfa20e65d8 Clean up focus follows mouse logic
Firstly, this fixes a recent regression where having
`focus_follows_mouse yes` and hovering an inactive tab caused it to gain
focus. The code was missing a view_is_visible check.

The code is handling the logic for both focus_follows_mouse yes and
focus_follows_mouse always, where the latter will apply when nudging the
mouse after a workspace switch. However, the view_is_visible check
didn't apply when using focus_follows_mouse always, so hovering a tab
with that configuration would cause is to focus. This was a bug. When
adding the view_is_visible check, it now applies to both yes and always.

Note that the comment about the split container was wrong. At this point
the hovered node cannot be a split container because it passed the
node_is_view check. The comment has been removed.

Lastly, the else condition is completely removed. This didn't appear to
have any practical use. Setting focus to the result of
seat_get_focus_inactive is very likely going to be a no op. There is a
slim chance that this will break something, and if so I'd like to find
out what so it can be properly documented in the code.
2019-03-19 14:38:06 -06:00
Ryan Dwyer 7b9ae42331 Introduce default seatop
This introduces a `default` seat operation which is used when no mouse
buttons are being held. This means there is now always a seat operation
in progress. It allows us to separate `default` code from the standard
cursor management code.

The sway_seatop_impl struct has gained callbacks `axis`, `rebase` and
`end`, and lost callbacks `finish` and `abort`. `axis` and `rebase` are
only used by the default seatop. `end` is called when a seatop is being
replaced by another one and allows the seatop to free any resources,
though no seatop currently needs to do this. `finish` is no longer
required, as each seatop can gracefully finish in their `button`
callback. And `abort` is not needed, as calling `end` would achieve the
same thing. The struct has also gained a bool named allow_set_cursor
which allows the client to set a new cursor during `default` and `down`
seatops.

Seatops would previously store which button they were started with and
stop when that button was released. This behaviour is changed so that it
only ends once all buttons are released. So you can start a drag with
$mod+left, then click and hold right, release left and it'll continue
dragging while the right button is held.

The motion callback now accepts dx and dy. Most seatops don't use this
as they store the cursor position when the seatop is started and compare
it with the current cursor position. This approach doesn't make sense
for the default seatop though, hence why dx and dy are needed.

The pressed_buttons array has been moved from the sway_cursor struct to
the default seatop's data. This is only used for the default seatop to
check bindings. The total pressed button count remains in the
sway_cursor struct though, because all the other seatops check it to
know if they should end.

The `down` seatop no longer has a `moved` property. This was used to
track if the cursor moved and to recheck focus_follows_mouse, but seems
to work without it.

The logic for focus_follows_mouse has been refactored. As part of this
I've removed the call to wlr_seat_keyboard_has_grab as we don't appear
to use keyboard grabs.

The functions for handling relative motion, absolute motion and tool
axis have been changed. Previously the handler functions were
handle_cursor_motion, handle_cursor_motion_absolute and
handle_tool_axis. The latter two both called cursor_motion_absolute.
Both handle_cursor_motion and cursor_motion_absolute did very similar
things. These are now simplified into three handlers and a single common
function called cursor_motion. All three handlers call cursor_motion. As
cursor_motion works with relative distances, the absolute and tool axis
handlers convert them to relative first.
2019-03-17 10:02:04 -06:00