summaryrefslogtreecommitdiffstats
path: root/sway/desktop/render.c
Commit message (Collapse)AuthorAge
...
* Fix crash when views rapidly map and unmapLibravatar Ryan Dwyer2018-09-06
| | | | | | | | | | | | | | | | | | | | Suppose the following: * Transactions are already in progress - say transaction A. * View A maps, which creates transaction B and appends it to the transaction queue. * View B maps, which creates transaction C and appends it to the queue. * View A unmaps, which creates transaction D and appends it to the queue. * Transaction A completes, so transaction B attempts to save View A's buffer, but this doesn't exist so it saves nothing. * Rendering code attempts to render View A, but there is no saved buffer nor live buffer that it can use. Rather than implement an elaborate solution for a rare circumstance, I've take the safe option of just not rendering anything for that view. It means that if you reproduce the scenario above, you might get the title and borders rendered but no surface.
* Don't use wlr_output propertiesLibravatar Ryan Dwyer2018-09-05
| | | | These properties are before rotation.
* 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.
* Fix crash when a splash screen opens on an empty workspaceLibravatar Ian Fan2018-09-03
|
* Fix gaps issuesLibravatar Ryan Dwyer2018-08-28
| | | | | | | | | * In layout command, arrange parent of parent - not sure why this is needed but it is * Remove gap adjustment when rendering * Workspace should use outer gaps, not inner * Add exceptions for tabbed and stacked containers * Don't mess with gap state when splitting a container
* Prepare arrange code for type safe argumentsLibravatar Ryan Dwyer2018-08-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit changes the arrange code in a way that will support type safe arguments. The arrange_output et al functions are now public, however I opted not to use them directly yet. I've kept the generic arrange_windows there for convenience until type safety is fully implemented. This means this patch has much less risk of breaking things as it would otherwise. To be type safe, arrange_children_of cannot exist in its previous form because the thing passed to it could be either a workspace or a container. So it's now renamed to arrange_children and accepts a list_t, as well as the parent layout and parent's box. There was some code which checked the grandparent's layout to see if it was tabbed or stacked and adjusted the Y offset of the grandchild accordingly. Accessing the grandparent layout isn't easy when using type safe arguments, and it seemed odd to even need to do this. I determined that this was needed because a child of a tabbed container would have a swayc Y matching the top of the tab bar. I've changed this so a child of a tabbed container will have a swayc Y matching the bottom of the tab bar, which means we don't need to access the grandparent layout. Some tweaks to the rendering and autoconfigure code have been made to implement this, and the container_at code appears to work without needing any changes. arrange_children_of (now arrange_children) would check if the parent had gaps and would copy them to the child, effectively making the workspace's gaps recurse into all children. We can't do this any more without passing has_gaps, gaps_inner and gaps_outer as arguments to arrange_children, so I've changed the add_gaps function to retrieve it from the workspace directly. apply_tabbed_or_stacked_layout has been split into two functions, as it had different logic depending on the layout. Lastly, arrange.h had an unnecessary include of transaction.h. I've removed it, which means I've had to add it to several other files.
* 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.
* Merge pull request #2478 from RyanDwyer/standardise-debugLibravatar Drew DeVault2018-08-19
|\ | | | | Standardise debug variables
| * Use enum for damage debug optionsLibravatar Ryan Dwyer2018-08-19
| |
| * Standardise debug variablesLibravatar Ryan Dwyer2018-08-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes all debug options stored in a single struct rather than in various places, changes/fixes the behaviour of existing options, and introduces some new options. * Fixes damage issues with `-Drender-tree` texture (by removing scissor) * Offsets the render tree overlay's `y` position for those who have swaybar at the top * Replaces `-Ddamage=rerender` with `-Dnodamage` * Replaces `-Ddamage=highlight` with `-Dhighlight-damage` * Replaces `-Dtxn-debug` with `-Dtxn-wait` * Introduces `-Dnoatomic` * Removes the `create_time` and `ms_arranging` figures from transactions and the log message. Transactions are created after arranging and the create time is of no significance. * Fixes `-Dtxn-debug` (now `-Dtxn-wait`) not working.
* | 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
* Fix nitpickLibravatar Ryan Dwyer2018-08-18
|
* Store geometry in the view and handle any floating view resizingLibravatar Ryan Dwyer2018-08-18
|
* Render saved buffer using saved geometryLibravatar Ryan Dwyer2018-08-18
|
* Fix geometryLibravatar Ryan Dwyer2018-08-18
|
* Add using_csd variable to transaction stateLibravatar Ryan Dwyer2018-08-17
| | | | | | | | | | | This fixes a race condition flicker when unfloating a view which uses client side decorations. When the view is floated it has using_csd = true, so the decorations are not drawn. When unfloating it it changes to false, but this change wasn't part of transactions so it could potentially render the decorations around the view while it's waiting for the transaction to apply.
* Convert toplevel coordinates to output-localLibravatar Ryan Dwyer2018-08-02
|
* 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 branch 'master' into fix-resize-wiggleLibravatar emersion2018-08-02
|\
| * 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)
* | Correctly track saved surfaces during multiple transactionsLibravatar Ryan Dwyer2018-08-01
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #2364. Suppose a view is 600px wide, and we tell it to resize to 601px during a resize operation. We create a transaction, save the 600px buffer and send the configure. This buffer is saved into the associated instruction, and is rendered while we wait for the view to commit a 601px buffer. Before the view commits the 601px buffer, suppose we tell it to resize to 602px. The new transaction will also save the buffer, but it's still the 600px buffer because we haven't received a new one yet. Then suppose the view commits its original 601px buffer. This completes the first transaction, so we apply the 601px width to the container. There's still the second (now only) transaction remaining, so we render the saved buffer from that. But this is still the 600px buffer, and we believe it's 601px. Whoops. The problem here is we can't stack buffers like this. So this commit removes the saved buffer from the instructions, places it in the view instead, and re-saves the latest buffer every time the view completes a transaction and still has further pending transactions. As saved buffers are now specific to views rather than instructions, the functions for saving and removing the saved buffer have been moved to view.c. The calls to save and restore the buffer have been relocated to more appropriate functions too, favouring transaction_commit and transaction_apply rather than transaction_add_container and transaction_destroy.
* Completely switch over to new iteratorsLibravatar emersion2018-07-29
|
* wip: redesign output_view_for_each_surface iteratorLibravatar emersion2018-07-29
|
* wip: redesign output_layer_for_each_surface iteratorLibravatar emersion2018-07-29
|
* wip: redesign output_drag_icons_for_each_surface iteratorLibravatar emersion2018-07-29
|
* wip: redesign output_unmanaged_for_each_surface iteratorLibravatar emersion2018-07-29
|
* 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.
* Fix indentLibravatar Ryan Dwyer2018-07-26
|
* Allow containers to be fullscreenLibravatar Ryan Dwyer2018-07-26
|
* Merge pull request #2353 from emersion/render-opaque-overlayLibravatar Drew DeVault2018-07-25
|\ | | | | Improve rendering with a fullscreen opaque overlay surface
| * Improve rendering with a fullscreen opaque overlay surfaceLibravatar emersion2018-07-25
| | | | | | | | | | | | | | | | | | | | | | | | The rendering code doesn't use the exclusive input surface at all anymore to decide to skip rendering of shell surfaces. This fixes a weird situation in which a client requests exclusive input but isn't an overlay layer surface. The renderer also renders all overlay surfaces in this situation, not just one. This simplifies the code and fixes rendering when there are more than one overlay surfaces (e.g. for a virtual keyboard to type the lockscreen password).
* | reverted includes of "sway/config.h" and replaced with "config.h" from meson ↵Libravatar Pascal Pascher2018-07-25
| | | | | | | | build
* | style fixes, exclude sway/desctop/xwayland.c when enable_xwayland: falseLibravatar Pascal Pascher2018-07-24
| |
* | Added meson option "enable_xwayland" (default: true) to enable/disable ↵Libravatar Pascal Pascher2018-07-24
|/ | | | xwayland support
* fix crash on new output while swaylock is runningLibravatar somdoron2018-07-23
|
* Implement default_floating_border command and adjust CSD behaviourLibravatar Ryan Dwyer2018-07-17
|
* Render containers as urgent if they have an urgent childLibravatar Ryan Dwyer2018-07-16
|
* Implement urgency base functionalityLibravatar Ryan Dwyer2018-07-16
| | | | | | Introduces a command to manually set urgency, as well as rendering of urgent views, sending the IPC event, removing urgency after focused for one second, and matching urgent views via criteria.
* Make focus part of transactionsLibravatar Ryan Dwyer2018-07-15
| | | | | | | | | | | | Rather than maintain copies of the entire focus stack, this PR transactionises the focus by introducing two new properties to the container state and using those when rendering. * `bool focused` means this container has actual focus. Only one container should have this equalling true in its current state. * `struct sway_container *focus_inactive_child` points to the immediate child that was most recently focused (eg. for tabbed and stacked containers).
* Add extended debugging flagsLibravatar Drew DeVault2018-07-14
| | | | | | We currently have several ways of setting debug flags, including command line arguments, environment variables, and compile-time macros. This replaces the lot with command line flags.
* Use saved buffer when fullscreen view is in a transactionLibravatar Ryan Dwyer2018-07-11
| | | | Fixes #2237.
* removed unnecessary parensLibravatar russ morris2018-07-10
|
* fix line lengthsLibravatar russ morris2018-07-10
|
* tabs instead of spacesLibravatar russ morris2018-07-10
|
* fix tabbed titlebar widthsLibravatar russ morris2018-07-10
|
* Fix titlebar rendering for nested stacked containersLibravatar Konstantin Pospelov2018-07-10
|
* Split rendererLibravatar emersion2018-07-07