aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/seatop_default.c
Commit message (Collapse)AuthorAge
* input/pointer: don't trigger pointer bindings for emulated inputLibravatar Tudor Brindus2020-06-16
| | | | | | | | | | Prior to this commit, a tablet device could trigger mouse button down bindings if the pen was pressed on a surface that didn't bind tablet handlers -- but it wouldn't if the surface did bind tablet handlers. We should expose consistent behavior to users so that they don't have to care about emulated vs. non-emulated input, so stop triggering bindings for any non-pointer devices.
* input/tablet: focus appropriate node on tip downLibravatar Tudor Brindus2020-06-16
| | | | | | | | | This commit makes tablet input more usable when `focus_follows_mouse` is set to `no`. Previously, tapping down on surfaces that bound tablet input would not switch focus, whereas tapping on surfaces that didn't (and hence went through pointer emulation) did.
* input: tweak resize behavior to not change tab focus on border clickLibravatar Tudor Brindus2020-06-08
| | | | | | | If a resize is triggered on a tabbed or stacked container, change focus to the tab which already had inactive focus, rather than to the tab whose border was clicked -- otherwise, we'd change the active tab when the user probably just wanted to resize.
* input/tablet: allow moving tiling tablet v2 surfaces by pen inputLibravatar Tudor Brindus2020-06-07
| | | | Closes #5293.
* input/tablet: allow moving floating tablet v2 surfaces by pen inputLibravatar Tudor Brindus2020-06-07
| | | | Refs #5293.
* tree/container: introduce `container_toplevel_ancestor` helperLibravatar Tudor Brindus2020-06-07
| | | | | This allows us to not have to explicitly write the same while loop everywhere.
* Use new wlroots API for clearing keyboard/pointer focus during grabsLibravatar Thomas Hebb2020-06-05
| | | | | | | | | We are not allowed to do what we did in #5222 and pass a `NULL` surface wlr_seat_pointer_notify_enter(), and it's causing crashes when an xdg-shell popup is active (see #5294 and swaywm/wlroots#2161). Instead, solve #5220 using the new wlroots API introduced in swaywm/wlroots#2217.
* input/cursor: refactor tablet tool tip events into seatopsLibravatar Tudor Brindus2020-06-04
| | | | | | This commit moves tool tip event generation into seatops. In doing so, some corner cases where we'd erroneously (but likely harmlessly) generate both tablet and pointer events simultaneously are eliminated.
* input/pointer: send pointer enter event on confine warpLibravatar Tudor Brindus2020-05-28
| | | | | | | | | | | | | | | | | | | The spec has this to say about sending events on confine creation: Whenever the confinement is activated, it is guaranteed that the surface the pointer is confined to will already have received pointer focus and that the pointer will be within the region passed to the request creating this object. ...and on region update: If warped, a wl_pointer.motion event will be emitted, but no wp_relative_pointer.relative_motion event. Prior to this patch, sway did neither, and updated the hardware cursor position without notifying the underlying surface until the next motion event. This led to inconsistent results, especially in applications that draw their own software cursor.
* input/tablet: add seatop_down entry for tablet inputLibravatar Tudor Brindus2020-05-25
| | | | | | | | | | | | | | | | | | | | | | Currently, when tablet input exits a window during an implicit grab, it passes focus to another window. For instance, this is problematic when trying to drag a scrollbar, and exiting the window — the scrollbar motion stops. Additionally, without `focus_follows_mouse no`, the tablet passes focus to whatever surface it goes over regardless of if there is an active implicit. If the tablet is over a surface that does not bind tablet handlers, sway will fall back to pointer emulation, and all of this works fine. It probably should have consistent behavior between emulated and not-emulated input, though. This commit adds a condition for entering seatop_down when a tablet's tool tip goes down, and exiting when it goes up. Since events won't be routed through seatop_default, this prevents windows losing focus during implicit grabs. Closes #5302.
* input/tablet: simplify parameter plumbing for tablet referencesLibravatar Tudor Brindus2020-05-10
| | | | | | This is a small cleanup commit for removing `sway_tablet` parameters from functions that already accept `sway_tablet_tool`, since the tablet reference can be accessed through `tool->tablet`.
* input: rename pointer handlers to be unambiguousLibravatar Tudor Brindus2020-05-02
| | | | | | | This commit renames `motion` and `axis` handlers to `pointer_motion` and `pointer_axis`, respectively, to disambiguate them from their tablet (and future touch) handlers. `button` is left as-is, as it is generic across input devices.
* input: refactor tablet motion into seatop handlerLibravatar Tudor Brindus2020-05-02
| | | | | | | This commit moves tablet motion logic into a seatop handler. As a side-effect of seatop implementations being able to receive tablet motion events, fixes #5232.
* input/cursor: make cursor rebasing cursor type-agnosticLibravatar Tudor Brindus2020-05-02
| | | | | | | | This commit refactors `cursor_rebase` into `cursor_update_image`, and moves sending pointer events to the two existing call sites. This will enable this code to be reused for tablets. Refs #5232
* input/seatop_default: properly notify pointer leaveLibravatar Nick Diego Yamane2020-05-01
| | | | | | | | | Currently, clients receive wl_data_device::leave events only when the pointer enters another surface, which leads to issues, such as #5220. This happens because wlr_seat_pointer_notify_enter() is called when handling motion events only for non-NULL surfaces. Fixes #5220
* input/seatop_default: release on empty workspaceLibravatar Rouven Czerwinski2020-04-15
| | | | | | | | | | | Instead of handling presses and releases on empty workspaces as setting focus to the workspace, handle releases by notifying the seat of a pointer action. This way DnDs are correctly released if the button is released over an empty workspace. This is achieved by removing the early return and letting the handle_button() call seat_pointer_notify_button() at the very end. Fixes #3932
* input/seatop_default: fix focusing floating titlesLibravatar Brian Ashworth2019-12-16
| | | | | | | | | | | When clicking on the titlebar of a floating container (or descendant of a floating container), the top-level floating container was being focused and then allowing you to move the top-level floating container. This made it so you couldn't switch to a different tab/stack within the floating container. With this patch, the focus inactive view for the container that the titlebar is associated with is focused, then the traversal to the top-level floating container is performed to use with the move floating operation.
* seatop_default: handle focus for unmanaged xwayland windows lastLibravatar Ronan Pigott2019-11-08
| | | | Fixes #4707
* seatop_default: handle focus for xwayland_unmanaged viewsLibravatar Ronan Pigott2019-11-04
|
* Fix tiled containers resize with mouseLibravatar Kirill Chibisov2019-10-23
| | | | Fixes regression introduced in 2c1a11016ccb7646a74de51eff003c18e5aa7902
* Do not search for edges on subsurfaces, fix #4381Libravatar Versus Void2019-09-05
| | | | | | | 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.
* seatop_default: only focus container on pressLibravatar Brian Ashworth2019-09-04
| | | | | | | | | | | | 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.
* Remove redundant checksLibravatar Antonin Décimo2019-08-12
|
* input: check pointer against nullptrLibravatar Antonin Décimo2019-08-12
|
* Fix a silly mistakeLibravatar Alex Maese2019-04-28
|
* Don't send pointer motion when rebasing the cursorLibravatar Alex Maese2019-04-28
|
* Clear pointer focus during move and resize seatopsLibravatar Alex Maese2019-04-28
|
* Clean up focus follows mouse logicLibravatar Ryan Dwyer2019-03-19
| | | | | | | | | | | | | | | | | | | | | | | 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.
* Introduce default seatopLibravatar Ryan Dwyer2019-03-17
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.