aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/cursor.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.
* Ignore unrelated cursor buttons while doing seat operationsLibravatar Ryan Dwyer2018-10-04
| | | | | | | | | | | | | | * Click and hold a scrollbar * Drag the cursor onto another surface * While still holding the original button, press and release another cursor button * Things get weird There's two ways to fix this. Either cancel the seat operation and do the other click, or continue the seat operation and ignore the other click. I opted for the latter (ignoring the click) because it's easier to implement, and I suspect a second click during a seat operation is probably unintentional anyway.
* Fix focusing topmost floating windowsLibravatar Jonathan Buch2018-10-03
| | | | | | | | | | | | Re-focus on the container on which the cursor hovers over. A special case is, if there are menus or other subsurfaces open in the focused container. It will prefer the focused container as long as there are subsurfaces. This commit starts caching the previous node as well as the previous x/y cursor position. Re-calculating the previous focused node by looking at the current state of the cursor position does not work, if the environment changes.
* Merge pull request #2703 from RyanDwyer/csd-borderLibravatar Drew DeVault2018-10-03
|\ | | | | Add CSD to border modes
| * Add CSD to border modesLibravatar Ryan Dwyer2018-09-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This replaces view.using_csd with a new border mode: B_CSD. This also removes sway_xdg_shell{_v6}_view.deco_mode and view->has_client_side_decorations as we can now get these from the border. You can use `border toggle` to cycle through the modes including CSD, or use `border csd` to set it directly. The client must support the xdg-decoration protocol, and the only client I know of that does is the example in wlroots. If the client switches from SSD to CSD without us expecting it (via the server-decoration protocol), we stash the previous border type into view.saved_border so we can restore it if the client returns to SSD. I haven't found a way to test this though.
* | Turn funcs() into funcs(void)Libravatar Arkadiusz Hiler2018-09-30
| | | | | | | | If they really do not take undefined number of arguments.
* | Merge pull request #2698 from ianyfan/hide-cursorLibravatar emersion2018-09-29
|\ \ | |/ |/| Only show cursor if pointer configured
| * cursor: allow cursor_set_image to accept a NULL image to hide cursorLibravatar Ian Fan2018-09-24
| |
* | Add a missing null check for moving tiling containersLibravatar Alexander Bakker2018-09-25
|/
* Implement tab cycling using mouse wheelLibravatar Ryan Dwyer2018-09-22
| | | | | | | | | | | | | Firstly, a change had to be made to the container_at functions. If you create layout `T[view H[view view]]` and hover the second tab, the container_at functions would return the focus_inactive child. They now return the split container itself. To compensate for this, dispatch_cursor_button has been adjusted to find the focus_inactive child before focusing it. The actual implementation of wheel scrolling is pretty straightforward. This uses handle_cursor_axis, so I took a similar approach to handle_cursor_button (ie. creating a dispatch_cursor_axis function).
* 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
* 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
| |
* | 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.
* | Fix clicking workspace buttonsLibravatar Ryan Dwyer2018-09-05
| | | | | | | | | | Because node_at_coords was returning the workspace's node, it interpreted this as clicking the focused workspace which was a no op.
* | Focus empty workspace when clicking itLibravatar Ryan Dwyer2018-09-05
| | | | | | | | | | Also removes container_at_coords as this function is no longer necessary.
* | Fix crash when moving mouse over a fullscreen split containerLibravatar 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.
* 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.
* 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
* Merge pull request #2460 from RyanDwyer/implement-mousedownLibravatar Drew DeVault2018-08-18
|\ | | | | Implement mousedown operation
| * 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.
* | Fix mod+resizeLibravatar Ryan Dwyer2018-08-18
|/ | | | | | | | Fixes #2479. It was missing a mod_pressed check. This also moves the parent traversal into the `if` block.
* Make mod+resize a floating container resize the container itselfLibravatar Ryan Dwyer2018-08-12
| | | | Rather than resizing the split within the container.
* Use col-resize and row-resize cursor imagesLibravatar Ryan Dwyer2018-08-12
|
* Fix right-click/popups and add state checksLibravatar Ryan Dwyer2018-08-12
|
* Allow resizing tiled views via mod keyLibravatar Ryan Dwyer2018-08-12
|
* Refactor dispatch_cursor_buttonLibravatar Ryan Dwyer2018-08-12
| | | | | | | | | | There was a separate function dispatch_cursor_button_floating which dealt with the resize and move operations, but as resize is not really limited to floating views, it doesn't make as much sense to have this separate. So both functions are now combined into one. Additionally, dispatch_cursor_button now uses a pattern of returning early instead of using else-ifs.
* 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.
* Don't call send_pointer_notify_button when doing move or resizeLibravatar Ryan Dwyer2018-08-08
|
* Focus floating views when beginning move/resize operationsLibravatar Ryan Dwyer2018-08-08
|
* Fix crash when moving cursor over a fullscreen split containerLibravatar Ryan Dwyer2018-08-03
| | | | | | Calling container_at_view fails an assertion if the container isn't a view. Calling tiling_container_at works correctly, as that function checks if the container is a view and calls container_at_view if so.
* Fix pointer events for fullscreen viewsLibravatar emersion2018-08-02
|
* Fix crash on mouse motion on fullscreen containerLibravatar minus2018-08-02
| | | | | container_at expects a workspace, not the fullscreened container. Fixes #2409
* Revert "Revert "Fix popups""Libravatar Ryan Dwyer2018-08-02
| | | | | | This reverts commit 9aa258d33a9baa42895214da7e82f4568fcb8f76. Reverting the revert, so that popups can be fixed.
* Revert "Fix popups"Libravatar Drew DeVault2018-08-02
| | | | This reverts commit de86d65627e96cffe77f4abf11c4a0b982326ff9.
* Merge pull request #2391 from RyanDwyer/fix-popups-v2Libravatar Drew DeVault2018-08-01
|\ | | | | Fix popups (v2)
| * Fix popupsLibravatar Ryan Dwyer2018-07-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes the render and container_at order for popups. Fixes #2210 For rendering: * render_view_surfaces has been renamed to render_view_toplevels * render_view_toplevels now uses output_surface_for_each_surface (which is now public), as that function uses wlr_surface_for_each_surface which doesn't descend into popups * Views now have a for_each_popup iterator, which is used by the renderer to render the focused view's popups * When rendering a popup, toplevels (xdg subsurfaces) of that popup are also rendered For sending frame done, the logic has been updated to match the rendering logic: * send_frame_done_container no longer descends into popups * for_each_popup is used to send frame done to the focused view's popups and their child toplevels For container_at: * floating_container_at is now static, which means it had to be moved higher in the file. * container_at now considers popups for the focused view before checking containers. * tiling_container_at has been introduced, so that it doesn't call container_at recursively (it would check popups recursively if it did)
* | ipc: prevent emitting a workspace::focus event when moving a container to a ↵Libravatar Ian Fan2018-08-01
|/ | | | | | different workspace or output When a container is moved from, say, workspace 1 to workspace 2, workspace 2 is focused in order to arrange the windows before focus is moved back to workspace 1, which caused a workspace:focus event from workspace 2 to workspace 1 to be emitted. This commit inhibits that event.
* Fix clicking a floating split containerLibravatar Ryan Dwyer2018-07-28
| | | | | | | It would focus the split container rather than the child. This commit makes it track the child and the split container separately and send the surface click to the child.
* Allow containers to floatLibravatar Ryan Dwyer2018-07-28
| | | | | | | | | | | | | | | | Things worth noting: * When a fullscreen view unmaps, the check to unset fullscreen on the workspace has been moved out of view_unmap and into container_destroy, because containers can be fullscreen too * The calls to `container_reap_empty_recursive(workspace)` have been removed from `container_set_floating`. That function reaps upwards so it wouldn't do anything. I'm probably the one who originally added it... * My fix (b14bd1b0b1536039e4f46fe94515c7c44e7afc61) for the tabbed child crash has a side effect where when you close a floating container, focus is not given to the tiled container again. I've removed my fix and removed the call to `send_cursor_motion` from `seat_set_focus_warp`. We should consider calling it from somewhere earlier in the call stack.
* Allow containers to be fullscreenLibravatar Ryan Dwyer2018-07-26
|
* Merge pull request #2350 from ppascher/xwayland-optionalLibravatar Drew DeVault2018-07-25
|\ | | | | Added meson option to allow building sway without xwayland support
| * reverted includes of "sway/config.h" and replaced with "config.h" from meson ↵Libravatar Pascal Pascher2018-07-25
| | | | | | | | build