aboutsummaryrefslogtreecommitdiff
path: root/include/sway/input
AgeCommit message (Collapse)Author
2023-01-16input/tablet: handle focusing NULL surfaceKirill Primak
Additionally, rename the function responsible for switching focus to match its behavior better.
2023-01-07Improve tablet tool button handling.John Chadwick
This change allows the tablet tool button to be used for floating mod resize. In addition, it attempts to ensure that tablet tool events are consistent such that tablet v2 events and pointer events will never be interleaved, and such that the tool buttons count will never fall out of sync and cause tool button emulation to break. Some of this logic is similar to what is done for tablet tool tip, but not quite identical, because of the complication that we have to deal with multiple inputs that can overlap eachother. Fixes #7036.
2023-01-03Add missing includes & remove duplicatesCarl Smedstad
2022-11-15input/seat: locally compute drag icon offsetSimon Ser
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3861
2022-10-28Rework session lock keyboard focus handlingDaniel De Graaf
When removing outputs, it is possible to end up in a situation where none of the session lock client's surfaces have keyboard focus, resulting in it not receiving keyboard events. Track the focused surface and update it as needed on surface destroy.
2022-10-23Fix keymap being NULL and segfaulting on dev addYaroslav de la Peña Smirnov
Moved `libinput_config` to the callers of `sway_input_configure_libinput_device` so that we send the event after the added event.
2022-10-09Use keyboard_state.focused_surface directlyFerdinand Schober
2022-10-09allow pointer_constraints on layer_shell surfacesFerdinand Schober
2022-06-22Remove access to wlr_input_device unionSimon Ser
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3626 Closes: https://github.com/swaywm/sway/issues/7077
2022-05-30sway: add bindgesture commandFlorian Franzen
Co-authored-by: Michael Weiser <michael.weiser@gmx.de>
2022-04-29Implement ext-session-lock-v1Daniel De Graaf
2022-03-17sway/input: follow up wlroots input device events renamingSimon Zeni
2022-01-22input/cursor: pass through pointer hold gesturesTudor Brindus
This just follows swaywm/wlroots#3047, so `wl_pointer_gestures_v1` clients can be notified of these events.
2022-01-13Upgrade for wlroots surface refactoringSimon Ser
See [1] for details. [1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3412
2021-09-02seatop_down: End if surface is destroyed or other seatop startsSimon Plakolb
If the surface the pointer started to interact with is destroyed we also want the seatop_down to end. In case a drag is initiated we receive a call to handle_end.
2021-09-02input: Use seatop_down on layer surface clickSimon Plakolb
This solves an issue where layer-shell items would not receive a button release event when the pointer left them while being pressed. The default seatop changes focus immediately while seatop_down defers any focus changes until the pointer is released or seatop_down is destroyed.
2021-08-05seatop_down: Change type of sx, sy to double in begin_seatop_downDavid Rosca
Losing the precision resulted in wlr_cursor and wlr_seat::pointer_state getting out of sync during pointer motion in seatop_down. Since the difference was always under 1 px, it was practically impossible to notice in normal use. But because of being out of sync, cursor_rebase would always end up incorrectly calling wlr_seat_pointer_notify_motion from seatop_default_begin (on releasing mouse button) which broke cursor locking. See #5405 Closes #4632
2021-07-26Fix wl_pointer.frame not sent on touch emulationSimon Ser
When emulating touch, the simulating_pointer_from_touch field is set to true. It's switched back to false when a touch_up event is received. However we need to ensure we always send a wl_pointer.frame event following a group of other wl_pointer events. Since a touch_frame event is always guaranteed to come after a group of touch events, unset simulating_pointer_from_touch in the touch_frame handler instead of the touch_up handler. Add a new field to know whether the touch_frame handler should stop emulation.
2021-07-08Add support for touch frame eventsSimon Ser
Update for the breaking change in [1]. [1]: https://github.com/swaywm/wlroots/pull/3001
2021-03-12Implement input method keyboard grabxdavidwu
2021-02-25Automatically map built-in touchscreens/tablets to built-in panelsSimon Ser
Detect whether an output is built-in via its type. Detect whether a touchscreen or tablet tool is built-in via its ID_PATH property.
2021-01-01input: Clean up input_method_relay in seat_destoy()Andri Yngvason
This fixes a crash that happens when input_method_new or text_method_new events are emitted after the seat has been freed.
2020-12-06input/cursor: unhide cursor on synthetic inputTudor Brindus
Fixes #5847.
2020-11-01commands/focus: force container warp when fulfilling `focus mode_toggle`Tudor Brindus
This commit switches focusing behavior to force a warp when executing `focus mode_toggle`. Fixes #5772.
2020-10-31input: remove motion deltas from seatop callbacksTudor Brindus
Straightforward cleanup, they haven't been used for a while.
2020-10-30hide_cursor: Add an option to hide when typingTamir Zahavi-Brunner
Add an option for the `hide_cursor` command to hide the cursor when typing, i.e. whenever a key is pressed.
2020-10-12input/tablet: add tool_mode option to set tablet tools as relative inputTudor Brindus
Closes #4139.
2020-06-30seat: Refocus seat when wlr_drag is destroyedKenny Levinsen
wlr_drag installs grabs for the full duration of the drag, leading to the drag target not being focused when the drag ends. This leads to unexpected focus behavior, especially for the keyboard which requires toggling focus away and back to set. We can only fix the focus once the grabs are released, so refocus the seat when the wlr_drag destroy event is received. Closes: https://github.com/swaywm/sway/issues/5116
2020-06-19input: disable events for map_to_output devices when output not presentTudor Brindus
Fixes #3449.
2020-06-18input/pointer: don't trigger pointer bindings for emulated inputTudor Brindus
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.
2020-06-18input/cursor: send idle events based off device type, not input typeTudor Brindus
Previously, a tablet or touch device could report activity as a pointer device if it went through pointer emulation. This commit refactors idle sources to be consistently reported based on the type of the device that generated an input event, and now how that input event is being processed.
2020-06-16input/keyboard: wlr_keyboard_group enter and leaveBrian Ashworth
This adds support for wlr_keyboard_group's enter and leave events. The enter event just updates the keyboard's state. The leave event updates the keyboard's state and if the surface was notified of a press event for any of the keycodes, it is refocused so that it can pick up the current keyboard state without triggering any keybinds.
2020-05-29input/cursor: rename `simulated_tool_tip_down` to be more accurateTudor Brindus
This is a tiny cleanup commit that renames `simulated_tool_tip_down` to `simulating_pointer_from_tool_tip`, making it match `simulating_pointer_from_touch`. This is a better name since it makes it clear that it's the *pointer* that's being simulated, not the tool tip.
2020-05-26input/cursor: keep reference to cursor in constraintTudor Brindus
set_region accepts a NULL *data, so we can't use it to reference the constraint and find the cursor through its seat. Fixes #5386.
2020-05-25input/tablet: add seatop_down entry for tablet inputTudor Brindus
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 &mdash; 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.
2020-05-21input/pointer: only warp cursor when the confine region has changedTudor Brindus
Refs #5268.
2020-05-13commands: Add per-view shortcuts_inhibitor commandMichael Weiser
Add a separate per-view shortcuts_inhibitor command that can be used with criteria to override the per-seat defaults. This allows to e.g. disable shortcuts inhibiting globally but enable it for specific, known-good virtualization and remote desktop software or, alternatively, to blacklist that one slightly broken piece of software that just doesn't seem to get it right but insists on trying. Add a flag to sway_view and handling logic in the input manager that respects that flag if configured but falls back to per-seat config otherwise. Add the actual command but with just enable and disable subcommands since there's no value in duplicating the per-seat activate/deactivate/toggle logic here. Split the inhibitor retrieval helper in two so we can use the backend half in the command to retrieve inhibitors for a specific surface and not just the currently focused one. Extend the manual page with documentation of the command and references to its per-seat sibling and usefulness with criteria. Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
2020-05-13Implement pointer simulation if client hasn't bound to touchDavid96
2020-05-10input/tablet: simplify parameter plumbing for tablet referencesTudor Brindus
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`.
2020-05-02input: rename pointer handlers to be unambiguousTudor Brindus
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.
2020-05-02input: refactor tablet motion into seatop handlerTudor Brindus
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.
2020-05-02input/cursor: make cursor rebasing cursor type-agnosticTudor Brindus
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
2020-05-01input/cursor: release simulated tool tip button when over v2 surfaceTudor Brindus
d88460f addressed sending v2 tool tip up when over a non-v2 surface. This commit addresses the other direction. Fixes #5230.
2020-04-22input/cursor: fix hide cursor timeouts on tablets and touchscreensTudor Brindus
This commit refactors `cursor_handle_activity` to also take the idle source, so that it can be reused for tablet and touch activity. Previously, the timeouts would be tracked, but the cursor would never be un-hidden for anything but pointers. Fixes #5169.
2020-04-14input: Mark virtual devices as suchAndri Yngvason
This is for internal configuration purposes
2020-04-04im: make text-input listeners per text-inputxdavidwu
2020-04-04Port input method and text input from rootstonxdavidwu
This ports swaywm/wlroots#1203, swaywm/wlroots#1303, swaywm/wlroots#1308, swaywm/wlroots#1759 rootston part to sway. Co-Authored-By: Leo Chen <leo881003@gmail.com>
2020-03-11input: Add support for keyboard shortcuts inhibitMichael Weiser
Adding support for the keyboard shortcuts inhibit protocol allows remote desktop and virtualisation software to receive all keyboard input in order to pass it through to their clients so users can fully interact the their remote/virtual session. The software usually provides its own key combination to release its "grab" to all keyboard input. The inhibitor can be deactivated by the user by removing focus from the surface using another input device such as the pointer. Use support for the procotol in wlroots to add support to sway. Extend the input manager with handlers for inhibitor creation and destruction and appropriate bookkeeping. Attach the inhibitors to the seats they apply to to avoid having to search the list of all currently existing inhibitors on every keystroke and passing the inhibitor manager around. Add a helper function to retrieve the inhibitor applying to the currently focused surface of a seat, if one exists. Extend bindsym with a flag for bindings that should be processed even if an inhibitor is active. Conversely this disables all normal shortcuts if an inhibitor is found for the currently focused surface in keyboard::handle_key_event() since they don't have that flag set. Use above helper function to determine if an inhibitor exists for the surface that would eventually receive input. Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
2020-02-18treewide: fix typosTorstein Husebø
2020-01-05input/cursor: handle image surface destroyBrian Ashworth
This adds a listener for the destroy event of the cursor image surface. This prevents a use-after-free when the last visible image surface is freed, there has not been a new cursor set, and the cursor is reshown.