aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/container.c
Commit message (Collapse)AuthorAge
* fullscreen: init floating on disable without sizeLibravatar Brian Ashworth2019-03-11
| | | | | | | If a container gets mapped as fullscreen and set to floating by criteria, the size and location are never set for the floating container. This adds a check in container_fullscreen_disable for a width or height of 0 and calls container_init_floating
* Fix container_parent_layout for scratchpad windowsLibravatar emersion2019-03-11
|
* floating_maximum_size: change default behaviorLibravatar Brian Ashworth2019-03-04
| | | | | | | | | | | | | This changes the way zero (which is the default) is interpreted for both the width and height of `floating_maximum_size`. It now refers to the width and height of the entire output layout, which matches i3's behavior. This also removes duplicated code to calculate the floating constraints in three files. Before this, `container_init_floating` used two-thirds of the workspace width/height as the max and the entire workspace width/height was used everywhere else. Now, all callers use a single function `floating_calculate_constraints`.
* Fix crash exiting fullscreened floating containerLibravatar minus2019-02-25
| | | | | | | | container_floating_move_to_center and container_fullscreen_disable were calling recursively when the container spawned as a fullscreen floating container (via for_window). Such a window now doesn't crash sway anymore but is still configured with a wrong, zero size, making it not directly usable.
* Handle NULL from output_get_active_workspaceLibravatar Brian Ashworth2019-02-25
| | | | | | | | | | This modifies the places where output_get_active_workspace is called to handle a NULL result. Some places already handled it and did not need a change, some just have guard off code blocks, others return errors, and some have sway_asserts since the case should never happen. A lot of this is probably just safety precautions since they probably will never be called when `output_get_active_workspace` is not fully configured with a workspace.
* container_at_stacked: skip titles when zero pixelsLibravatar Brian Ashworth2019-02-11
| | | | | | | | | | | It is possible to make the title bars have a zero pixel height while stacked, by using a blank font and no padding. This causes a division by zero when attempting to calculate the child index in container_at_stacked, which then results in a segfault when attempting to access the child at that bad index (INT_MIN). This just skips the check to see if the cursor is over a title bar of a child of a stacked container when the title bar height is zero since there will be no title bars.
* Remove bad assertion in container_handle_fullscreen_reparentLibravatar Ryan Dwyer2019-01-29
| | | | The assertion could trigger when called from workspace_wrap_children.
* Check xdg_surface's role before using its toplevelLibravatar mwenzkowski2019-01-28
| | | | | | | | Don't access xdg_surface->toplevel if xdg_surface->role is equal to WLR_XDG_SURFACE_ROLE_NONE, since this could lead to crash. The same checks are added for xdg_surface_v6. Fixes #3311
* Introduce container_is_scratchpad_hiddenLibravatar Ryan Dwyer2019-01-28
| | | | | | | | | | | | Just a convenience function that improves readability of the code. Other things worth noting: * container_get_siblings and container_sibling_index no longer use the const keyword * container_handle_fullscreen_reparent is only ever called after attaching the container to a workspace, so its con->workspace check has been changed to an assertion
* Center surface inside container when it's too smallLibravatar Ryan Dwyer2019-01-28
| | | | | | | | | | | | | | | | | | | | | | | | | The goal here is to center fullscreen views when they are both too small for the output and refuse to resize to the output's dimensions. It has the side effect of also centering the view when it's too small for its container. Example clients that have this behaviour are emersion's hello-wayland and weston. It works by introducing surface_{x,y,width,height} properties to the container struct. The x and y represent layout-local coordinates where the surface will be rendered. The width and height are only used to track the surface's previous dimensions so we can detect when the client has resized it and recenter and apply damage accordingly. The new surface properties are calculated when a transaction is applied, as well as when a view resizes itself unexpectedly. The latter is done in view_update_size. This function was previously restricted to views which are floating, but can now be called for any views. For views which refuse to resize *smaller* than a particular size, such as gnome-calculator, the surface is still anchored to the top left as per the current behaviour.
* Implement fullscreen globalLibravatar Ryan Dwyer2019-01-25
|
* commands: allow tiled containers to be stickiedLibravatar Ian Fan2019-01-22
| | | | | This also stops stickied containers from losing its sticky status when it is tiled, allowing it to be immediately stickied when floated again.
* Replace wlr_log with sway_logLibravatar M Stoeckl2019-01-21
| | | | | | | | | | | | | This commit mostly duplicates the wlr_log functions, although with a sway_* prefix. (This is very similar to PR #2009.) However, the logging function no longer needs to be replaceable, so sway_log_init's second argument is used to set the exit callback for sway_abort. wlr_log_init is still invoked in sway/main.c This commit makes it easier to remove the wlroots dependency for the helper programs swaymsg, swaybg, swaybar, and swaynag.
* 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
* Set font options when computing text width.Libravatar John Chen2018-12-31
| | | | Fix #2869
* Fix wlr_box_intersection args for wlroots 1441Libravatar Brian Ashworth2018-12-22
| | | | | The fix pushed to master missed wlr_box_intersection. This just fixes those lines so sway renders properly again
* list.c: rename free_flat_list to list_free_items_and_destroyLibravatar Ian Fan2018-12-09
|
* list.c: Remove list_foreachLibravatar Ian Fan2018-12-09
| | | | | Most occurrences have been replaced by `free_flat_list` which has been moved from stringop.c to list.c. The rest have been replaced by for loops.
* Adding commands for configuring titlebar borders and paddingLibravatar Florent de Lamotte2018-11-22
|
* 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.
* gaps: remove duplicate inner gapsLibravatar Brian Ashworth2018-11-07
|
* Move view marks properties to container structLibravatar Ryan Dwyer2018-11-01
| | | | | Like border properties, this will be needed to implement layout saving and restoring.
* 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.
* Fix re-tiling for floating containersLibravatar Mihai Coman2018-10-25
| | | | | | When a floating container is tiled (e.g.: 'floating toggle' or 'floating disable'), it should be placed after/below the inactive focused container from the tiling layout.
* Fix crash when resizing container hidden in the scratchpadLibravatar Ryan Dwyer2018-10-23
| | | | | | | | Firstly, the container was wrongly identifying as a tiling container because it had no workspace. Secondly, when calculating the maximum possible size we can't use the workspace if it's not there, so we'll allow unlimited size in this case.
* 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).
* 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.
* 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.
* Introduce container_is_transient_forLibravatar Ryan Dwyer2018-10-08
|
* Reenable popup-handling for determining focusLibravatar Jonathan Buch2018-10-03
| | | | | This reenables the popup-handling code before the floating-window focus change.
* Use "raycasting" for determining focus for floating windowsLibravatar Jonathan Buch2018-10-03
| | | | | Floating containers and their surfaces are ordered in "raised last". This is used to detect the topmost surface and thus the focus.
* 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
| * Improve CSD logicLibravatar Ryan Dwyer2018-09-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This does the following: * Removes the xdg-decoration surface_commit listener. I was under the impression the client could ignore the server's preference and set whatever decoration they like using this protocol, but I don't think that's right. * Adds a listener for the xdg-decoration request_mode signal. The protocol states that the server should respond to this with its preference. We'll always respond with SSD here. * Makes it so tiled views which use CSD will still have sway decorations rendered. To do this, using_csd had to be added back to the view struct, and the border is changed when floating or unfloating a view.
| * 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.
* | Fix smart gapsLibravatar Brian Ashworth2018-10-01
| |
* | Merge pull request #2726 from RyanDwyer/overhaul-gapsLibravatar Drew DeVault2018-09-30
|\ \ | | | | | | Make gaps implementation consistent with i3-gaps
| * | Make gaps implementation consistent with i3-gapsLibravatar Ryan Dwyer2018-09-29
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes our gaps implementation to behave like i3-gaps. Our previous implementation allowed you to set gaps on a per container basis. This isn't supported by i3-gaps and doesn't seem to have a practical use case. The gaps_outer and gaps_inner properties on containers are now removed as they just read the gaps_inner from the workspace. `gaps inner|outer <px>` no longer changes the gaps for all workspaces. It only sets defaults for new workspaces. `gaps inner|outer current|workspace|all set|plus|minus <px>` is now runtime only, and the workspace option is now removed. `current` now sets gaps for the current workspace as opposed to the current container. `workspace <ws> gaps inner|outer <px>` is now implemented. This sets defaults for a workspace. This also fixes a bug where changing the layout of a split container from linear to tabbed would cause gaps to not be applied to it until you switch to another workspace and back.
* | Merge pull request #2728 from RedSoxFan/move-sticky-on-evacLibravatar Drew DeVault2018-09-30
|\ \ | | | | | | Move sticky containers in output_evacuate
| * | Move sticky containers in output_evacuateLibravatar Brian Ashworth2018-09-28
| |/
* / Turn funcs() into funcs(void)Libravatar Arkadiusz Hiler2018-09-30
|/ | | | If they really do not take undefined number of arguments.
* Fix race condition crash when view unmaps + maps quicklyLibravatar Ryan Dwyer2018-09-26
| | | | | | | | | | | | | When a view unmaps, we start a transaction to destroy the container, then when the transaction completes we destroy the container and unset the view's container pointer. But if the view has remapped in the meantime, the view's container pointer will be pointing to a different container which should not be cleared. This adds a check to make sure the view is still pointing to the container being destroyed before clearing the pointer. The freeing of the title format is also removed as it is already freed when the view destroys in view_destroy.
* Fix crash when disconnecting outputLibravatar Ryan Dwyer2018-09-25
| | | | | | | | | | | If the output being disconnected contains views, and the views are being relocated to another output of a different size, a transaction must occur to reconfigure them. This means by the time container_discover_outputs is called, the output is already disabled and wlr_output is NULL. I considered making it check output->wlr_output, but output->enabled should work just as well and is more descriptive.
* Merge pull request #2686 from RyanDwyer/tab-scrollingLibravatar emersion2018-09-23
|\ | | | | Implement tab cycling using mouse wheel
| * 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).
* | swaybar, swaylock, & tree/container: Set cairo font options to render text ↵Libravatar Geoff Greer2018-09-22
|/ | | | and lines with subpixel hinting (if available).
* 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.
* Fix crash when unmapping last child of a tabbed workspaceLibravatar Ryan Dwyer2018-09-16
| | | | | | | | | | | | | | * Create layout T[view view] * Move the cursor into the title bar area * Close both views Sway would crash because container_at_tabbed would attempt to divide by zero when there are no children. The children check isn't needed for the stacked function because it doesn't divide anything by the number of children. Fixes #2636.
* 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