aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/seat.c
Commit message (Collapse)AuthorAge
...
* Merge pull request #3402 from RyanDwyer/refactor-seatopsLibravatar Drew DeVault2019-01-13
|\ | | | | Refactor seat operations to use an interface
| * 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
* | 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`.
* 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> ^~~~~~~~~~~~~~~~~~~~~~~~~~~
* 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
* | 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.
* 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`.
* hide_cursor: change to a seat subcommandLibravatar Brian Ashworth2018-12-30
| | | | | This makes hide_cursor a seat subcommand, which allows for seat specific timeouts.
* 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.
* 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.
* Use #if instead of #ifdefLibravatar emersion2018-11-18
|
* removed unneeded code fragmentLibravatar madblobfish2018-11-04
|
* 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.
* seat_update_capabilities: Set cursor image while we have the capabilityLibravatar Ryan Dwyer2018-10-23
|
* 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).
* 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.
* 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.
* 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
| |
* | 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.
* Merge branch 'master' into mouse-warping-containerLibravatar Ryan Dwyer2018-10-10
|\
| * Fix floating click eventsLibravatar Ryan Dwyer2018-10-10
| | | | | | | | | | | | | | | | * Set focus to a floating container when clicking its title bar. * Raise floating when user clicks title bar or decorations (in the seat_begin functions). * In container_at, it only returned a floating container if the user had clicked the surface. This makes it use floating_container_at instead.
* | Add mouse_warping containerLibravatar Rouven Czerwinski2018-10-10
|/ | | | | | | This option always moves the cursor into the middle of the container if the warp variable is true in seat_set_focus_warp. Fixes #2577
* Introduce container_is_transient_forLibravatar Ryan Dwyer2018-10-08
|
* Implement popup_during_fullscreenLibravatar Ryan Dwyer2018-10-08
| | | | | | | | | | This introduces a new view_impl function: is_transient_for. Similar to container_has_ancestor but works using the surface parents rather than the tree. This patch modifies view_is_visible, container_at and so on to allow transient views to function normally when they're in front of a fullscreen view.
* Move sticky containers when switching workspace via criteriaLibravatar Ryan Dwyer2018-10-06
| | | | | | | | | | | | | | | | | | | | | | * Create a view on workspace 1 * Switch to workspace 2 (on the same output) and create a floating sticky view * Use criteria to focus the view on workspace 1 Previously, we only moved the sticky containers when using workspace_switch, but the above method of focusing doesn't call it. This patch relocates the sticky-moving code into seat_set_focus_warp. A side effect of this patch is that if you have a sticky container focused and then switch workspaces, the sticky container will no longer be focused. It would previously retain focus. In seat_set_focus_warp, new_output_last_ws was only set when changing outputs, but now it's always set. This means new_output_last_ws and last_workspace might point to the same workspace, which means we have to make sure we don't destroy it twice. It now checks to make sure they're different, and to make this more obvious I've moved both calls to workspace_consider_destroy to be next to each other.
* Fix crash when flattening container after movingLibravatar Ryan Dwyer2018-10-05
| | | | | | | | | | container_flatten removes the container from the tree (via container_replace) before destroying it. When destroying, the recent changes to handle_seat_node_destroy incorrectly assumes that the container has a parent. This adds a check for destroying a container which is no longer in the tree. If this is the case, focus does not need to be changed.
* Give focus to another swaylock surface when output is disconnectedLibravatar Ryan Dwyer2018-10-04
| | | | | | | | | | | | | | | | | | | | | * Have multiple outputs * Launch swaylock * Unplug an output (possibly has to be the last "connected" one) * The swaylock surface on the remaining output would not respond to key events This was happening because when the output destroys, focus was not given to the other swaylock surface. This patch makes focus be transferred to another surface owned by the same Wayland client, but only if input was inhibited by the surface being destroyed, and only if it's in the overlay layer. I figure it's best to be overly specific and relax the requirements later if needed. This patch removes a check in seat_set_focus_surface which was preventing focus from being passed from a layer surface to any other surface. I don't know of a use case for this check, but it's possible that this change could produce issues.
* Simplify raising a container in seatLibravatar Jonathan Buch2018-10-03
| | | | | * Factor out raising a floating window into s separate function to enable reuse.
* Add configuration for raising containers on focusLibravatar Jonathan Buch2018-10-03
| | | | | | | * New configuration option: raise_floating (From the discussion on https://github.com/i3/i3/issues/2990) * By default, it still raises the window on focus, otherwise it will raise the window on click.
* Add sanity check for empty focus stackLibravatar Ryan Dwyer2018-10-03
|
* Set focus_inactive on a sibling when a container closes in an inactive workspaceLibravatar Ryan Dwyer2018-10-02
| | | | | | | | | | | | | | | | | | | To reproduce the problem, create layout H[view V[view view view-focused]], then switch to another workspace and have the previously focused view in the vsplit close (eg. using criteria, or an mpv video finishing). Return to the workspace using `$mod+<num>` and the entire vsplit would be focused. This happens because handle_seat_node_destroy would only set a new focus if the currently focused view or a parent was being destroyed. To fix it, it needs to set a sibling of the destroying container to focus_inactive regardless of the current focus, then restore current focus if needed. This patch changes the function accordingly. Additionally: * The function now makes an early return if the node being destroyed is a workspace. * set_focus has been renamed to needs_new_focus. This variable is true if the head focus needs to be changed.
* Fix smart gapsLibravatar Brian Ashworth2018-10-01
|
* cursor: allow cursor_set_image to accept a NULL image to hide cursorLibravatar Ian Fan2018-09-24
|
* seat: only show cursor if pointer configuredLibravatar Ian Fan2018-09-24
|
* Fix GtkMenuBar always opening first itemLibravatar Ryan Dwyer2018-09-23
| | | | | It seems like advertising that we support touch when we don't, while using SSD, makes GtkMenuBar misbehave. Please don't ask me why...
* Rename seat_get_active_child to seat_get_active_tiling_childLibravatar Ryan Dwyer2018-09-16
| | | | | Also renames container to con in one function to prevent ugly line wrapping.