aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop
Commit message (Collapse)AuthorAge
* damage: remove output_damage_viewLibravatar Brian Ashworth2019-03-11
| | | | | | | This removes `output_damage_view` since it is unnecessary. The logic has been moved into its only caller `output_damage_from_view`. When damaging the whole view, `output_damage_whole_container` should be used instead
* output_damage_whole_container: damage subsurfacesLibravatar Brian Ashworth2019-03-11
| | | | | | | | This adds an iterative call in `output_damage_whole_container` to damage the subsurfaces for all visible views that are inside of the container. This is needed to damage subsurfaces that extend outside the box of the container. Without this, those subsurfaces will create artifacts when moving or resizing.
* render_floating: skip fullscreen floatersLibravatar Brian Ashworth2019-03-04
| | | | | | | | If a floater is fullscreen either on a workspace or globally, it should not be rendered on any output is is not fullscreened on. When rendering it on an output it should not be rendered on, there will be an extraneous border along the adjacent side of the output. This adds a check in render_floating to skip all fullscreened floaters
* handle_layer_shell_surface: do not use noop outputLibravatar Brian Ashworth2019-02-25
| | | | | | | | If the noop output is focused (all other outputs disabled/disconnected), do not auto assign a layer surface to it. The noop output is not enabled and does not have the `output->layers` list initialized. It also does not make sense to map the layer surfaces to something that is not visible.
* view: set xdg_decoration->view to NULL, check decoration destroyLibravatar Rouven Czerwinski2019-02-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes heap-use-after-free: ==32046==ERROR: AddressSanitizer: heap-use-after-free on address 0x615000064d20 at pc 0x55571ce4d303 bp 0x7fff545c64c0 sp 0x7fff545c64b0 WRITE of size 8 at 0x615000064d20 thread T0 #0 0x55571ce4d302 in xdg_decoration_handle_destroy ../sway/xdg_decoration.c:13 #1 0x7f64009d6f36 in wlr_signal_emit_safe ../util/signal.c:29 #2 0x7f64009d3c46 in toplevel_decoration_handle_resource_destroy ../types/wlr_xdg_decoration_v1.c:65 #3 0x7f6400a19f8d (/usr/lib/x86_64-linux-gnu/libwayland-server.so.0+0x7f8d) #4 0x7f6400a19fed in wl_resource_destroy (/usr/lib/x86_64-linux-gnu/libwayland-server.so.0+0x7fed) #5 0x7f64009d3d1f in toplevel_decoration_handle_surface_destroy ../types/wlr_xdg_decoration_v1.c:82 #6 0x7f64009d6f36 in wlr_signal_emit_safe ../util/signal.c:29 #7 0x7f64009b059c in reset_xdg_surface ../types/xdg_shell/wlr_xdg_surface.c:453 #8 0x7f64009b0688 in destroy_xdg_surface ../types/xdg_shell/wlr_xdg_surface.c:483 #9 0x7f64009af08c in xdg_client_handle_resource_destroy ../types/xdg_shell/wlr_xdg_shell.c:71 #10 0x7f6400a19f8d (/usr/lib/x86_64-linux-gnu/libwayland-server.so.0+0x7f8d) #11 0x7f6400a1e211 (/usr/lib/x86_64-linux-gnu/libwayland-server.so.0+0xc211) #12 0x7f6400a1e6fe (/usr/lib/x86_64-linux-gnu/libwayland-server.so.0+0xc6fe) #13 0x7f6400a1a0ec in wl_client_destroy (/usr/lib/x86_64-linux-gnu/libwayland-server.so.0+0x80ec) #14 0x7f6400a1a1c4 (/usr/lib/x86_64-linux-gnu/libwayland-server.so.0+0x81c4) #15 0x7f6400a1b941 in wl_event_loop_dispatch (/usr/lib/x86_64-linux-gnu/libwayland-server.so.0+0x9941) #16 0x7f6400a1a569 in wl_display_run (/usr/lib/x86_64-linux-gnu/libwayland-server.so.0+0x8569) #17 0x55571ce4c7fd in server_run ../sway/server.c:214 #18 0x55571ce4ad59 in main ../sway/main.c:405 #19 0x7f640071109a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a) #20 0x55571ce2cfa9 in _start (/usr/local/bin/sway+0x35fa9) 0x615000064d20 is located 32 bytes inside of 504-byte region [0x615000064d00,0x615000064ef8) freed by thread T0 here: #0 0x7f6401531b70 in free (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xedb70) #1 0x55571ce6c72b in destroy ../sway/desktop/xdg_shell.c:252 #2 0x55571cee3f7b in view_destroy ../sway/tree/view.c:60 #3 0x55571cee4090 in view_begin_destroy ../sway/tree/view.c:73 #4 0x55571ce6dd95 in handle_destroy ../sway/desktop/xdg_shell.c:464 #5 0x7f64009d6f36 in wlr_signal_emit_safe ../util/signal.c:29 #6 0x7f64009b059c in reset_xdg_surface ../types/xdg_shell/wlr_xdg_surface.c:453 #7 0x7f64009b0688 in destroy_xdg_surface ../types/xdg_shell/wlr_xdg_surface.c:483 #8 0x7f64009af08c in xdg_client_handle_resource_destroy ../types/xdg_shell/wlr_xdg_shell.c:71 #9 0x7f6400a19f8d (/usr/lib/x86_64-linux-gnu/libwayland-server.so.0+0x7f8d) previously allocated by thread T0 here: #0 0x7f6401532138 in calloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xee138) #1 0x55571ce6df39 in handle_xdg_shell_surface ../sway/desktop/xdg_shell.c:485 #2 0x7f64009d6f36 in wlr_signal_emit_safe ../util/signal.c:29 #3 0x7f64009b0167 in handle_xdg_surface_commit ../types/xdg_shell/wlr_xdg_surface.c:350 #4 0x7f64009ce2a5 in surface_commit_pending ../types/wlr_surface.c:372 #5 0x7f64009ce523 in surface_commit ../types/wlr_surface.c:444 #6 0x7f63ff63ddad in ffi_call_unix64 (/usr/lib/x86_64-linux-gnu/libffi.so.6+0x5dad) Fixes #3759
* 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.
* output_get_active_workspace: check workspaces lengthLibravatar Brian Ashworth2019-02-25
| | | | | | | | | | | | If an output's node was dirty and the transaction was committed before a workspace was moved to or created for the output, the instruction would have a bad value for `state->active_workspace` due to a missing length check in `output_get_active_workspace`. If there was no focus on the output, the first workspace was being returned. If the workspace list was currently empty, the value was either garbage, or in the case of an output being disabled and re-enabled, a workspace that may have been previously freed. This just adds the length check to avoid returning out of bounds value.
* Disconnect swaybg instead of killing itLibravatar emersion2019-02-18
| | | | | This is much more reliable. This also fixes race conditions when killing swaybg while it's doing a wl_display_roundtrip.
* Rebase cursor when a layer surface mapsLibravatar emersion2019-02-18
| | | | | | | Also removes an extraneous arrange_outputs call, it's already called if necessary in arrange_layers. Updates https://github.com/swaywm/sway/issues/3080
* Fix close_popups for xdg-shellLibravatar emersion2019-02-11
| | | | | | wlr_xdg_popup_destroy will destroy popups, so we need to walk the tree carefully. It's enough to just destroy all direct children, since destroying the parent will also destroy all 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.
* Merge pull request #3423 from RyanDwyer/fullscreen-globalLibravatar Drew DeVault2019-01-27
|\ | | | | Implement fullscreen global
| * Implement fullscreen globalLibravatar Ryan Dwyer2019-01-25
| |
* | Use sway_log_errno instead of strerrorLibravatar Ian Fan2019-01-24
|/
* Fix dead stores found by scan-buildLibravatar M Stoeckl2019-01-22
| | | | | | | | In addition to removing unused code, two minor problems are fixed: (1) `resize set` and `resize adjust` did not error when given too many arguments. (2) `orientation` was incorrectly overridden to be 'U' for scroll events in the swaybar tray `handle_click` function.
* Use noop output when there's no outputs connectedLibravatar Ryan Dwyer2019-01-22
| | | | | Instead of having NULL workspace->output pointers, use a noop output. This should be safer.
* 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.
* Fix re-enabling outputs gaining a CRTCLibravatar emersion2019-01-19
| | | | | | If output->configured is true, then the output has been modeset correctly and we don't need to try again. If output->enabled is true, then we are in the process of configuring the output and we shouldn't do anything.
* Prevent crashes in handle_transform and handle_scale tooLibravatar emersion2019-01-19
|
* Better handle outputs without CRTCLibravatar emersion2019-01-18
| | | | | | | This happens if you plug in more outputs than supported by your GPU. This patch makes it so outputs without CRTCs appear as disabled. As soon as they get a CRTC (signalled via the mode event), we can enable them.
* output: remove output_add_listenersLibravatar emersion2019-01-18
| | | | | Simplify the code by registering signals when outputs are created and removing signals when they are destroyed.
* layer_shell: do not SIGABRT sway on zero outputsLibravatar Brian Ashworth2019-01-16
| | | | | If there are no outputs, do not SIGABRT when a layer surface is created, just close the layer surface.
* Remove wlr_xdg_surface_send_close.Libravatar Connor E2019-01-15
|
* 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
* Use %z for printing size_tLibravatar Jan Beich2019-01-06
| | | | | | | | | | | | | | | | | | | | | ../sway/desktop/transaction.c:367:17: error: format specifies type 'long' but the argument has type 'size_t' (aka 'unsigned int') [-Werror,-Wformat] transaction, transaction->num_waiting); ^~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/include/wlr/util/log.h:56:72: note: expanded from macro 'wlr_log' _wlr_log(verb, "[%s:%d] " fmt, _wlr_strip_path(__FILE__), __LINE__, ##__VA_ARGS__) ^~~~~~~~~~~ ../sway/desktop/transaction.c:477:5: error: format specifies type 'long' but the argument has type 'unsigned int' [-Werror,-Wformat] transaction->num_configures - transaction->num_waiting + 1, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/include/wlr/util/log.h:56:72: note: expanded from macro 'wlr_log' _wlr_log(verb, "[%s:%d] " fmt, _wlr_strip_path(__FILE__), __LINE__, ##__VA_ARGS__) ^~~~~~~~~~~ ../sway/desktop/transaction.c:478:5: error: format specifies type 'long' but the argument has type 'size_t' (aka 'unsigned int') [-Werror,-Wformat] transaction->num_configures, ms, ^~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/include/wlr/util/log.h:56:72: note: expanded from macro 'wlr_log' _wlr_log(verb, "[%s:%d] " fmt, _wlr_strip_path(__FILE__), __LINE__, ##__VA_ARGS__) ^~~~~~~~~~~
* Fix fullscreen view rendering crashLibravatar Mack Straight2019-01-01
| | | | | | | See issue #3359 for reproduction details. When a fullscreen view is unmapped and there's a preceding transaction waiting, there may be neither a saved buffer or a surface to render. This change matches the equivalent code in render_view.
* 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
* Fixes per wlroots#1441Libravatar Drew DeVault2018-12-22
|
* Combine output_by_name and output_by_identifierLibravatar Brian Ashworth2018-12-20
| | | | | | | | This combines `output_by_name` and `output_by_identifier` into a single function called `output_by_name_or_id`. This allows for output identifiers to be used in all commands, simplifies the logic of the callers, and is more efficient since worst case is a single pass through the output list.
* Call wlr_output_enable for disabled new outputsLibravatar Brian Ashworth2018-12-10
| | | | | | When a new output is detected and it is disabled by the output config, call `wlr_output_enable(output->wlr_output, false)` to DPMS off the output.
* Update for swaywm/wlroots#1403Libravatar emersion2018-12-01
|
* Fix titlebar when no title or marksLibravatar Brian Ashworth2018-11-28
| | | | This fixes the rendering of the titlebar when there is no title or marks.
* Implement title alignmentLibravatar Brian Ashworth2018-11-25
| | | | | | | | This adds support for `i3 4.16`'s ability to set the title alignment. The command is `title_align left|center|right`. When the title is on the right, marks are moved to the left. Otherwise, they are on the right.
* 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.
* Merge pull request #3102 from emersion/render-software-cursorsLibravatar Drew DeVault2018-11-13
|\ | | | | Render software cursors with wlr_output_render_software_cursors
| * Render software cursors with wlr_output_render_software_cursorsLibravatar emersion2018-11-10
| |
* | Use #if instead of #ifdef for WLR_HAS_*Libravatar emersion2018-11-12
|/
* Use wlr_surface_get_effective_damageLibravatar emersion2018-11-04
|
* 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.
* Revert "Respect border settings when rendering lone tabbed/stacked child"Libravatar Rostislav Pehlivanov2018-10-30
| | | | This reverts commit 65328ef60c9468ae44b4b1d6316d604c47293ec3.
* Use output identifier for workspace configLibravatar Robinhuett2018-10-27
|
* Don't reset cursor during mouse operationsLibravatar Ryan Dwyer2018-10-27
|
* Respect border settings when rendering lone tabbed/stacked childLibravatar Ryan Dwyer2018-10-27
| | | | | | | | | | | | In i3, when a child of a tabbed or stacked container has no siblings, its border settings are respected. This patch achieves the same effect by rendering a lone tabbed/stacked child as if it's a linear container. This makes the border settings be respected. Over in view_autoconfigure, we compensate for this by only adjusting `y_offset` if there's multiple children.
* Rebase the cursor after applying transactionsLibravatar Ryan Dwyer2018-10-25
| | | | | | | | | | | | This approaches cursor rebasing from a different angle. Rather than littering the codebase with cursor_rebase calls and using transaction callbacks, this just runs cursor_rebase after applying every transaction - but only if there's outputs connected, because otherwise it causes a crash during shutdown. There is one known case where we still need to call cursor_rebase directly, and that's when running `seat seat0 cursor move ...`. This command doesn't set anything as dirty so no transaction occurs.
* Merge pull request #2950 from emersion/presentation-timeLibravatar Drew DeVault2018-10-25
|\ | | | | Implement the presentation-time protocol