aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input
Commit message (Collapse)AuthorAge
...
| * | Refactor seat operations to use an interfaceLibravatar Ryan Dwyer2019-01-10
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This splits each seat operation (drag/move tiling/floating etc) into a separate file and introduces a struct sway_seatop_impl to abstract the operation. The move_tiling_threshold operation has been merged into move_tiling. The main logic for each operation is untouched aside from variable renames. The following previously-static functions have been made public: * node_at_coords * container_raise_floating * render_rect * premultiply_alpha * scale_box
* | Merge pull request #3388 from RedSoxFan/reset-inputs-on-reloadLibravatar Drew DeVault2019-01-13
|\ \ | |/ |/| reload: reset input configs
| * 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`.
* | Merge pull request #3341 from RedSoxFan/mouse-bindings-improvedLibravatar Ian Fan2019-01-10
|\ \ | | | | | | Improve mouse button parsing: helpers and bind{code/sym}
| * | Add helpers for improved mouse button parsingLibravatar Brian Ashworth2019-01-09
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following helper functions have been added to aid with parsing mouse buttons from a string: 1. `get_mouse_bindsym`: attempts to parse the string as an x11 button (button[1-9]) or as an event name (ex BTN_LEFT or BTN_SIDE) 2. `get_mouse_bindcode`: attempts to parse the string as an event code and validates that the event code is a button (starts with `BTN_`). 3. `get_mouse_button`: this is a conveniency function for callers that do not care whether a bindsym or bindcode are used and attempts to parse the string as a bindsym and then bindcode. None of these functions are used in this commit. The sole purpose of this commit is to make the larger set more granular and easier to review/manipulate. There will be a series of commits following this one that will modify any command which uses a mouse button to use these helpers.
* | Merge pull request #3399 from RedSoxFan/fix-output-destruction-segfaultsLibravatar emersion2019-01-10
|\ \ | | | | | | Fix segfaults on output destruction
| * | Fix segfaults on output destructionLibravatar Brian Ashworth2019-01-10
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes two causes of segfaulting when an output is destroyed. The first occurred when an output was never enabled. The issue was that the destroy signal was never initialized so when it was emitted, sway segfaulted. This was fixed by moving the initialization into `output_create` since all outputs, regardless of whether they have ever been enabled, will be destroyed at some point. The second occurred when the cursor was on an output that was being destroyed. The sway output would have already been removed, but if there are other outputs, a cursor rebase would still occur. Since the wlr_output still existed and the sway output was destroyed, the cursor could be over nothing, resulting in a segfault when trying to get the sway output, which was destroyed.
* / cursor: allow scrolling tabs/stack on title borderLibravatar Brian Ashworth2019-01-09
|/ | | | | | This allows tabbed and stacked containers to be scrolled through when the cursor is over the border of the title bar. The borders around the other three edges of the contents should not be affected by this change.
* Simplify evdev includes on FreeBSD by relying on up-to-date packageLibravatar Jan Beich2019-01-09
| | | | | | | | | | | | evdev-proto is installed by a dependency, so some files have been missed: In file included from ../sway/input/cursor.c:3: /usr/local/include/libevdev-1.0/libevdev/libevdev.h:30:10: fatal error: 'linux/input.h' file not found #include <linux/input.h> ^~~~~~~~~~~~~~~ ../swaybar/i3bar.c:3:10: fatal error: 'linux/input-event-codes.h' file not found #include <linux/input-event-codes.h> ^~~~~~~~~~~~~~~~~~~~~~~~~~~
* keyboard: update repeat timer before executionLibravatar Brian Ashworth2019-01-09
| | | | | | Since the keyboard can be destroyed by executing a binding (reloading with a different seat attachment config), update the repeat timer before executing the binding.
* Merge pull request #3385 from robertgzr/reset_output_mappingLibravatar Drew DeVault2019-01-08
|\ | | | | cursor: allow mapping to all outputs
| * cursor: allow mapping to all outputsLibravatar Robert Günzler2019-01-09
| | | | | | | | Running `input "<input>" map_to_output *` resets the mapping to all outputs
* | Merge pull request #3275 from ianyfan/remove-readlineLibravatar emersion2019-01-08
|\ \ | | | | | | Rewrite strip_whitespace and remove readline.c
| * | stringop.c: rewrite strip_whitespaceLibravatar Ian Fan2019-01-01
| | |
* | | seat: unhide the cursor if it is warped to focusLibravatar Rouven Czerwinski2019-01-07
| | | | | | | | | | | | | | | | | | Unhide the cursor if container warping is enabled. Also set the image_surface to NULL during view_unmap, otherwise the cursor will try to access the surface which is currently being unmapped.
* | | cursor: move unhide and timeout retrieval into separate functionsLibravatar Rouven Czerwinski2019-01-07
| |/ |/| | | | | | | The unhide and timeout retrieval functions are needed in a later commit. No functional changes.
* | Apply tiling_drag_threshold to all containersLibravatar David962019-01-03
| |
* | Implement tiling_drag_thresholdLibravatar Brian Ashworth2019-01-02
|/ | | | | | | | | Implements `tiling_drag_threshold <threshold>` to prevent accidental dragging of tiling containers. If a container (and all of its descendants) are unfocused and the tile bar is pressed, a threshold will be used before actually starting the drag. Once the threshold has been exceeded, the cursor will change to the grab icon and the operation will switch from `OP_MOVE_TILING_THRESHOLD` to `OP_MOVE_TILING`.
* 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.
* hide_cursor: change to a seat subcommandLibravatar Brian Ashworth2018-12-30
| | | | | This makes hide_cursor a seat subcommand, which allows for seat specific timeouts.
* 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.
* Remove button from state on release during opLibravatar Brian Ashworth2018-12-29
| | | | | | | This fixes a bug in `dispatch_cursor_button` where if there was an operation occurring, the button would not be removed from the state on release. This resulted in the button appearing to be permanently pressed and caused mouse bindings to not match correctly.
* Split image_surface handling into own functionLibravatar Brian Ashworth2018-12-25
|
* Implement hide_cursor <timeout> commandLibravatar Brian Ashworth2018-12-25
| | | | | Allows the cursor to be hidden after a specified timeout in milliseconds
* Change mouse buttons to x11 map and libevdev namesLibravatar Brian Ashworth2018-12-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This modifies the way mouse bindings are parsed. Instead of adding to BTN_LEFT, which results in button numbers that may not be expected, buttons will be parsed in one of the following ways: 1. `button[1-9]` will now map to their x11 equivalents. This is already the case for bar bindings. This adds support for binding to axis events, which was not possible in the previous approach. 2. Anything that starts with `BTN_` will be parsed as an event code name using `libevdev_event_code_from_name`. This allows for any button to be mapped to instead of limiting usage to the ones near BTN_LEFT. This also adds a dependency on libevdev, but since libevdev is already a dependency of libinput, this should be fine. If needed, this option can have dependency guards added. Binding changes: - button1: BTN_LEFT -> BTN_LEFT - button2: BTN_RIGHT -> BTN_MIDDLE - button3: BTN_MIDDLE -> BTN_RIGHT - button4: BTN_SIDE -> SWAY_SCROLL_UP - button5: BTN_EXTRA -> SWAY_SCROLL_DOWN - button6: BTN_FORWARD -> SWAY_SCROLL_LEFT - button7: BTN_BACK -> SWAY_SCROLL_RIGHT - button8: BTN_TASK -> BTN_SIDE - button9: BTN_JOYSTICK -> BTN_EXTRA Since the axis events need to be mapped to an event code, this uses the following mappings to avoid any conflicts: - SWAY_SCROLL_UP: KEY_MAX + 1 - SWAY_SCROLL_DOWN: KEY_MAX + 2 - SWAY_SCROLL_LEFT: KEY_MAX + 3 - SWAY_SCROLL_RIGHT: KEY_MAX + 4
* Combine output_by_name and output_by_identifierLibravatar Brian Ashworth2018-12-20
| | | | | | | | This combines `output_by_name` and `output_by_identifier` into a single function called `output_by_name_or_id`. This allows for output identifiers to be used in all commands, simplifies the logic of the callers, and is more efficient since worst case is a single pass through the output list.
* Focus node before tiling drag if on titlebarLibravatar Brian Ashworth2018-12-17
| | | | | Before attempting to drag a tiling container by its titlebar, focus it. This fixes clicking on titlebars to focus a container.
* Allow tiling views to be dragged by the titlebarLibravatar Brian Ashworth2018-12-17
| | | | | | Enables titling views to be dragged by the titlebar. This is in addition to using the modifier and dragging them from anywhere on the container surface. Floating views already allow this behavior.
* Update for swaywm/wlroots#1377Libravatar Rostislav Pehlivanov2018-12-16
| | | | -Werror is eͫ̐ͭ҉vi͆ͦ̏ͦlͥ̀͒̊͂͛
* Fix focusing on non-visible workspaceLibravatar Brian Ashworth2018-12-14
| | | | | | My previous attempt was not quite right. Changing the focus stack on a non-visible workspace should only be blocked if the focus would be set to the workspace itself
* Keep focus when destroying containers on nonvis wsLibravatar Brian Ashworth2018-12-12
| | | | | | | | | | | | | | | | Changing the focus stack when destroying a container's node on a non-visible workspace (on an non-focused output) incorrectly causes the non-visible workspace to become visible. If the workspace is empty, it will not be destroyed since it is now visible. Additionally since there was no workspace::focus event, swaybar still shows the previous workspace as focus-inactive. It also makes no sense to change visible workspaces due to a container on a non-visible workspace being destroyed. Since the focus will either be set when switching to the non-visible workspace or the workspace will be destroyed due to being empty, there is no need to change the focus stack when destroying a container on a non-visible workspace.
* Replace _XOPEN_SOURCE with _POSIX_C_SOURCELibravatar emersion2018-11-25
| | | | And make sure we don't define both in the same source file.
* Add scroll factor config option.Libravatar Spencer Michaels2018-11-18
|
* Use #if instead of #ifdefLibravatar emersion2018-11-18
|
* Move view {x,y,width,height} into container structLibravatar Ryan Dwyer2018-11-17
| | | | | | | | | | | | | | | | | | | This renames/moves the following properties: * sway_view.{x,y,width,height} -> sway_container.content_{x,y,width,height} * This is required to support placeholder containers as they don't have a view. * sway_container_state.view_{x,y,width,height} -> sway_container_state.content_{x,y,width,height} * To remain consistent with the above. * sway_container_state.con_{x,y,width,height} -> sway_container_state.{x,y,width,height} * The con prefix was there to give it contrast from the view properties, and is no longer useful. The function container_set_geometry_from_floating_view has also been renamed to container_set_geometry_from_content.
* Fix segfault in dispatch_cursor_buttonLibravatar emersion2018-11-15
|
* Add focus_follows_mouse always. (#3081)Libravatar Connor E2018-11-06
| | | | | | | | * Add focus_follows_mouse_mode. * Fail if focus_follows_mouse is invalid. * Fix indentation.
* removed unneeded code fragmentLibravatar madblobfish2018-11-04
|
* Merge pull request #3021 from Snaipe/singlekey-binding-triggerLibravatar Drew DeVault2018-11-03
|\ | | | | binding: match single-key bindings if no multi-key binding matched
| * binding: match single-key bindings if no multi-key binding matchedLibravatar Franklin "Snaipe" Mathieu2018-10-29
| | | | | | | | | | | | | | This makes bindings more snappy when the user is typing faster than his keycaps are releasing. Signed-off-by: Franklin "Snaipe" Mathieu <me@snai.pe>
* | Move view border properties to container structLibravatar Ryan Dwyer2018-10-31
| | | | | | | | | | | | This will be needed to implement layout saving and restoring, as we need to be able to configure borders on a placeholder container which has no view.
* | cursor: fix uninitialized pointer in cursor_rebaseLibravatar mwenzkowski2018-10-28
| |
* | Merge pull request #3010 from Emantor/fix/cursor_warping_view_mapLibravatar Drew DeVault2018-10-28
|\ \ | | | | | | input-manager: consider cursor warping on input_manager_set_focus
| * | 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.
* | | seat: don't traverse the list to check if it's emptyLibravatar Konstantin Kharlamov2018-10-27
|/ / | | | | | | | | | | Found by introspection. Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
* / Fix focus after a non-visible workspace's last container is destroyedLibravatar Ryan Dwyer2018-10-26
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | The code being changed is responsible for updating the focus stack when a container is destroyed in a different part of the tree to where the real focus is. It's attempting to set focus_inactive to a sibling (or parent if no siblings) of the container that is being destroyed, then put our real focus back on the end of the focus stack. The problem occurs when the container being destroyed is in a different workspace. For example: * Have a focused view on workspace 1 * Have workspace 2 not visible with a single view that is unmapping * The first call to seat_set_raw_focus sets focus to workspace 2 because it's the parent * Prior to this patch, the second call to seat_set_raw_focus would set focus to the view on workspace 1 * Later, when using output_get_active_workspace, this function would return workspace 2 because it's the first workspace it finds in the focus stack. To fix this, workspace 1 must be placed on the focus stack between workspace 2 and the focused view. That's what this patch does. Lastly, it also uses seat_get_focus_inactive to choose the focus. This fixes a crash when a view unmaps while a non-container is focused (eg. swaylock), because focus is NULL.
* Rebase the cursor after applying transactionsLibravatar Ryan Dwyer2018-10-25
| | | | | | | | | | | | This approaches cursor rebasing from a different angle. Rather than littering the codebase with cursor_rebase calls and using transaction callbacks, this just runs cursor_rebase after applying every transaction - but only if there's outputs connected, because otherwise it causes a crash during shutdown. There is one known case where we still need to call cursor_rebase directly, and that's when running `seat seat0 cursor move ...`. This command doesn't set anything as dirty so no transaction occurs.
* When scrolling on a tab titlebar, set focus_inactive if not focusedLibravatar Ryan Dwyer2018-10-24
| | | | | | | | | | For example, create layout H[view T[view view view]], focus the view in the hsplit and scroll the mouse wheel over the tab title bars. Prior to this patch, focus would be given to a descendant of the tabbed container. This patch keeps the focus on the hsplit view. This also renames some of the variables used in this part of the code to make it be easier to follow.
* seat_update_capabilities: Set cursor image while we have the capabilityLibravatar Ryan Dwyer2018-10-23
|