aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/seat.c
Commit message (Collapse)AuthorAge
...
* 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.
* Make seat_get_active_child ignore floating childrenLibravatar Ryan Dwyer2018-09-16
| | | | | | | | | | | | | | | seat_get_active_child is used to get the active tiling child in a few places, such as outputs getting their active workspace and tabbed/stacked containers getting their visible child. When a workspace uses a tabbed or stacked layout and contains a focused floating view, calling seat_get_active_child on the workspace would incorrectly return the floating view. This changes it so it will return the tiling child. This fixes the following bug: * Create layout T[view view] then float one of the views * Attempt to click the tiling view to give it focus - it wouldn't work because seat_get_active_child would return the floating view
* Update for swaywm/wlroots#1243Libravatar emersion2018-09-14
|
* Minor fixes to tiling drag implementationLibravatar Ryan Dwyer2018-09-12
| | | | | | | | * Make container_add_sibling's `after` argument a boolean. * Use a constant for drop layout border * Make thickness an int * Add button state check * Move comments in seat_end_move_tiling
* Fix line lengthLibravatar Ryan Dwyer2018-09-11
|
* Implement tiling dragLibravatar Ryan Dwyer2018-09-11
| | | | Hold floating_modifier and drag a tiling view to a new location.
* Rename OP_MOVE to OP_MOVE_FLOATINGLibravatar Ryan Dwyer2018-09-11
| | | | In preparation for introducing OP_MOVE_TILING.
* Merge pull request #2603 from emersion/fix-dndLibravatar Drew DeVault2018-09-07
|\ | | | | Fix drag-and-drop
| * Fix drag-and-dropLibravatar emersion2018-09-07
| |
* | Fix workspace switchingLibravatar Ryan Dwyer2018-09-07
| | | | | | | | The output also needs to be made dirty when focusing a new output.
* | Don't dirty outputs unnecessarilyLibravatar Ryan Dwyer2018-09-06
| |
* | Make outputs dirty when changing focusLibravatar Ryan Dwyer2018-09-06
| | | | | | | | | | Fixes a workspace switch bug introduced by 5967ee1fbcba66ea57d971b924a51209a70d3aaa.
* | Introduce seat_set_focus_container and seat_set_focus_workspaceLibravatar Ryan Dwyer2018-09-06
| | | | | | | | | | | | | | | | | | | | | | These are the same as seat_set_focus, but accept a specific type rather than using nodes. Doing this adds more typesafety and lets us avoid using &con->node which looks a little ugly. This fixes a crash that pretty much nobody would ever come across. If you have a bindsym for "focus" with no arguments and run it from an empty workspace, sway would crash because it assumes `container` is not NULL.
* | Restore focus correctly when closing a fullscreen viewLibravatar Ryan Dwyer2018-09-06
| | | | | | | | | | We weren't calling seat_send_focus. I think this was previously called by seat_set_focus_warp.
* | Fix scratchpad related crashesLibravatar Ryan Dwyer2018-09-05
| | | | | | | | | | | | | | * Was crashing when a view was moved to the scratchpad (prev focus had no parent). * Was crashing when a hidden scratchpad view unmaps because it has no workspace.
* | Fix focus bugLibravatar Ryan Dwyer2018-09-05
| | | | | | | | | | | | | | | | When changing focus from a view in one workspace to an empty workspace using `focus <direction>`, the view in the previous workspace would keep focused styling. This is because the check to unfocus it was only done in the container case and not workspace case, so it's been moved out of both.
* | Fix mouse_warpingLibravatar Ryan Dwyer2018-09-05
| |
* | Implement type safe arguments and demote sway_containerLibravatar Ryan Dwyer2018-09-05
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit changes the meaning of sway_container so that it only refers to layout containers and view containers. Workspaces, outputs and the root are no longer known as containers. Instead, root, outputs, workspaces and containers are all a type of node, and containers come in two types: layout containers and view containers. In addition to the above, this implements type safe variables. This means we use specific types such as sway_output and sway_workspace instead of generic containers or nodes. However, it's worth noting that in a few places places (eg. seat focus and transactions) referring to them in a generic way is unavoidable which is why we still use nodes in some places. If you want a TL;DR, look at node.h, as well as the struct definitions for root, output, workspace and container. Note that sway_output now contains a workspaces list, and workspaces now contain a tiling and floating list, and containers now contain a pointer back to the workspace. There are now functions for seat_get_focused_workspace and seat_get_focused_container. The latter will return NULL if a workspace itself is focused. Most other seat functions like seat_get_focus and seat_set_focus now accept and return nodes. In the config->handler_context struct, current_container has been replaced with three pointers: node, container and workspace. node is the same as what current_container was, while workspace is the workspace that the node resides on and container is the actual container, which may be NULL if a workspace itself is focused. The global root_container variable has been replaced with one simply called root, which is a pointer to the sway_root instance. The way outputs are created, enabled, disabled and destroyed has changed. Previously we'd wrap the sway_output in a container when it is enabled, but as we don't have containers any more it needs a different approach. The output_create and output_destroy functions previously created/destroyed the container, but now they create/destroy the sway_output. There is a new function output_disable to disable an output without destroying it. Containers have a new view property. If this is populated then the container is a view container, otherwise it's a layout container. Like before, this property is immutable for the life of the container. Containers have both a `sway_container *parent` and `sway_workspace *workspace`. As we use specific types now, parent cannot point to a workspace so it'll be NULL for containers which are direct children of the workspace. The workspace property is set for all containers, except those which are hidden in the scratchpad as they have no workspace. In some cases we need to refer to workspaces in a container-like way. For example, workspaces have layout and children, but when using specific types this makes it difficult. Likewise, it's difficult for a container to get its parent's layout when the parent could be another container or a workspace. To make it easier, some helper functions have been created: container_parent_layout and container_get_siblings. container_remove_child has been renamed to container_detach and container_replace_child has been renamed to container_replace. `container_handle_fullscreen_reparent(con, old_parent)` has had the old_parent removed. We now unfullscreen the workspace when detaching the container, so this function is simplified and only needs one argument now. container_notify_subtree_changed has been renamed to container_update_representation. This is more descriptive of its purpose. I also wanted to be able to call it with whatever container was changed rather than the container's parent, which makes bubbling up to the workspace easier. There are now state structs per node thing. ie. sway_output_state, sway_workspace_state and sway_container_state. The focus, move and layout commands have been completely refactored to work with the specific types. I considered making these a separate PR, but I'd be backporting my changes only to replace them again, and it's easier just to test everything at once.
* Merge pull request #2544 from RyanDwyer/fix-deferred-cmd-crashLibravatar Drew DeVault2018-09-01
|\ | | | | Fix crash when running deferred commands
| * Fix crash when running deferred commandsLibravatar Ryan Dwyer2018-08-31
| | | | | | | | Fixes #2541
* | Don't send never-ending transactions when a focused layer surface commitsLibravatar Ryan Dwyer2018-08-31
|/ | | | | | | | | | | This moves the arrange_windows call into the arrange_layers function, where we know the output actually needs to be arranged. Additionally, we shouldn't set focus to the parent of an unknown container type, because the parent may be an output and this causes a crash because outputs can't have direct focus. Fixes #2543
* seat.c: clean-up seat_set_focus_warp functionLibravatar Ian Fan2018-08-27
|
* Remove layout.cLibravatar Ryan Dwyer2018-08-26
| | | | | | | | | | | | | | | | | | | | | | | | | When we have type safety we'll need to have functions for workspace_add_tiling and so on. This means the existing container functions will be just for containers, so they are being moved to container.c. At this point layout.c doesn't contain much else, so I've relocated everything and removed the file. * container_swap and its static functions have been moved to the swap command and made static. * container_recursive_resize has been moved to the resize command and made static. * The following have been moved to container.c: * container_handle_fullscreen_reparent * container_insert_child * container_add_sibling * container_add_child * container_remove_child * container_replace_child * container_split * enum movement_direction and sway_dir_to_wlr have been moved to util.c. Side note: Several commands included layout.h which then included root.h. With layout.h gone, root.h has to be included by those commands.
* Refactor destroy functions and save workspaces when there's no outputsLibravatar Ryan Dwyer2018-08-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes the destroy functions to the following: * output_begin_destroy * output_destroy * workspace_begin_destroy * workspace_destroy * container_begin_destroy * container_destroy * view_begin_destroy * view_destroy The terminology was `destroy` and `free`, and it has been changed to `begin_destroy` and `destroy` respectively. When the last output is disconnected, its workspaces will now be stashed in the root. Upon connection of a new output they will be restored. There is a new function `workspace_consider_destroy` which decides whether the given workspace should be destroyed or not (ie. empty and not visible). Calling container_begin_destroy will no longer automatically reap the parents. In some places we want to reap the parents and in some we don't, so this is left to the caller. container_reap_empty_recursive and container_reap_empty have been combined into one function and it will recurse up the tree.
* Replace enum resize_edge with wlr_edgesLibravatar Ryan Dwyer2018-08-21
|
* Replace hacky L_FLOATING container with a listLibravatar Ryan Dwyer2018-08-19
| | | | | | | | | | | | | | | | Workspaces previously had a magical `workspace->floating` container, which had a layout of L_FLOATING and whose children were actual floating views. This allowed some conveniences, but was a hacky solution because the container has to be exempt from focus, coordinate transactions with the workspace, and omit emitting IPC events (which we didn't do). This commit changes it to be a list directly in the sway_workspace. The L_FLOATING layout is no longer used so this has been removed as well. * Fixes incorrect check in the swap command (it checked if the containers had the L_FLOATING layout, but this layout applied to the magical container). * Introduces workspace_add_floating
* Implement iterators per container typeLibravatar Ryan Dwyer2018-08-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces the following `for_each` functions: * root_for_each_workspace * root_for_each_container * output_for_each_workspace * output_for_each_container * workspace_for_each_container And introduces the following `find` functions: * root_find_output * root_find_workspace * root_find_container * output_find_workspace * output_find_container * workspace_find_container * container_find_child And removes the following functions: * container_descendants * container_for_each_descendant * container_find This change is preparing the way for demoting sway_container. Eventually these functions will accept and return sway_outputs, sway_workspaces and sway_containers (meaning a C_CONTAINER or C_VIEW). This change also makes it easy to handle abnormalities like the workspace floating list, root's scratchpad list and (once implemented) root's saved workspaces list for when there's no connected outputs.
* Don't send motion if the cursor hasn't movedLibravatar Ryan Dwyer2018-08-18
| | | | Prevents GTK+ comboboxes from immediately closing.
* Rename mousedown to down and make seat operation a named enumLibravatar Ryan Dwyer2018-08-18
|
* Implement mousedown operationLibravatar Ryan Dwyer2018-08-18
| | | | | This allows you to move the cursor off the surface while dragging its scrollbar.
* Refactor seat_get_focus functionsLibravatar Ryan Dwyer2018-08-17
| | | | | | | | | | | | | | | | | Fixes #2467. This commit introduces seat_get_focus_inactive_floating to supplement seat_get_focus_inactive_tiling, and uses it during `focus mode_toggle` which fixes a focus bug. This also refactors the seat_get_focus_inactive functions so that they do their selection logic themselves rather than offloading it to seat_get_focus_by_type which was getting bloated. seat_get_focus_by_type is now removed. Lastly, this commit changes seat_get_focus to just return the first container in the focus stack rather than looping and calling seat_get_focus_by_type.
* Use col-resize and row-resize cursor imagesLibravatar Ryan Dwyer2018-08-12
|
* Implement resizing tiled containers via cursorLibravatar Ryan Dwyer2018-08-12
| | | | | | | | | * The OP_RESIZE seat operation has been renamed to OP_RESIZE_FLOATING, and OP_RESIZE_TILING has been introduced. * Similar to the above, seat_begin_resize and handle_resize_motion have been renamed and tiling variants introduced. * resize.c's resize_tiled has to be used, so container_resize_tiled has been introduced in resize.c to allow external code to call it.
* Merge pull request #2449 from RyanDwyer/remove-bfsLibravatar Drew DeVault2018-08-11
|\ | | | | Remove container_for_each_descendant_bfs
| * Remove container_for_each_descendant_bfsLibravatar Ryan Dwyer2018-08-11
| | | | | | | | | | | | | | The function was not used. Also renames container_for_each_descendant_dfs to just container_for_each_descendant.
* | Remove container_has_childLibravatar Ryan Dwyer2018-08-11
|/ | | | | In all cases you can use container_has_ancestor with the arguments swapped, which is faster than container_has_child.
* Fix edge cases when moving floating container to new workspaceLibravatar Ryan Dwyer2018-08-08
| | | | | | | | | | * Removes container_floating_move_to_container, instead opting to put that logic in container_move_to * In the seat code, focusing a floating view now updates the pending state only and lets the next transaction carry it over to the current state. This is required, otherwise it would crash. * When unfullscreening a floating container, an output check is now done to see if it should center it.