aboutsummaryrefslogtreecommitdiffstats
path: root/sway
Commit message (Collapse)AuthorAge
* Prevent use-after-free on first bar subcommand errorLibravatar Michael Weiser2021-04-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If any error is encountered during execution of the first subcommand of a freshly created bar configuration, parsing apparently is to be aborted and the current bar config is freed. The pointer to that memory is left dangling though, leading to a use-after-free on successive bar subcommands. This quite reliably ends in a crash like so: sway -c reproducer.config 00:00:00.083 [sway/config.c:865] Error on line 2 'foo bar': Unknown/invalid command 'foo' (s) free(): double free detected in tcache 2 00:00:00.608 [swaynag/swaynag.c:451] failed to register with the wayland display Aborted (core dumped) Minimal reproducer config: bar { foo bar position top } Other messages: malloc(): unaligned fastbin chunk detected double free or corruption (fasttop) The invalid command has to be the first for a newly created bar config. Removing the command or switching order so it's not the first one masks the problem. Prevent this from occuring by resetting the pointer to NULL after freeing the memory. Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
* cmd_fullscreen: allow fullscreen on fullscreen split containersLibravatar Ronan Pigott2021-04-16
| | | | | | Using the fullscreen command on a child of a fullscreen split container will now fullscreen the child instead of unfullscreening the parent.
* container: don't set fullscreen on childrenLibravatar ash lea2021-04-15
| | | | | | the original behavior set fullscreen for all descendents of a container, which causes issues when firefox is one of those children because it sends its own set_fullscreen request in response to being fullscreened.
* desktop/layer_shell: fix centering for opposing anchorsLibravatar fwsmit2021-04-12
|
* desktop/layer_shell.c: Fix misspelled "exclusive"Libravatar Elyes HAOUAS2021-04-12
| | | | Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
* Log wlroots version on startupLibravatar Simon Ser2021-04-12
| | | | | | Can be useful to make sure a bugfix is included. In the future maybe the wlroots version string could include a commit hash when built from source, too.
* container: retain focus position on floating enableLibravatar Ronan Pigott2021-04-11
| | | | | | When a tiling container is floated, the focus stack needs to be appropraitely modified to return the container to its original position in the tree upon floating disable, like i3.
* Remove WLR_HAS_XDG_FOREIGN checksLibravatar Simon Ser2021-04-11
| | | | References: https://github.com/swaywm/wlroots/pull/2833
* desktop/render: remove unused wlr_gles2_texture_attribsLibravatar Simon Ser2021-04-11
| | | | | We were calling wlr_gles2_texture_get_attribs, but we were never using the result.
* output: damage whole output when exiting scanoutLibravatar Ronan Pigott2021-04-01
|
* config: allow whitespaces in config pathLibravatar columbarius2021-03-25
|
* Add toggle logic inside DPMS handlerLibravatar Ivan Fedotov2021-03-25
| | | | | | | | | | | Logic that obtains current DPMS state is put inside the handler. sway_output from which the current DPMS state will be obtained is selected by the following logic: * For '-' and '--' the focused output is used; * For '*' error "Cannot apply toggle to all outputs" is reported; * For everything else all_output_by_name_or_id() is used. Fixes #5929.
* view: subsurface NULL check in view_from_wlr_surfaceLibravatar Kenny Levinsen2021-03-24
| | | | | Necessary NULL checks had been added to xdg_shell and xwayland surfaces, but subsurfaces had been missed.
* idle_inhibit: Store wlr inhibitor instead of viewLibravatar Kenny Levinsen2021-03-21
| | | | | | | | | | | When an application inhibited idle, a view pointer was stored and a destroy listener was registered to the wlr inhibitor. As the wlr inhibitor lives longer than the view, this lead to a dangling view pointer between view unmap and inhibitor destroy. Store a pointer to the wlr inhibitor instead of to the view, and look up the view when needed, which may at any point be NULL. This also allows for an inhibitor to remain functional if a surface is re-mapped.
* view: Handle NULL role object when role is setLibravatar Kenny Levinsen2021-03-21
| | | | | wlr_(xdg|xwayland)_surface_from_wlr_surface can return NULL even though wlr_surface_is_(xdg|xwayland)_surface returned true.
* Implement input method keyboard grabLibravatar xdavidwu2021-03-12
|
* xwayland: simplify override-redirect focus restorationLibravatar Simon Ser2021-03-12
| | | | | No need to grab the xwayland surface from the wlr_surface, the parent is already an xwayland surface.
* output: simplify layer surface iterationLibravatar Vyivel2021-03-11
|
* container: Add view_container_content_atLibravatar Kenny Levinsen2021-03-10
| | | | | | | | | | | | | | | | container_at checks if the position provided matches the currently focused container with view_container_at as a fast path. view_container_at checks using the main container geometry, which includes the titlebar and border area. If a tabbed container is focused, then positions over unfocused tabs are incorrectly reported as belonging to the focused container, breaking focus on click. Add view_container_content_at for use in the focused container fast path which only tests container content area, and fall back to full workspace scans for border and titlebar areas. Closes: https://github.com/swaywm/sway/issues/6074
* container: Limit tiled focus to container geometryLibravatar Kenny Levinsen2021-03-01
| | | | | | | | | container_at would maintain the current focus as long as a position was over one of the container view's surfaces. If an oversized surface was being clipped, this lead to weird focus behavior. Instead, use view_container_at for this test, which intersects the container box before looking at surfaces.
* render: Clip surfaces to container boundsLibravatar Kenny Levinsen2021-03-01
| | | | | | | If a surface is associated with a sway container, we limit the destination box to the container dimensions. Floating views and popups are exempt from this clipping.
* Fix for_window criteria and mouse button bindingsLibravatar ftilde2021-02-25
| | | | | | | | | | | | | | | | | | | Previously, the special case handling of scratchpad and unmark commands was (probably accidentally) limited to criteria directly handled in the execute_command function. This would exclude: 1. for_window criteria, as these are handled externally for views and 2. and mouse bindings which select target the node currently under the mouse cursor. As a concrete example `for_window [app_id="foobar"] move scratchpad, scratchpad show` would show (or hide due to the toggling functionality) another window from the scratchpad, instead of showing the window with app_id "foobar". This commit replaces the "using_criteria" flag with "node_overridden" with the more general notion of signifying that the node (and container/workspace) in the current command handler context of the sway config is not defined by the currently focused node, but instead overridden by other means, i.e., criteria or mouse position.
* focus: beyond fullscreen when focused explicitlyLibravatar lbonn2021-02-25
| | | | | | | When issuing a focus command on a specific container, users expect to proceed it even if is hidden by a fullscreen window. This matches the behavior of i3.
* Automatically map built-in touchscreens/tablets to built-in panelsLibravatar Simon Ser2021-02-25
| | | | | Detect whether an output is built-in via its type. Detect whether a touchscreen or tablet tool is built-in via its ID_PATH property.
* man: document `input XXX map_to_output *`Libravatar Simon Ser2021-02-25
| | | | This is useful to reset the output mapping.
* render: handle containers without output when rendering titlesLibravatar Quantum2021-02-25
| | | | | | | | | | | In e0a94bee8da3271f942c0881ee18a7e2d4138063, it was believed that if the container is being rendered, it must have an output. This turned out not to be the case. When rendering a container, all its children are rendered, even if the children is positioned off screen and thus not having any output. This is the cause of the crash in #6061. This commit introduces a null-check, which fixes #6061.
* output: Reconfigure xcursor when applying output configLibravatar Tadeo Kondrak2021-02-24
| | | | | | | | | | | | Before this commit, when an output had its scale dynamically changed, Sway would not load a cursor theme with the new scale. This results in stale cursor images when moving the cursor into an area controlled by the compositor, like the background or resize areas. To reproduce: - Using IPC, set an output scale to a value that isn't currently used - Move the cursor into a compositor-controlled area - The cursor will not change
* build: Add dependency on libdrmLibravatar Tadeo Kondrak2021-02-23
| | | | | | As of 66343839b146a54505b746784cd42a8efb844963, sway now uses a libdrm header. Add this dependency to the build system so headers from it can be used on systems where pkg-config is required to find them.
* shells: Update comment about size change on commitLibravatar Kenny Levinsen2021-02-23
|
* transaction: Remove unused ready_immediatelyLibravatar Kenny Levinsen2021-02-23
|
* transaction: Note if instructions are server requestsLibravatar Kenny Levinsen2021-02-23
| | | | | | | | | On server request, we need to send configure events to inform the client of the new intended size. If the client changes size itself, sending a configure event will only cause problems. Use transaction_commit_dirty_client to distinguish between the two transaction causes.
* Fix wl_shm_format passed to wlr_texture_from_pixelsLibravatar Simon Ser2021-02-23
| | | | See https://github.com/swaywm/wlroots/pull/2744
* Fix #5643, #5064: rounding issues in floating-point -> integer conversionsLibravatar Dimitris Triantafyllidis2021-02-22
| | | | | | | | | | | | | Currently, various floating-point expressions involving the coordinates of borders, titlebars and content surfaces are directly assigned to integers, and so they are rounded towards zero. This results in off-by-one distances between these elements when the signs of their coordinates differ. Fixed by wrapping these expressions with a call to floor before the assignment.
* view: Set parent for view_child subsurfaces on initLibravatar Kenny Levinsen2021-02-23
| | | | | | | | | | | | view_child_init was calling view_init_subsurfaces, which did not set the parent attribute for the subchildren. This lead to the subchildren acting as standalone children. If the parent was an xdg_popup, this would make the subchild unaware of the popup position. Introduce view_child_init_subsurfaces for view_child_init to use instead. Closes: https://github.com/swaywm/sway/issues/6038
* view: Mark subchildren as unmapped in view_child_destroyLibravatar Kenny Levinsen2021-02-23
| | | | | | | The subchildren lose their parent association at this point, so they will not be able to see that the parent is unmapped. Instead, just set the subchildren to be unmapped directly.
* view: Recursively check mapped of view_child treeLibravatar Kenny Levinsen2021-02-23
| | | | A subsurface may be set to mapped without its parent.
* container: Add container_is_current_floatingLibravatar Kenny Levinsen2021-02-22
| | | | | Needed to check if containers are currently floating from render code, as container_is_floating checks pending state.
* render: scale titlebars correctly when straddling outputsLibravatar Quantum2021-02-22
| | | | | | | | | | | | When a container straddles multiple outputs, the title bar is only rendered at the scale of the "effective" output. If the title bar straddles onto another output with a different scale factor, it was drawn at the wrong size. In this commit, we take into consideration the scale the title was rendered at and scale it accordingly so that it appears at the right size on the other outputs. This fixes #6054.
* Fix incorrect damage being applied on popupsLibravatar Tadeo Kondrak2021-02-21
| | | | | | | | To reproduce: - Open a floating window and a popup that hangs over the bottom or right - Move the window in the direction of the popup overhang - The previous position of the popup is damaged, not the new one
* render: Use current instead of pending fullscreenLibravatar Kenny Levinsen2021-02-16
|
* container: Move pending state to state structLibravatar Kenny Levinsen2021-02-16
| | | | | | | | | Pending state is currently inlined directly in the container struct, while the current state is in a state struct. A side-effect of this is that it is not immediately obvious that pending double-buffered state is accessed, nor is it obvious what state is double-buffered. Instead, use the state struct for both current and pending.
* Add missing transaction commits to seatop_defaultLibravatar David962021-02-16
| | | | | | | | | Every seat_set_focus* should be followed by a transaction_commit_dirty. In cases where the focus change is followed by a seatop_begin* this is not needed, as transaction_commit_dirty is then called by the seatop_begin* function. Fixes #6034
* text_input: Add support for focusing layer-shell surfacesLibravatar Tadeo Kondrak2021-02-15
|
* transactions: Amend pending transactionsLibravatar Kenny Levinsen2021-02-16
| | | | | | | | | | | | | | | | The transaction system contains a necessary optimization where a popped transaction is combined with later, similar transactions. This breaks the chronological order of states, and can lead to desynchronized geometries. To fix this, we replace the queue with only 2 transactions: current and pending. If a pending transaction exists, it is updated with new state instead of creating additional transactions. As we never have more than a single waiting transaction, we no longer need the queue optimization that is causing problems. Closes: https://github.com/swaywm/sway/issues/6012
* Align ordering of core node properties with i3Libravatar Jan Palus2021-02-15
| | | | | | | | | | Try to better mimic JSON node structure produced by i3 which might be relied on by already existing tools. In particular having "type" right after "id" is quite handy for streaming high-performance JSON parsers such as simdjson (which are handy for maintaining responsiveness on resource constrained systems). refer https://github.com/i3/i3/blob/ab2a22a78b25ad12fed2c177a34c44950795cf33/src/ipc.c#L338
* transaction: Only wait for ack from visible viewsLibravatar Kenny Levinsen2021-02-15
| | | | | | | | | | | | | Transactions currently wait for all configures to be acked, regardless fo what they were sent to. This includes views that are hidden in tabbed or stacked containers. If these views do not ack the configure in response to a single frame callback, they can cause transaction timeouts. Check if a container is hidden before registering the configure serial and saving any view buffers. Closes: https://github.com/swaywm/sway/issues/6023
* text_input: Only send surrounding_text and content_type if supportedLibravatar Tadeo Kondrak2021-02-15
|
* text_input: Ignore text_input disable from unfocused windowsLibravatar Tadeo Kondrak2021-02-15
| | | | | | | Before this commit, there would be cases where focus changes from one window to another, the new window activates text_input, then the old window sends a deactivate request, making text_input unfocused completely.
* input: Commit transactions in seatop_defaultLibravatar Kenny Levinsen2021-02-15
| | | | | This is needed for focus_follows_mouse, and was accidentally omitted in the previous transaction commit shuffle.
* input: Only commit transactions when necessaryLibravatar Kenny Levinsen2021-02-14
| | | | | | | | | | | There is no need to check for transactions at the end of every user input, as the vast majority of input will not issue transactions. This implementation can also hide where changes are made without an appropriate transaction commit, as a future unrelated input would issue the commit instead. Instead, commit transactions in places where changes are made or are likely to be made.