aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input
Commit message (Collapse)AuthorAge
* 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
|
* Fix dormant cursor when using multiple seatsLibravatar Ryan Dwyer2018-10-23
| | | | | | The cursor's image would be removed or set when the seat's capabilities were updated, but there was nothing to prevent the image from being set at other times.
* Make workspace back_and_forth seat-specificLibravatar Ryan Dwyer2018-10-21
| | | | | | | | * When using multiple seats, each seat has its own prev_workspace_name for the purpose of workspace back_and_forth. * Removes prev_workspace_name global variable. * Removes unused next_name_map function in tree/workspace.c. * Fixes memory leak in seat_destroy (seat was not freed).
* Merge pull request #2888 from RyanDwyer/remove-raise-floatingLibravatar Drew DeVault2018-10-20
|\ | | | | Remove raise_floating directive
| * Remove raise_floating directiveLibravatar Ryan Dwyer2018-10-20
| | | | | | | | | | | | | | | | | | | | | | | | | | The directive controlled whether floating views should raise to the top when the cursor is moved over it while using focus_follows_mouse. The default was enabled, which is undesirable. For example, if you have two floating views where one completely covers the other, the smaller one would be inaccessible because moving the mouse over the bigger one would raise it above the smaller one. There is no known use case for having raise_floating enabled, so this patch removes the directive and implements the raise_floating disabled behaviour instead.
* | 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).
* Merge pull request #2872 from RyanDwyer/cursor-rebaseLibravatar Drew DeVault2018-10-20
|\ | | | | Introduce cursor_rebase
| * Introduce cursor_rebaseLibravatar Ryan Dwyer2018-10-19
| | | | | | | | | | This function "rebases" the cursor on top of whatever is underneath it, without triggering any focus changes.
* | Fix crash when ending tiling dragLibravatar Ryan Dwyer2018-10-20
|/ | | | | | | If the container being dragged has a parent that needs to be reaped, it must be reaped after we've reinserted the dragging container into the tree. During reaping, handle_seat_node_destroy tries to refocus the dragging container which isn't possible while it's detached.
* Fix logic used for mouse_warping outputLibravatar Ryan Dwyer2018-10-19
| | | | | Turns out we don't need to store the previous focus, and it should be based on which output the cursor was in.
* Merge pull request #2875 from RedSoxFan/input-device-bindingsLibravatar Drew DeVault2018-10-19
|\ | | | | cmd_bind{sym,code}: Implement per-device bindings
| * cmd_bind{sym,code}: Implement per-device bindingsLibravatar Brian Ashworth2018-10-18
| | | | | | | | | | bindsym --input-device=<identifier> ... bindcode --input-device=<identifier> ...
* | Consider cursor warp when switching workspacesLibravatar Ryan Dwyer2018-10-19
|/ | | | | | | | | Fixes a regression introduced in 24a90e5d86441fc345356eb3767e5a6880dcedbd. consider_warp_to_focus has been renamed to seat_consider_warp_to_focus, moved to seat.c and made public. It is now called when switching workspaces via `workspace <ws>`.
* Remove cursor warping from seat_set_focusLibravatar Ryan Dwyer2018-10-18
| | | | | | | | | | | | Because cursor warping was the default behaviour in seat_set_focus, there may be cases where we may have been warping the cursor unintentionally. This patch removes cursor warping from seat_set_focus and only does it in the focus command. This is managed by a static function in focus.c. To know whether to warp or not, we need to know which node had focus previously. To keep track of this easily, seat->prev_focus has been introduced and is set to the previous in seat_set_focus.
* Merge pull request #2820 from Emantor/fix-mouse-warping-containerLibravatar Drew DeVault2018-10-17
|\ | | | | Fix mouse warping container
| * seat: use new warping functions for cursor warping during focus warpLibravatar Rouven Czerwinski2018-10-16
| |
| * cursor: functions to warp cursor to container and workspaceLibravatar Rouven Czerwinski2018-10-16
| | | | | | | | | | | | The new functions allow a cursor to be warped without changing the focus. This is a preparation commit to handle cursor warping not only in seat_set_focus_warp.
* | Prevent duplicate workspace::focus eventsLibravatar Ryan Dwyer2018-10-16
| | | | | | | | | | | | | | | | | | | | | | | | Previously we would compare the last focus's workspace with the new focus's workspace to determine if we need to emit an IPC workspace::focus event. This doesn't work when moving the focused container to a new workspace. This adds a workspace property to the seat which stores the last emitted workspace::focus workspace. Using this method, after moving the container, refocusing it will trigger exactly one workspace::focus event: from the old workspace to the new workspace.
* | Introduce seat_set_raw_focus and remove notify argument from seat_set_focus_warpLibravatar Ryan Dwyer2018-10-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces seat_set_raw_focus: a function that manipulates the focus stack without doing any other behaviour whatsoever. There are a few places where this is useful, such as where we set focus_inactive followed by another call to set the real focus again. With this change, the notify argument to seat_set_focus_warp is also removed as these cases now use the raw function instead. A bonus of this is we are no longer emitting window::focus IPC events when setting focus_inactive, nor are we sending focus/unfocus events to the surface. This also fixes the following: * When running `move workspace to output <name>` and moving the last workspace from the source output, the workspace::focus IPC event is no longer emitted for the newly created workspace. * When splitting the currently focused container, unfocus/focus events will not be sent to the surface when giving focus_inactive to the newly created parent, and window::focus events will not be emitted.
* | swaybar: show hidden bar on key eventLibravatar Ian Fan2018-10-14
|/ | | | | | Since wayland does not currently allow swaybar to create global keybinds, this is handled within sway and sent to the bar using a custom event, so as not to pollute existing events, called bar_state_update.
* Add libinput send_events config for touchLibravatar Thiago Mendes2018-10-10
|
* Merge pull request #2806 from v-gu/add-libinput-support-for-keyboardLibravatar Drew DeVault2018-10-10
|\ | | | | add libinput config for keyboard