aboutsummaryrefslogtreecommitdiff
path: root/sway/tree
AgeCommit message (Collapse)Author
2020-02-16output: fix updating output manager configBrian Ashworth
The output manager config is created when the output is created. It is updated when the mode, transform, scale, or layout for the output changes, as well as, when the output is destroyed. Since the output->enabled property was not being set before calling apply_output_config, the output event handlers were early returning and never updating the output manager config when the output state was committed. This fixes the issue by setting output->enabled in apply_output_config below the output disabling section. There are also a few other minor changes that are required to function. Additionally, this renames output_enable to output_configure to better describe the recent changes.
2020-02-11Stop calling apply_output_config from output_enableSimon Ser
The only output_enable caller is now apply_output_config. Stop calling apply_output_config from output_enable to simplify the code and avoid the back-and-forth between these two functions. output_enable is now the symmetric of output_disable: it just marks the output as enabled and performs bookkeeping (e.g. creating teh default workspace). It is called from apply_output_config after the output commit, so that it can read the current output state and act accordingly. This change also allows us to avoid an extraneous wlr_output_commit. References: https://github.com/swaywm/sway/issues/4921
2020-02-11container_at_{tabbed,stacked}: check x-axis boundsBrian Ashworth
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.
2020-01-16Fix crash when showing scratchpad hidden split containersRonan Pigott
2020-01-14container: add inactive fullscreen to focus stackBrian Ashworth
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.
2020-01-09view: remove workspace pid mapping for assignsBrian Ashworth
If a view is mapped to a workspace using an assign, the pid should still be removed from the pid mapping list. This prevents child processes from matching against it and mapping a view to a likely undesired workspace.
2020-01-01Make sure we don't calculate fractional pixel gapsPedro Côrte-Real
When gaps are resized for lack of space the calculation could result in a gap size of non-integer pixels. This would result in containers located at non-integer pixels which would be subtly broken.
2020-01-01Avoid numerical instability in resizePedro Côrte-Real
Because the layout code rounds down the dimensions of the windows resizing would often be off by one pixel. The width/height fraction would not exactly reflect the final computed width and so the resize code would end up calculating things wrong. To fix this first snap the container size fractions to the pixel grid and only then do the resize. Also use round() instead of floor() during layout to avoid a slightly too small width. This applies in two cases: 1. For the container we are actually resizing using floor() might result in being 1px too small. 2. For the other containers it might result in resizing them down by 1px and then if the container being resized is the last all those extra pixels would make the resize too large. Fixes #4391
2019-12-16root_scratchpad_hide: disable fullscreen descendantsBrian Ashworth
Any descendant of a scratchpad container may be fullscreen so checking to see if the top-level scratchpad container is fullscreen in root_scratchpad_hide is not sufficient. This iterates through all descendants of the scratchpad container
2019-12-12Fix lingering workspace with scratchpad showRonan Pigott
Showing a window in the scratchpad can move a visible scratchpad window from another workspace to the current one. If the scratchpad window was the last visible container in that workspace, the old workspace should be destroyed.
2019-11-29add scale_filter output config optionRonan Pigott
2019-11-17output: add max_render_timeIvan Molodetskikh
2019-11-04smart_borders: separate smartness from edge typesRonan Pigott
2019-10-27Fix segfault in wlr_output_manager_v1_set_configurationSimon Ser
Calling wlr_output_manager_v1_set_configuration with an enabled output and a NULL mode is incorrect if the output doesn't support modes. When DPMS'ing an output, wlr_output_enable(output, false) is called. This de-allocates the CRTC and sets wlr_output.current_mode to NULL. Because we mark DPMS'ed outputs as enabled, we also need to provide a correct output mode. Add a field to sway_output to hold the current mode. Closes: https://github.com/swaywm/wlroots/issues/1867
2019-10-27Fix apply_output_config return value when enabling outputSimon Ser
apply_output_config would call output_enable and always return true, even if the output couldn't be enabled.
2019-09-22view: create container before selecting workspaceRonan Pigott
2019-09-20view: always populate pidBrian Ashworth
If the view was mapped as fullscreen or the view was assigned either a workspace or output, the pid was not being populated since it was occurring as part of the pid mapping check in select_workspace. This extracts the pid population and makes it so it is always executed
2019-08-20Allow moving a container hidden in scratchpadlbonn
(as i3 allows it) Just update the container's coordinates so that they will be applied at the next show.
2019-08-20Remove xdg-shell v6 supportSimon Ser
All major toolkits and apps have gained xdg-shell stable support. Closes: https://github.com/swaywm/sway/issues/3690
2019-08-14workspace_split: focus middle if workspace focusedBrian Ashworth
In workspace_split, the middle container that wraps the workspace's children should be focused for any seat that is focusing the workspace
2019-08-14container_replace: copy {width,height}_fractionBrian Ashworth
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.
2019-08-13workspace: do not destroy if any seat is focusingBrian Ashworth
Since each seat has its own focus, do not destroy a workspace until it is no longer focused by any seat. This prevents seats from being forced to evacuate the workspace just because another seat switched focus away from it
2019-08-13workspace: prefer identifiers for output priorityBrian Ashworth
Since output names can change in various configurations, including DisplayPort MST, prefer output identifiers for the output priority. Users can still use `workspace <ws> output <names-or-ids>`, but any output that is programmatically added to the list will be added under the output identifier. If the output name exists in the list (from the user workspace output configs), then that will be retained instead of switching to the output identifier for that output.
2019-08-12view_update_size: fix surface_width/height mismatchAntonin Décimo
2019-07-27Remove all wayland-server.h includesSimon Ser
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").
2019-07-26arrange: remove gaps for workspace location deltasBrian Ashworth
When arranging the workspace, prev_x and prev_y should be ignoring the current gaps otherwise the workspace diff_x and diff_y location deltas will be off. When the deltas are off, each arrangement of the workspace would incorrectly move floaters an extra -workspace->current_gaps.left along the x-axis and an extra -workspace->current_gaps.top along the y-axis.
2019-07-15Sanity check gaps on the outside of the workspacePedro Côrte-Real
Avoid gaps that are too large around the workspace that you end up without any usable space for children. Fixes #4308
2019-07-15Avoid negative outer gapsPedro Côrte-Real
Make sure we never let the gaps around the workspace go negative. Fixes #4304
2019-07-15Sanity check gaps between tiled containersPedro Côrte-Real
When the gaps become too large for the space available gracefully reduced them all the way to 0 if needed. Fixes #4294
2019-07-15Rework gaps code to be simpler and correctPedro Côrte-Real
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
2019-07-14Layout tiled using a width/height fractionPedro Côrte-Real
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
2019-07-14Layout correctly with several new windowsPedro Côrte-Real
If there is more than one new window layout correctly by calculating the default size of the new windows using the information of how many of them there are in total. This helps with issue #3547 but doesn't fix it in all situations. Things now work correctly if the first layout of new windows happens after leaving fullscreen. But if for some reason an arrange_container() gets called while we are fullscreen the windows will still be incorrectly sized after saved_width/saved_height get used to restore the first window's size before going fullscreen.
2019-06-27tree: set correct border value before creating floaterrandom human
2019-06-23ws-output-priority: fix logic issue in find_outputBrian Ashworth
The function used for comparing two output names in the workspace output priority lists was inverted. This was causing priority to not be stored correctly resulting in workspaces not always being restored or moved to the desired outputs
2019-06-16Fix sway crashes for scratchpad layoutsRouven Czerwinski
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
2019-06-11Fix segfaults caused by faulty command parsingMatt Coffin
This patch fixes faulty command parsing introduced by f0f5de9a9e87ca1f0d74e7cbf82ffceba51ffbe6. When that commit allowed criteria reset on ';' delimeters in commands lists, it failed to account for its inner ','-parsing loop eating threw the entire rest of the string. This patch refactors argsep to use a list of multiple separators, and (optionally) return the separator that it matched against in this iteration via a pointer. This allows it to hint at the command parser which separator was used at the end of the last command, allowing it to trigger a potential secondary read of the criteria. Fixes #4239
2019-05-30Use parent get_root_coords in subsurfacesKenny Levinsen
Subsurfaces need access to the parent get_root_coords impl for positioning in popups. To do this, we store a reference to the parent view_child where applicable. Fixes #4191.
2019-04-24cmd_move: respect workspace layout when insertingBrian Ashworth
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`
2019-04-16Don't apply hide_edge_borders to floating windowsmwenzkowski
This change matches i3's behavior.
2019-04-16view.c: refactor view_autoconfigure()mwenzkowski
2019-04-13Fix scratchpad fullscreen behavior and crashBrian Ashworth
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.
2019-04-12Fix scratchpad logic for floating windowsAshkan Kiani
When a tiled window is sent to the scratchpad, we want to use sane defaults, which is to center it and resize it to the default. For floating windows, we want to use their existing geometry.
2019-04-11Honor output for xdg_toplevel_set_fullscreenBrian Ashworth
This honors the fullscreen output request for `xdg_toplevel_set_fullscreen` and `zxdg_toplevel_v6_set_fullscreen`. If the request was sent before mapping, the fullscreen output request will be retrieved from the client_pending state for the toplevel. The output will be passed to `view_map` and if there is a workspace on the output, the view will be placed on that workspace. If the request comes in after being mapped, the view will be moved to the workspace on the output (if there is one) before becoming fullscreen.
2019-04-04swaybg: one instance for all outputsBrian Ashworth
This makes it so there will only be one swaybg instance running instead of one per output. swaybg's cli has been changed to a xrandr like interface, where you select an output and then change properties for that output and then select another output and repeat. This also makes it so swaybg is only killed and respawned when a background changes or when reloading.
2019-04-03root_scratchpad_hide: fix crash when layer focusedBrian Ashworth
This fixes a crash in `root_scratchpad_hide` when a layer surface is focused. Since `seat_get_focus` is NULL when a layer surface is focused, the call to `node_has_ancestor` was causing a SIGSEGV since it was attempting to access the parent of NULL. This changes the call to `seat_get_focus_inactive`, which will return a node even when a layer surface is focused and is also guaranteed to have something in the focus stack if a scratchpad container is being hidden (otherwise there would not be any containers yet).
2019-03-31scratchpad: set initial sizeBrian Ashworth
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.
2019-03-31floating: fix size of non-view containersBrian Ashworth
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.
2019-03-31Fix xwayland configure request scratchpad crashBrian Ashworth
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.
2019-03-24Add support for manually setting subpixel hinting on outputs.Geoff Greer
Many laptop screens report unknown subpixel order. Allow users to manually set subpixel hinting to work around this. Addresses https://github.com/swaywm/sway/issues/3163
2019-03-23Allow for workspace renaming during exec handlingmliszcz
This change adds support for renaming a workspace when `exec` command is being processed by keeping sway_workspace and pid_workspace names in sync. The change can be verified by running following command: swaymsg exec <application>; swaymsg rename workspace number 1 to 5 Fixes: #3952