aboutsummaryrefslogtreecommitdiff
path: root/sway/tree/view.c
AgeCommit message (Collapse)Author
2021-02-09shells: Only center tiled views on size changeKenny Levinsen
The size of a tiled container cannot change in response to new buffer sizes, so there is no need to commit a new transaction. Instead, simply recenter the view with the new geometry, leaving the full transaction flow for floating containers.
2021-02-09transaction: Move centering to view_center_surfaceKenny Levinsen
This will allow us to reuse it for centering elsewhere.
2021-02-09view: Save surface x and y on saved buffersKenny Levinsen
We need to use surface_x and surface_y when rendering and damaging saved buffers as these compensate for views that have been centered due to being smaller than their container. Add them to the surface positions on the saved buffer so we have the values from the time the buffer was saved.
2021-01-25Implement foreign toplevel fullscreen output hintsfwsmit
2021-01-20Adhere to ICCCM focus specificationBrassyPanache
For certain applications (e.g. JetBrains) the parent window controls input. We need to adhere to the ICCCM input focus specification to properly handle these cases. Relates to swaywm/wlroots#2604
2021-01-12Switch to wlr_xdg_surface_for_each_popup_surfaceSimon Ser
Instead of calling wlr_xdg_surface_for_each_popup and then wlr_surface_for_each_surface, use the new for_each_popup_surface helper introduced in [1] that does it in one go. [1]: https://github.com/swaywm/wlroots/pull/2609
2020-12-20Change workspace_layout to match i3 behaviorRonan Pigott
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.
2020-11-11tree/container: introduce `container_is_sticky[_or_child]` functionsTudor Brindus
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.)
2020-10-25Smart borders fix: always show borders for floating containersDimitris Triantafyllidis
Currently, in view_autoconfigure, the only condition for show_border is !view_is_only_visible. view_is_only_visible does not cross the boundary between the workspace's tiling and floating lists and does not differentiate between them. The result is, that in a workspace with zero or more tiling containers and a single floating container, the floating container will lose its borders as soon as it is split, provided that a only one view is visible within the floating container. Fixed by adjusting the condition for show_borders.
2020-08-05view: remove foreign toplevel listeners on destroyRonan Pigott
2020-08-05view: implement foreign toplevel fullscreen requestRonan Pigott
2020-07-25view: display scratchpad hidden containers when activated by ftmRonan Pigott
2020-07-03tree/view: fix segfault in view_update_titleSimon Ser
xdg-shell doesn't allow clients to set the title to NULL, so we shouldn't need to call wlr_foreign_toplevel_handle_v1_set_title with an empty string to reset the old one. Closes: https://github.com/swaywm/sway/issues/5488
2020-07-01tree/view: Make foreign-toplevel app_id fallback to classJohan Bjäreholt
It is not a part of the foreign-toplevel-management protocol to get the class of a toplevel, only for getting the app_id. For xwayland clients this is an issue because that means that you cannot identify what application the toplevel refers to which is the point of the app_id property. By falling back to class when an app_id does not exist solves this problem. Phoc also uses app_id and class interchangeably in their implementation of foreign-toplevel-management, in fact they always do that and not only for just this protocol. https://source.puri.sm/Librem5/phoc/-/blob/c8d8a4c5440a6c1647b09dbd3bba7999f9cd433c/src/xwayland.c#L236
2020-06-27tree/view: fix smart borders with tabbed/stacked ancestorTudor Brindus
Fixes #5484.
2020-06-23Implement wlr-foreign-toplevel-management-v1Drew DeVault
2020-06-17Add support for viewporterSimon Ser
Depends on [1]. [1]: https://github.com/swaywm/wlroots/pull/2092
2020-06-12Remove view child surface_{map,unmap} listeners on destroySimon Ser
2020-06-13view: fix surface_new_subsurface use-after-freeRonan Pigott
2020-06-08tree/view: fix smart gaps when ancestor container is tabbed or stackedTudor Brindus
Fixes #5406.
2020-06-05Save transform during transactionKalyan Sriram
Closes: https://github.com/swaywm/sway/issues/5412
2020-06-03container: Remove useless surface dimensionsKenny Levinsen
The adjustments to resize logic left them unnecessary.
2020-06-03view: update_size should only update pending sizeKenny Levinsen
Updating the current size outside transactions lead to rendering glitches during resizes.
2020-06-03view: Save all buffers associated with viewKenny Levinsen
During the execution of a resize transaction, the buffer associated with a view's surface is saved and reused until the client acknowledges the resulting configure event. However, only one the main buffer of the main surface was stored and rendered, meaning that subsurfaces disappear during resize. Iterate over all, store and render buffers from all surfaces in the view to ensure that correct rendering is preserved.
2020-05-29Add views idle inhibition status in get_tree outputDamien Tardy-Panis
Fixes #5286
2020-05-13commands: Add per-view shortcuts_inhibitor commandMichael Weiser
Add a separate per-view shortcuts_inhibitor command that can be used with criteria to override the per-seat defaults. This allows to e.g. disable shortcuts inhibiting globally but enable it for specific, known-good virtualization and remote desktop software or, alternatively, to blacklist that one slightly broken piece of software that just doesn't seem to get it right but insists on trying. Add a flag to sway_view and handling logic in the input manager that respects that flag if configured but falls back to per-seat config otherwise. Add the actual command but with just enable and disable subcommands since there's no value in duplicating the per-seat activate/deactivate/toggle logic here. Split the inhibitor retrieval helper in two so we can use the backend half in the command to retrieve inhibitors for a specific surface and not just the currently focused one. Extend the manual page with documentation of the command and references to its per-seat sibling and usefulness with criteria. Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
2020-04-02Update for new wlr_buffer APISimon Ser
Update for [1]. [1]: https://github.com/swaywm/wlroots/pull/2044
2020-03-06Use wlr_client_bufferSimon Ser
Update for breaking changes in [1]. [1]: https://github.com/swaywm/wlroots/pull/2043
2020-02-18tree/view: do not attempt enter on hidden childBrian Ashworth
If a subsurface is created for a surface that is associated with a scratchpad hidden view, do not attempt to send an enter to it. The subsurface is not on any output and since there is no workspace associated with the view, attempting to get the output for the NULL workspace will result in a SIGSEGV.
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.
2019-11-04smart_borders: separate smartness from edge typesRonan Pigott
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-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-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-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-06-27tree: set correct border value before creating floaterrandom human
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-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-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-03-11sway_view_child: add listener for view unmapBrian Ashworth
Since not all child views's have an unmap event, it is possible for it to still be mapped (default state) in the destruction handler. When the destruction handler is called, the corresponding view may have already been freed and the memory location reallocated. This adds a listener for the view unmapping and removes the mapped status. This ensures that the child view is damaged due to destruction while the view still exists and not after.
2019-02-24add --i3 flag to hide_edge_bordersdb
Enables i3-compatible behavior regarding hiding the title bar on tabbed and stacked containers with one child. Related issues and merge requests: #3031, #3002, #2912, #2987.
2019-02-13subsurface_get_root_coords: break on NULLBrian Ashworth
It is possible for `wlr_surface_is_subsurface` to return true, but `wlr_surface_from_wlr_surface` to be NULL. This adds a NULL check to the value returned by `wlr_surface_from_wlr_surface` and breaks out of the while loop in `subsurface_get_root_coords`.
2019-02-10view: remove pointer constraints on unmapBrian Ashworth
If the view has any pointer constraints, ensure they are removed before the view is unmapped and the surface is no longer tied to the view.
2019-01-28Introduce container_is_scratchpad_hiddenRyan Dwyer
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
2019-01-28Center surface inside container when it's too smallRyan Dwyer
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.
2019-01-25Implement fullscreen globalRyan Dwyer