aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/input-manager.c
Commit message (Collapse)AuthorAge
* Implement transient seat managementLibravatar Andri Yngvason2024-03-18
|
* Fetch input device vendor/product from libinputLibravatar Simon Ser2024-03-07
| | | | References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4582
* input: Rename WLR_INPUT_DEVICE_TABLET_TOOL to WLR_INPUT_DEVICE_TABLETLibravatar Luofan Chen2024-03-01
| | | | | | | wlroots has changed the naming, causing the following build errors when building: error: ‘WLR_INPUT_DEVICE_TABLET_TOOL’ undeclared
* Define _POSIX_C_SOURCE globallyLibravatar Simon Ser2024-02-23
| | | | See discussion in https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4555
* input: reconfigure send_events on output hotplugLibravatar Simon Ser2024-01-02
| | | | Closes: https://github.com/swaywm/sway/issues/7890
* Chase wlroots!4440Libravatar llyyr2023-11-22
| | | | References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4440
* input/input-manager: drop input_manager_configure_all_inputsLibravatar Simon Ser2023-11-16
| | | | This is now unused.
* Only reconfigure input mappings on output changeLibravatar Simon Ser2023-11-16
| | | | | | Fully reconfiguring all input devices on output change takes a loooong time. Let's just reconfigure what we need: only mappings depend on outputs.
* input: Move wlr_pointer_gestures_v1 to sway_input_managerLibravatar Mark Bolhuis2023-06-26
| | | | | | | | On multi-seat configurations a zwp_pointer_gestures_v1 global was created for every seat. Instead, create the global once in the input manager, to be shared across all seats.
* Fix `bindsym --to-code` not respecting input configsLibravatar 33KK2023-06-11
| | | Fixes #7535
* Use format_str() throughoutLibravatar Simon Ser2023-04-14
|
* seat: Avoid sending redundant keymaps on reloadLibravatar Kenny Levinsen2022-12-04
| | | | | | | | | | | | | | | | | | | When we reload the config, we reset every input device and re-apply configuration from the config file. This means that the keyboard keymap is updated at least once during config reload, more if the config file contains keyboard configuration. When they keyboard keymap changes and is updated through wlr_seat, the keymap ends up sent to every keyboard bound in every client, seemingly multiple times. On an x230 of mine with a keyboard layout set in the config file, I see 42 keymap events sent to foot on config reload. Reduce events from keyboard configurations by skipping all but the currently active keyboard for the seat, and by clearing the active keyboard during input manager device reset. After this change, I only see a single just-in-time keymap event. Fixes: https://github.com/swaywm/sway/issues/6654
* Make libinput backend optionalLibravatar Simon Ser2022-11-28
|
* Fix keymap being NULL and segfaulting on dev addLibravatar Yaroslav de la Peña Smirnov2022-10-23
| | | | | | Moved `libinput_config` to the callers of `sway_input_configure_libinput_device` so that we send the event after the added event.
* Implement ext-session-lock-v1Libravatar Daniel De Graaf2022-04-29
|
* sway/input: use wlr_input_device from input device baseLibravatar Simon Zeni2022-02-21
|
* Replace unprintable characters in input device idLibravatar wb96882020-07-03
|
* input: disable events for map_to_output devices when output not presentLibravatar Tudor Brindus2020-06-19
| | | | Fixes #3449.
* input: fix reloading crash due to keyboard group configuringLibravatar Brian Ashworth2020-05-19
| | | | | | | | | | | | | | | | | | Keyboard group keyboards should not call sway_keyboard_configure. They do not have an input config and they derive their state from the keyboards within the group. For some reason, I got sway_keyboard_configure and seat_configure_keyboard mixed up and thought seat_reset_device called the latter. Calling sway_keyboard_configure with a keyboard group's keyboard is not supported and can cause issues. If any clients are listening to the ipc input event, a sigsegv will occur due to not every property - such as identifier - being wired up for keyboard group keyboard's. This also adds an assertion to sway_keyboard_configure to ensure that this does not occur in the future and any instances are quickly caught.
* input: reset keyboard groups keyboard on reset allLibravatar Brian Ashworth2020-05-14
| | | | | | | | | | | | | | | | | | | If the keyboard that triggers the reload binding is using the default keymap, default repeat delay, and default repeat rate, the associated keyboard group is never being destroyed on reload. This was causing the keyboard group's keyboard not to get disarmed and result in a use-after-free in handle_keyboard_repeat. If the keyboard was not using the defaults for all three settings, then it's associated keyboard would get destroyed during the reset - which did disarm the keyboard group's keyboard. In this case, the use-after-free would not occur. This adds a block to input_manager_reset_all_inputs that resets the keyboard for all keyboard groups in all seats, which will disarm them. Since the inputs are all being reset anyway, which will reset all individual keyboards, it is not necessary to be selective on which ones get reset.
* commands: Add per-view shortcuts_inhibitor commandLibravatar Michael Weiser2020-05-13
| | | | | | | | | | | | | | | | | | | | | 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>
* input: Mark virtual devices as suchLibravatar Andri Yngvason2020-04-14
| | | | This is for internal configuration purposes
* commands: Add shortcuts_inhibitor commandLibravatar Michael Weiser2020-03-11
| | | | | | | | | | | | | | | | | | | 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>
* input: Add support for keyboard shortcuts inhibitLibravatar Michael Weiser2020-03-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* input: Map virtual-pointer to the requested outputLibravatar Andri Yngvason2020-02-10
|
* input: Assign virtual input devices to their selected seatsLibravatar Andri Yngvason2020-01-01
|
* Add virtual pointer protocolLibravatar Josef Gajdusek2019-12-31
|
* config: improvements to the reload validationLibravatar Brian Ashworth2019-11-27
| | | | | | | | 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.
* Add support for wlr_keyboard_groupLibravatar Brian Ashworth2019-11-21
| | | | | | | | | | | | | | | | | 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.
* ipc: add input::libinput_config eventLibravatar Brian Ashworth2019-07-23
| | | | | | | | | This adds a libinput_config change type to the input event for when the libinput config for a device changes In order for this to be possible to track, the libinput config code had to be refactored. It is now extracted into a separate file to isolate it from the rest of the input management code.
* ipc: add an input eventLibravatar Brian Ashworth2019-07-23
| | | | | | | | | This adds an ipc event related to input devices. Currently the following changes are supported: - added: when an input device becomes available - removed: when an input device is no longer available - xkb_keymap_changed: (keyboards only) the keymap changed - xkb_layout_changed: (keyboards only) the effective layout changed
* input/libinput: only reset supported optionsLibravatar Brian Ashworth2019-07-09
| | | | | | | | This adds checks to the input_manager_libinput_reset_* functions to only attempt resetting supported options on reload. This should have no functional difference to the user, but will remove several `Failed to apply libinput config: Unsupported configuration option` lines from the log that can be noisy and potential red herrings.
* Add calibration_matrix config optionLibravatar Sergei Dolgov2019-07-05
| | | | | | | | | | | | | | | | | | | | | | Can be used to change the orientation of a touchscreen. Example usage with swaymsg: # identity swaymsg input type:touch calibration_matrix '"1 0 0 0 1 0"' # 90 degree clockwise swaymsg input type:touch calibration_matrix '"0 -1 1 1 0 0"' # 180 degree clockwise swaymsg input type:touch calibration_matrix '"-1 0 1 0 -1 1"' # 270 degree clockwise swaymsg input type:touch calibration_matrix '"0 1 0 -1 0 1"' Documentation: https://wayland.freedesktop.org/libinput/doc/latest/absolute-axes.html#calibration-of-absolute-devices
* Implement input type configs (#3784)Libravatar Benjamin Cheng2019-04-14
| | | | | | | | | | | Add support for configurations that apply to a type of inputs (i.e. natural scrolling on all touchpads). A type config is differentiated by a `type:` prefix followed by the type it corresponds to. When new devices appear, the device config is merged on top of its type config (if it exists). New type configs are applied on top of existing configs.
* Add heuristics to differentiate touchpadsLibravatar Benjamin Cheng2019-04-14
| | | | | | | Use libinput_device_config_tap_get_finger_count to determine whether a pointer is a touchpad. swaymsg is also updated to reflect the new touchpad type.
* Support WLR_INPUT_DEVICE_SWITCH in swayLibravatar Ryan Walklin2019-03-19
| | | | | | | | | | | | | | | | | | | | | This commit adds support for laptop lid and tablet mode switches as provided by evdev/libinput and handled by wlroots. Adds a new bindswitch command with syntax: bindswitch <switch>:<state> <command> Where <switch> is one of: tablet for WLR_SWITCH_TYPE_TABLET_MODE lid for WLR_SWITCH_TYPE_LID <state> is one of: on for WLR_SWITCH_STATE_ON off for WLR_SWITCH_STATE_OFF toggle for WLR_SWITCH_STATE_TOGGLE (Note that WLR_SWITCH_STATE_TOGGLE doesn't map to libinput and will trigger at both on and off events)
* seat_cmd_cursor: do not create non-existing seatLibravatar Brian Ashworth2019-02-03
| | | | | | | | If a seat does not exist in seat_cmd_cursor, do not create it. A seat without any attachments is useless since it will have no capabilities. This changes `input_manager_get_seat` to have an additional argument that dictates whether or not to create the seat if it does not exist.
* Fix one remaining wlr_log callLibravatar emersion2019-01-21
|
* Replace wlr_log with sway_logLibravatar M Stoeckl2019-01-21
| | | | | | | | | | | | | This commit mostly duplicates the wlr_log functions, although with a sway_* prefix. (This is very similar to PR #2009.) However, the logging function no longer needs to be replaceable, so sway_log_init's second argument is used to set the exit callback for sway_abort. wlr_log_init is still invoked in sway/main.c This commit makes it easier to remove the wlroots dependency for the helper programs swaymsg, swaybg, swaybar, and swaynag.
* Log libinput_config_status errorsLibravatar Brian Ashworth2019-01-21
| | | | | | This add errors from calls to `libinput_device_config_*_set` to the debug log. This may be useful when looking at issues related to input devices and config settings not working.
* reload: reset input configsLibravatar Brian Ashworth2019-01-09
| | | | | This resets all input options to their defaults on reload. This also fixes some debug log typos in `input_manager_libinput_config_pointer`.
* stringop.c: rewrite strip_whitespaceLibravatar Ian Fan2019-01-01
|
* Apply implicit fallback seat configLibravatar Brian Ashworth2018-12-31
| | | | | | The implicit fallback seat config needs to be applied (if created). Otherwise, the input devices will still be removed from the implicit default seat on reload when there is any seat config.
* Verify seat fallback settings on reloadLibravatar Brian Ashworth2018-12-30
| | | | | | | | | | | | | This fixes an issue where on reload, all input devices that were added via an implicit fallback to the default seat would be removed from the default seat and applications would crash due to the seat having no capabilities. On reload, there is a query for a seat config with the fallback setting set (it can either be true or false). If no such seat config exists, the default seat is created (if needed) and has the implicit fallback true applied to its seat config. This is the same procedure that occurs when a new input is detected.
* Revamp seat configsLibravatar Brian Ashworth2018-12-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes seat configs work like output and input configs do. This also adds support for wildcard seat configs. A seat config is still created in the main seat command handler, but instead of creating a new one in the subcommands and destroying the main seat command's instance, the seat subcommands modify the main one. The seat config is then stored, where it is merged appropriately. The seat config returned from `store_seat_config` is then applied. When attempting to apply a wildcard seat config, a seat specific config is queried for and if found, that is used. Otherwise, the wildcard config is applied directly. Additionally, instead of adding input devices to the default seat directly when there is no seat configs, a seat config for the default seat is created with only fallback set to true, which is more explicit. It also fixes an issue where running a seat command at runtime (with no seat config in the sway config), would result in all input devices being removed from the default seat and leaving sway in an unusable state. Also, instead of checking for any seat config, the search is for a seat config with a fallback option seat. This makes it so if there are only seat configs with fallback set to -1, the default seat is still created since there is no explicit notion on what to do regarding fallbacks. However, if there is even a single fallback 0, then the default seat is not used as a fallback. This will be needed for seat subcommands like hide_cursor where the user may only want to set that property without effecting anything else.
* Replace _XOPEN_SOURCE with _POSIX_C_SOURCELibravatar emersion2018-11-25
| | | | And make sure we don't define both in the same source file.
* input-manager: consider cursor warping on input_manager_set_focusLibravatar Rouven Czerwinski2018-10-28
| | | | | | input_manager_set_focus is used to set the focus after mapping the view in view_map. This needs to consider to warp the cursor as well, since for WARP_CONTAINER, the cursor should warp to the newly created view.
* Fix crash when defaut seat is not createdLibravatar Mihai Coman2018-10-20
| | | | Function input_manager_get_default_seat should always return a seat.
* Minor refactor of input managerLibravatar Ryan Dwyer2018-10-20
| | | | | | | | | | | | | | | | | | | | | The input manager is a singleton object. Passing the sway_input_manager argument to each of its functions is unnecessary, while removing the argument makes it obvious to the caller that it's a singleton. This patch removes the argument and makes the input manager use server.input instead. On a similar note: * sway_input_manager.server is removed in favour of using the server global. * seat.input is removed because it can get it from server.input. Due to a circular dependency, creating seat0 is now done directly in server_init rather than in input_manager_create. This is because creating seats must be done after server.input is set. Lastly, it now stores the default seat name using a constant and removes a second reference to seat0 (in input_manager_get_default_seat).
* cmd_bind{sym,code}: Implement per-device bindingsLibravatar Brian Ashworth2018-10-18
| | | | | bindsym --input-device=<identifier> ... bindcode --input-device=<identifier> ...