aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/container.c
Commit message (Collapse)AuthorAge
...
* container: set fullscreen mode before attempting focusLibravatar Ronan Pigott2020-12-24
|
* introduce workspace_squashLibravatar Ronan Pigott2020-12-20
| | | | | | | | | | | | | | | | | | workspace_squash is container_flatten in the reverse direction. Instead of eliminating redundant splits that are parents of the target container, it eliminates pairs of redundant H/V splits that are children of the workspace. Splits are redundant if a con and its grandchild have the same layout, and the immediate child has the opposite split. For example, layouts are transformed like: H[V[H[app1 app2]] app3] -> H[app1 app2 app3] i3 uses this operation to simplify the tree after moving heavily nested containers to a higher level in the tree via an orthogonal move.
* Change workspace_layout to match i3 behaviorLibravatar Ronan Pigott2020-12-20
| | | | | | | In i3, the workspace_layout command does not affect the workspace layout. Instead, new workspace level containers are wrapped in the desired layout and the workspace layout always defaults to the output orientation.
* Revert "commands/move: maintain workspace_layout when moving"Libravatar Ronan Pigott2020-12-20
| | | | | | | This is in preparation for changing the workspace_layout command to work like it does in i3. This reverts commit b4a75a1ab2a72842830aeea37733311f85e6f660.
* container: don't split single childrenLibravatar Ronan Pigott2020-12-20
| | | | | | In i3 splits are ineffective on singleton H/V containers, and the command is interpreted to affect the parent layout instead.
* tree/container: introduce `container_is_sticky[_or_child]` functionsLibravatar Tudor Brindus2020-11-11
| | | | | | | | | | To query whether a container is sticky, checking `con->is_sticky` is insufficient. `container_is_floating_or_child` must also return true; this led to a lot of repetition. This commit introduces `container_is_sticky[_or_child]` functions, and switches all stickiness checks to use them. (Including ones where the container is already known to be floating, for consistency.)
* In container_split, set a floating container's view to tiledLibravatar Dimitris Triantafyllidis2020-10-28
| | | | | | | | | | | | | | | Currently, when a floating container with a view is split and children are added to it, the new views are rendered as tiled, while the first view stays in floating style. Here this is addressed by setting the view to tiled as soon as the container is split, by duplicating the "view part" of the logic in container_set_floating(..., false). Since the new container of the view is no longer considered floating, it makes sense to set the view to tiling at this point. The view would have to be set back to floating if it was possible to "unsplit" the container.
* container: Fix NULL pointer dereferenceLibravatar mwenzkowski2020-10-24
| | | | | | | Reset the workspace layout to the output's default only if the workspace is actually attached to an output. Fixes #5762
* view: implement foreign toplevel fullscreen indicatorLibravatar Ronan Pigott2020-08-05
|
* input: implement xdg_toplevel interactive resize hintsLibravatar Ronan Pigott2020-07-13
|
* commands/move: maintain workspace_layout when movingLibravatar Tudor Brindus2020-07-03
| | | | Fixes #5157.
* Implement wlr-foreign-toplevel-management-v1Libravatar Drew DeVault2020-06-23
|
* tree/container: introduce `container_toplevel_ancestor` helperLibravatar Tudor Brindus2020-06-07
| | | | | This allows us to not have to explicitly write the same while loop everywhere.
* tree/container: refactor `tiling_container_at` to check boundsLibravatar Tudor Brindus2020-05-30
| | | | | | | This fixes bugs where a floating container would take input way past its borders when its parent was fullscreen, since the call to `tiling_container_at` in input/cursor.c's `node_at_coords` did not check bounds.
* interpret "subpixel none" as CAIRO_ANTIALIAS_GRAYLibravatar Ian Huang2020-04-20
| | | | | | | | See issue #5228. Currently, WL_OUTPUT_SUBPIXEL_NONE is ignored and CAIRO_ANTIALIAS_SUBPIXEL is still set. This commit checks if subpixel is set to none and if so, calls set_antialias with CAIRO_ANTIALIAS_GRAY. This mirrors the functionality in Mako's [PR261](https://github.com/emersion/mako/pull/261)
* Fix hit test for floaters that cross outputsLibravatar Josh Shone2020-03-27
| | | | In the case of multiple overlapping floating windows, this commit fixes an issue where the wrong window would be focused in response to a cursor if one of the windows came from a different output (overhanging).
* container_at_{tabbed,stacked}: check x-axis boundsLibravatar Brian Ashworth2020-02-11
| | | | | | | | | The container_at_tabbed and container_at_stacked container were checking the bounds along the y-axis, but not the x-axis. This made it possible to cause a segfault for specific resolution, horizontal gap, and workspace children lengths. The issue is that child_index was -1 and was resulting in a buffer underflow. Adding the x-axis bound checks for early returns should prevent this from happening.
* Fix crash when showing scratchpad hidden split containersLibravatar Ronan Pigott2020-01-16
|
* container: add inactive fullscreen to focus stackLibravatar Brian Ashworth2020-01-14
| | | | | | | | | | | | When a container was being made fullscreen and it is on the focused workspace for a seat, focus was being set to the container. However, when the container was on a non-focused workspace, the focus stack wasn't being touched. When assigning a fullscreen container to a workspace or moving a fullscreen container to a different workspace, this would make it so the fullscreen container was never added to the focus stack for the workspace thus preventing access to the workspace. This adds the container to the top of the focus stack, behind the container on the focused workspace.
* Allow moving a container hidden in scratchpadLibravatar lbonn2019-08-20
| | | | | | | (as i3 allows it) Just update the container's coordinates so that they will be applied at the next show.
* Remove xdg-shell v6 supportLibravatar Simon Ser2019-08-20
| | | | | | All major toolkits and apps have gained xdg-shell stable support. Closes: https://github.com/swaywm/sway/issues/3690
* container_replace: copy {width,height}_fractionLibravatar Brian Ashworth2019-08-14
| | | | | | | | This copies the width and height fractions from the container to the container replacing it. Without setting these values, the container is treated as a new container and throws off the existing sizing. Since one container is replacing the other, it makes sense for the sizing to remain the same.
* Remove all wayland-server.h includesLibravatar Simon Ser2019-07-27
| | | | | | | | | | | | | | | The documentation for wayland-server.h says: > Use of this header file is discouraged. Prefer including > wayland-server-core.h instead, which does not include the server protocol > header and as such only defines the library PI, excluding the deprecated API > below. Replacing wayland-server.h with wayland-server-core.h allows us to drop the WL_HIDE_DEPRECATED declaration. This commit si similar to wlroots' ca45f4490ccc ("Remove all wayland-server.h includes").
* Rework gaps code to be simpler and correctLibravatar Pedro Côrte-Real2019-07-15
| | | | | | | | | | | | | Instead of tracking gaps per child apply gaps in two logical places: 1. In tiled containers use the layout code to add the gaps between windows. This is much simpler and guarantees that the sizing of children is correct. 2. In the workspace itself apply all the gaps around the edge. Here we're in the correct position to size inner and outer gaps correctly and decide on smart gaps in a single location. Fixes #4296
* Layout tiled using a width/height fractionLibravatar Pedro Côrte-Real2019-07-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of using container->width/height as both the input and output of the layout calculation have container->width_fraction/height_fraction as the share of the parent this container occupies and calculate the layout based on that. That way the container arrangement can always be recalculated even if width/height have been altered by things like fullscreen. To do this several parts are reworked: - The vertical and horizontal arrangement code is ajusted to work with fractions instead of directly with width/height - The resize code is then changed to manipulate the fractions when working on tiled containers. - Finally the places that manipulated width/height are adjusted to match. The adjusted parts are container split, swap, and the input seat code. It's possible that some parts of the code are now adjusting width and height only for those to be immediately recalculated. That's harmless and since non-tiled containers are still sized with width/height directly it may avoid breaking other corner cases. Fixes #3547 Fixes #4297
* tree: set correct border value before creating floaterLibravatar random human2019-06-27
|
* Fix sway crashes for scratchpad layoutsLibravatar Rouven Czerwinski2019-06-16
| | | | | | | | | | | | | | Currently container_replace removes the container from the scratchpad and re-adds it afterwards. For the split commands this results in the container being send to the scratchpad, which results in a NULL segfault if the same container should be shown. Pass an optional workspace to root_scratchpad_add_container, if the workspace is passed the window will continue to show on the workspace. If NULL is passed it is sent to the scratchpad. This was an issue if no other window except the scratchpad container was on the workspace. Fixes #4240
* cmd_move: respect workspace layout when insertingLibravatar Brian Ashworth2019-04-24
| | | | | | | | | | | | When moving a container to become a direct child of the workspace and the workspace's layout is tabbed or stacked, wrap it in a container with the same layout. This allows for the following: - Run `layout tabbed|stacked` on an empty workspace (or use `workspace_layout tabbed|stacked` in the config) - Open some views - Move one of the views in any direction - Open another view - The new container should also be `tabbed`/`stacked`
* Fix scratchpad fullscreen behavior and crashLibravatar Brian Ashworth2019-04-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | When setting fullscreen on a hidden scratchpad container, there was a check to see if there was an existing fullscreen container on the workspace so it could be fullscreen disabled first. Since the workspace is NULL, it would cause a SIGSEGV. This adds a NULL check to avoid the crash. This also changes the behavior of how fullscreen is handled when adding a container to the scratchpad or changing visibility of a scratchpad container to match i3's. The behavior is as follows: - When adding a container to the scratchpad or hiding a container back into the scratchpad, there is an implicit fullscreen disable - When setting fullscreen on a container that is hidden in the scratchpad, it will be fullscreen when shown (and fullscreen disabled when hidden as stated above) - When setting fullscreen global on a container that is hidden in the scratchpad, it will be shown immediately as fullscreen global. The container is not moved to a workspace and remains in the scratchpad. The container will be visible until fullscreen disabled or killed. Since the container is in the scratchpad, running `scratchpad show` or `move container to scratchpad` will have no effect This also changes `container_replace` to transfer fullscreen and scratchpad status.
* scratchpad: set initial sizeLibravatar Brian Ashworth2019-03-31
| | | | | | This matches i3's behavior of setting scratchpad containers to 50% of the workspace's width and 75% of the workspace's height, bound by the minimum and maximum floating width/height.
* floating: fix size of non-view containersLibravatar Brian Ashworth2019-03-31
| | | | | | | | | | | | This fixes the sizing of floating non-view containers. On master, the floater will get set to the maximum width and height, which by default is the entire output layout. When setting a non-view container to floating, this will set a sane default size of 50% of the workspace width and 75% of the workspace height, or whatever the closest is that the minimum and maximum floating width/height values allow for. On all future calls to `floating_natural_resize`, the width and height will be kept unless they need to be changed to respect the min/max floating width/height values.
* Fix xwayland configure request scratchpad crashLibravatar Brian Ashworth2019-03-31
| | | | | | | | | | | | | | | | | | This fixes a crash in `container_init_floating` when a xwayland view sends a configure request while in the scratchpad. `container_init_floating` gets called so the configured minimum and maximum sizes gets respected when resizing to the requested size. Since the workspace was NULL, it would SIGSEGV when attempting to get the workspace's output for the output box retrieval. This extracts the resizing portion of `container_init_floating` into a separate function. If the container is in the scratchpad, it will just be resized and skip the centering. Additionally, `container_init_floating` has been renamed to `container_floating_resize_and_center` to more accurately describe what it does.
* fix opening a floating view on the NOOP outputLibravatar Brian Ashworth2019-03-23
| | | | | | | | | | | | | | | | Since the NOOP output has no size, the minimum floating size is greater than the workspace size for the NOOP output. In this case, the floater gets centered in the output instead of the workspace. However, the NOOP output is not part of the output layout and thus has a NULL box. Attempting to access the properties of this box was causing a segfault. This fixes the issue by just setting the floater's box to all zeroes when mapping on the NOOP output. When the workspace gets moved from the NOOP output to a new output, any floater whose width or height is zero or has an x or y location outside of the output, gets passed to `container_init_floating` again. This will then set the appropriate size and centering. For any floater that has a valid size and location, they are preserved.
* fullscreen: init floating on disable without sizeLibravatar Brian Ashworth2019-03-10
| | | | | | | 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-06
|
* floating_maximum_size: change default behaviorLibravatar Brian Ashworth2019-03-02
| | | | | | | | | | | | | 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-23
| | | | | | | | 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-21
| | | | | | | | | | 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-09
| | | | | | | | | | | 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
|