aboutsummaryrefslogtreecommitdiff
path: root/sway/input
AgeCommit message (Collapse)Author
2020-04-04im: Fix crash when im destorying and no focused surface existsLeo
2020-04-04im: remove listener on pending surface destoryedxdavidwu
2020-04-04im: make text-input listeners per text-inputxdavidwu
2020-04-04input-method: avoid and log unneeded set_focusxdavidwu
2020-04-04input-method: remove surface listener before setxdavidwu
This make sure pending focused surface listener is not reachable from old surface.
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-04-03swapped hiding the cursor and sending a touch event as a more logical sequenceSome Chinese Guy
2020-03-30add --no-repeat option for bindingsLinus Heckemann
This allows e.g. triggering one command while a key is held, then triggering another to undo the change performed by it afterwards. One use case for this is triggering push-to-talk functionality for VoIP tools without granting them full access to all input events. Fixes #3151
2020-03-29switched to setting focus with seat_set_focusSome Chinese Guy
2020-03-29Added focus following for touch_downSome Chinese Guy
2020-03-23Fix redundant call to seat_send_focus()Leo
This commit fix calling to seat_send_focus() twice when a view is closed. This codes revert #2580, but the original issue nolonger exists.
2020-03-16sway/input/cursor.c: fix undefined behaviour when event is NULLJason Nader
2020-03-15sway/input/cursor.c: move NULL check to where it should beJason Nader
2020-03-12input: Avoid creating the PAD device multiple timesOlivier Fourdan
If a pad device for a tablet exists, reloading the configuration, removing/reading the device or even suspending the system will recreate the same Wayland input device multiple times. Make sure we don't re-create the same Wayland device more than necessary. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2020-03-11commands: Add shortcuts_inhibitor commandMichael Weiser
Add a command to influence keyboard shortcuts inhibitors. In its current form it can be used to activate, deactivate or toggle an existing inhibitor on the surface currently receiving input. This can be used to define an escape shortcut such as: bindsym --inhibited $mod+Escape seat - shortcuts_inhibitor deactivate It also allows the user to configure a per-seat default of whether keyboard inhibitors are honoured by default (the default) or not. Using the activate/toggle command they can then enable the lingering inhibitor at a later time of their choosing. As a side effect this allows to specifically address a named seat for actions as well, whatever use-case that might serve. Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
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-10input: Map virtual-pointer to the requested outputAndri Yngvason
2020-01-06input/cursor: handle setting a NULL image surfaceBrian Ashworth
This fixes a crash when attempting to listen to a signal on a NULL cursor image surface. If the surface is NULL, the listener is just reinitialized using wl_list_init.
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.
2020-01-01input: Assign virtual input devices to their selected seatsAndri Yngvason
2019-12-31Add virtual pointer protocolJosef Gajdusek
2019-12-16seat_cmd_keyboard_grouping: change keymap to smartBrian Ashworth
This removes `seat <seat> keyboard_grouping keymap` and replaces it with `seat <seat> keyboard_grouping smart`. The smart keyboard grouping will group based on both the keymap and repeat info. The reasoning for this is that deciding what the repeat info should be for a group is either arbitrary or non-deterministic when multiple keyboards in the group have repeat info configured (unless somehow exposed to the user in a reproducible uniquely identifiable fashion).
2019-12-16input/seatop_default: fix focusing floating titlesBrian Ashworth
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.
2019-12-13input/keyboard: defer wlr_keyboard_group destroyBrian Ashworth
This defers the destruction of wlr_keyboard_groups until idle. This is to prevent the keyboard group's keyboard from being destroyed in the middle of handling a keyboard event. This would occur when changing the keymap of the last keyboard in a group with a keyboard binding. The prevents crashing when attempting to update the xkb state of the keyboard group's keyboard. The sway_keyboard_group is still immediately destroyed so that the group is no longer used
2019-12-13input/keyboard: remove group listeners on destroyBrian Ashworth
This adds two missing calls to wl_list_remove to remove the key and modifier listeners for the keyboard group's keyboard when destroying the keyboard group. This fixes some crashes when changing the keymap of the last keyboard in a group with a keyboard binding.
2019-12-12Add seat <seat> idle_{inhibit,wake} <sources...>Drew DeVault
This adds seat configuration options which can be used to configure what events affect the idle behavior of sway. An example use-case is mobile devices: you would remove touch from the list of idle_wake events. This allows the phone to stay on while you're actively using it, but doesn't wake from idle on touch events while it's sleeping in your pocket.
2019-12-07input/cursor: remove gesture listeners in destroyBenjamin Cheng
Part of #4794. Forgot to remove gesture listeners when the cursor is destroyed.
2019-12-07input/cursor: pass gesture events to clientsBenjamin Cheng
Some wayland clients (mostly GTK3 apps) like eog or evince support gestures like pinch-to-zoom. These gestures are given to clients via the pointer_gestures_v1 protocol. This is already supported in wlroots, so we just need to hook up the events here in sway. Fixes #4724
2019-11-28input/keyboard: reset seat keyboard on destroyBrian Ashworth
If a sway keyboard is being destroyed, then the keyboard is being removed from a seat. If the associated wlr_keyboard is the currently set keyboard for the wlr_seat, then we need to reset the wlr_seat's keyboard to NULL so it doesn't reference an invalid device for the seat. The next configured keyboard from the seat or the next keyboard from that seat that has an event will then become the seat keyboard. Similarly, this needs to be done for a wlr_keyboard_group's keyboard when the wlr_keyboard_group is being destroyed.
2019-11-27config: improvements to the reload validationBrian Ashworth
For the validation pass of reloading, there is no need to touch swaybg, swaynag, inputs, outputs, or seats. This drastically improves the speed of a reload by skipping over the expensive I/O configuration and handling of wayland clients. As long as the syntax is valid, the CMD_FAILURE's can be relayed during the actual reload.
2019-11-26input/keyboard: check keyboard group before removeBrian Ashworth
In sway_keyboard_destroy, only remove the keyboard from a keyboard group, if it is part of a keyboard group. If the keyboard is not part of a keyboard group, then there is nothing to remove it from
2019-11-24input: seat: Fix seat device list not initialised before usePaul Riou
When being created, non first seats would get through the list of devices without the list being first initialised -> segfault. Issue introduced with ab0248a54564b2f644b6fb367f9eb44fe0bf5f3c Fixes #4750: Crash when reloading Sway with multiple seats configured
2019-11-21Add support for wlr_keyboard_groupBrian Ashworth
A wlr_keyboard_group allows for multiple keyboard devices to be combined into one logical keyboard. This is useful for keyboards that are split into multiple input devices despite appearing as one physical keyboard in the user's mind. This adds support for wlr_keyboard_groups to sway. There are two keyboard groupings currently supported, which can be set on a per-seat basis. The first keyboard grouping is none, which disables all grouping and provides no functional change. The second is keymap, which groups the keyboard devices in the seat by their keymap. With this grouping, the effective layout and repeat info is also synced across keyboard devices in the seat. Device specific bindings will still be executed as normal, but everything else related to key and modifier events will be handled by the keyboard group's keyboard.
2019-11-21input/keyboard: cleanup xkb_file error handingBrian Ashworth
This fixes an inverted fclose return value check and simplifies the error handling and logging for xkb_file in sway_keyboard_compile_keymap
2019-11-17Use an enum instead of a marker string for map_to_Tadeo Kondrak
2019-11-17Implement input map_to_region commandTadeo Kondrak
2019-11-08seatop_default: handle focus for unmanaged xwayland windows lastRonan Pigott
Fixes #4707
2019-11-04seatop_default: handle focus for xwayland_unmanaged viewsRonan Pigott
2019-11-04seatop_move_floating: make container respect pointer constraintRonan Pigott
2019-11-01seat: simplify a strduplbonn
2019-10-23Fix tiled containers resize with mouseKirill Chibisov
Fixes regression introduced in 2c1a11016ccb7646a74de51eff003c18e5aa7902
2019-10-16Updates per wlroots layer shell changesDrew DeVault
2019-09-25input: Add support for tablet protocol.John Chadwick
Sway has basic support for drawing tablets, but does not expose properties such as pressure sensitivity. This implements the wlr tablet v2 protocol, providing tablet events to Wayland clients.
2019-09-05Do not search for edges on subsurfaces, fix #4381Versus Void
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-04seatop_default: only focus container on pressBrian Ashworth
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-01layer-shell: don't give focus to unmapped layer surfacesSimon Ser
Focused layers are not cleared when destroyed, they are cleared on unmap. Giving focus to an unmapped layer surface is (1) incorrect and (2) triggers a use-after-free. Closes: https://github.com/swaywm/sway/issues/4517
2019-08-31seat: set cursor image only if no pointer cap previouslyxdavidwu
This make seat_update_capabilities set cursor image only if there was no pointer cap before update. This avoid resetting cursor to left_ptr if an input device is removed.
2019-08-31seat: avoid unneeded reloading xcursor themexdavidwu
Load xcursor theme on configuring pointer or tablet tool only if there was no pointer cap before.
2019-08-20input/keyboard: send released only if pressed sentBrian Ashworth
This keeps track of whether surfaces received a key press event and will only send a key release event if the pressed event was sent. This also requires changing the keycodes that are sent via wl_keyboard_enter to only include those that were previously sent. This makes it so surfaces do not receive key release events for keys that they never received a key press for and makes it so switching focus doesn't leak keycodes that were consumed by bindings.
2019-08-16input/seatop_down: add axis handlerBrian Ashworth
This adds an axis handler to seatop_down so that it is possible to manually scroll while having a mouse button down. This is mainly useful for selecting text. Some applications may not automatically scroll when the cursor is near the edge of the application or the user may just prefer manually scrolling for more control over the scrolling speed.