summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorLines
2020-01-05input/cursor: handle setting a NULL image surface1.3-rc2Furkan Sahin-7/+13
This fixes a crash when attempting to listen to a signal on a NULL cursor image surface. If the surface is NULL, the listener is just reinitialized using wl_list_init.
2020-01-05input/cursor: handle image surface destroyFurkan Sahin-0/+19
This adds a listener for the destroy event of the cursor image surface. This prevents a use-after-free when the last visible image surface is freed, there has not been a new cursor set, and the cursor is reshown.
2020-01-03swaybar: Fix input device removalFurkan Sahin-8/+10
Before swaybar would exit with a protocol error when a pointer or touch device was removed.
2020-01-05Fix small typo in sway-input(5)Furkan Sahin-1/+1
2020-01-05Add missing items to documentation for GET_TREE response in ipc.Furkan Sahin-0/+31
A few items in the response for the get_tree ipc call were missing from the documentation. This adds some documentation for them.
2020-01-03xwayland: handle size_hints == NULLFurkan Sahin-0/+9
In case xcb-iccm is not installed on the system, size_hints will be null. Handle this as if the get_constraints functions was not implemented and return the defaults. Fixes #4870
2020-01-01input: Assign virtual input devices to their selected seatsFurkan Sahin-4/+19
2019-07-28Make all the container dimensions integersFurkan Sahin-11/+11
Containers are always fixed to the pixel grid so position and size them with integers instead of doubles. Functionally this should be no different since rounding down is already being done on things like layout. But it makes it clear what the intention is and avoids bugs where fractional pixels are used. The translating and moving code is still using doubles because the cursors can have fractional pixels and thus the code is plumbed that way. But that could also probably be changed easily by doing the integer conversions earlier and plumbing with int.
2019-07-28Make sure we don't calculate fractional pixel gapsFurkan Sahin-2/+2
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.
2019-07-28Avoid numerical instability in resizeFurkan Sahin-6/+33
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-31Update version to 1.3-rc11.3-rc1Furkan Sahin-2/+2
2019-12-31_incr_version: always overwrite old version numberFurkan Sahin-2/+2
2019-12-31_incr_version: prompt for target wlroots releaseFurkan Sahin-0/+8
2019-10-20Add virtual pointer protocolFurkan Sahin-0/+41
2019-12-31Fix sway_log using non initialised output_config pointerFurkan Sahin-1/+1
This fixes a crash where the `oc->name` would be accessed by sway_log() even when `oc` was NULL.
2019-12-27Re-add support for wlr_output's atomic APIFurkan Sahin-30/+37
This reverts commit 8420f57618d6dff4298389ad193e62a7ddeb10f9 and re-applies commit 051b6626104858c4245a62d24c69187180a881e8. Outputs now need to be explicitly enabled when performing a modeset. We need to roll back wlr_output_attach_render when we decide not to render. See also: https://github.com/swaywm/wlroots/pull/1797 (wlroots PR) See also: https://github.com/swaywm/sway/pull/4355 (Original sway PR) See also: https://github.com/swaywm/sway/pull/4434 (Revert sway PR)
2019-12-30Add Chinese (zh-TW) translation of READMEFurkan Sahin-1/+65
Co-authored-by: xdavidwu <xdavidwuph@gmail.com>
2019-12-28cmd_client_*: support optional args for i3 compatFurkan Sahin-22/+31
For i3 compatibility, allow the indicator and child_border colors values to be optional. The indicator will fallback to sane defaults and child_border will fallback to the background color for the class.
2019-12-29Fix typo in swaybar-protocol.7.scdFurkan Sahin-0/+1
2019-12-28bar_cmd_colors: remove add_colorFurkan Sahin-49/+33
This is the third commit in a series of commits to refactor color handling in sway. This removes add_color from commands.c. It was only being used by bar_cmd_colors. This also changes the functions to use parse_color which is used to validate rgb(a) colors throughout the code base and is also what i3bar is using to parse the colors after they are passed over ipc. After parsing the color and ensuring it is valid, the rgba hex string is then generated using snprintf. This refactor also ensures that all the colors for the command are valid before applying any of them.
2019-12-27cmd_client_*: refactor duplicated codeFurkan Sahin-104/+62
This is the second in a series of commits to refactor the color handling in sway. This removes the duplicated color parsing code in sway/commands/client.c. Additionally, this combines the parsing of colors to float arrays with that in sway/config.c and introduces a color_to_rgba function in commom/util.c. As an added bonus, this also makes it so non of the colors in a border color class will be changed unless all of the colors specified are valid. This ensures that an invalid command does not get partially applied.
2019-12-27parse_color: return success + drop fallback colorFurkan Sahin-142/+76
This is the first in a series of commits to refactor the color handling in sway. This changes parse_color to return whether it was success and no longer uses 0xFFFFFFFF as the fallback color. This also verifies that the string actually contains a valid hexadecimal number along with the length checks. In the process of altering the calls to parse_color, I also took the opportunity to heavily refactor swaybar's ipc_parse_colors function. This allowed for several lines of duplicated code to be removed.
2019-12-26layer-shell: refocus if keyboard interactive lostFurkan Sahin-0/+3
When arranging layer-shell layers, verify that the currently focused layer, if any, for each seat is still keyboard interactive. If the layer is no longer keyboard interactive and there is not a keyboard interactive overlay or top layer to change the focus to, refocus the focus inactive node for the seat.
2019-12-26config/output: apply scale_filter even when scale has not changedFurkan Sahin-0/+2
2019-12-23desktop/surface: Fix crash when timer is NULLFurkan Sahin-1/+6
When many surfaces are created, sway can run out of file descriptors, making wl_event_loop_add_timer (which creates a timerfd) fail and return NULL. This patch posts a "no memory" error when that is the case, and only removes the timer if it was created. (Why "no memory"? It is not easy to distinguish between failures due to running out of memory and failures due to running out of file descriptors. Also, using the newer `wl_client_post_implementation_error` function would lead to an increased version requirement for the libwayland-server dependency.)
2019-12-16License wallpapers as CC-0Furkan Sahin-0/+121
2019-12-15seat_cmd_keyboard_grouping: change keymap to smartFurkan Sahin-28/+45
This removes `seat <seat> keyboard_grouping keymap` and replaces it with `seat <seat> keyboard_grouping smart`. The smart keyboard grouping will group based on both the keymap and repeat info. The reasoning for this is that deciding what the repeat info should be for a group is either arbitrary or non-deterministic when multiple keyboards in the group have repeat info configured (unless somehow exposed to the user in a reproducible uniquely identifiable fashion).
2019-12-15input/seatop_default: fix focusing floating titlesFurkan Sahin-1/+2
When clicking on the titlebar of a floating container (or descendant of a floating container), the top-level floating container was being focused and then allowing you to move the top-level floating container. This made it so you couldn't switch to a different tab/stack within the floating container. With this patch, the focus inactive view for the container that the titlebar is associated with is focused, then the traversal to the top-level floating container is performed to use with the move floating operation.
2019-12-15root_scratchpad_hide: disable fullscreen descendantsFurkan Sahin-3/+8
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-14config/input: set type for new identifier configsFurkan Sahin-0/+24
When an input becomes available, the input type config for that device type will be merged underneath the input identifier config, provided they both exist. If an input type config gets added or modified at a later point, then those changes get merged onto the input identifier configs for that type. However there was a missing case of the input identifier config being added after the device is already available and the input type config existing. This makes it so that the first time an input identifier config gets stored, there will be a check to see if it matched any of the available devices. If it does, then there will be a search for the associated input type config, which will be merged underneath the input identifier config if found.
2019-12-13input/keyboard: defer wlr_keyboard_group destroyFurkan Sahin-1/+9
This defers the destruction of wlr_keyboard_groups until idle. This is to prevent the keyboard group's keyboard from being destroyed in the middle of handling a keyboard event. This would occur when changing the keymap of the last keyboard in a group with a keyboard binding. The prevents crashing when attempting to update the xkb state of the keyboard group's keyboard. The sway_keyboard_group is still immediately destroyed so that the group is no longer used
2019-12-12input/keyboard: remove group listeners on destroyFurkan Sahin-0/+2
This adds two missing calls to wl_list_remove to remove the key and modifier listeners for the keyboard group's keyboard when destroying the keyboard group. This fixes some crashes when changing the keymap of the last keyboard in a group with a keyboard binding.
2019-12-10Auto-detect output scaleFurkan Sahin-3/+53
If the screen DPI is high enough, auto-enable scale=2 (if the user hasn't set the scale). Uses heuristics based on [1]. [1]: https://gitlab.gnome.org/GNOME/mutter/blob/05217066171992b0bc50882869aad6385285c878/src/backends/meta-monitor.c#L1590 Closes: https://github.com/swaywm/sway/issues/1800
2019-12-11Add seat <seat> idle_{inhibit,wake} <sources...>Furkan Sahin-11/+159
This adds seat configuration options which can be used to configure what events affect the idle behavior of sway. An example use-case is mobile devices: you would remove touch from the list of idle_wake events. This allows the phone to stay on while you're actively using it, but doesn't wake from idle on touch events while it's sleeping in your pocket.
2019-12-12Fix lingering workspace with scratchpad showFurkan Sahin-0/+1
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-12-10layer-shell: unfocus output-less layer on unmapFurkan Sahin-9/+9
If a layer is focused by any seat, it needs to be unfocused on unmap. If the unmap was due to an output being disabled, there would not be a sway_output and unmap would do an early return. This results in a use-after-free if the layer was focused by any seat prior to being unmapped. This change just moves the refocusing code above the early returns.
2019-12-07input/cursor: remove gesture listeners in destroyFurkan Sahin-0/+6
Part of #4794. Forgot to remove gesture listeners when the cursor is destroyed.
2019-12-07input/cursor: pass gesture events to clientsFurkan Sahin-0/+77
Some wayland clients (mostly GTK3 apps) like eog or evince support gestures like pinch-to-zoom. These gestures are given to clients via the pointer_gestures_v1 protocol. This is already supported in wlroots, so we just need to hook up the events here in sway. Fixes #4724
2019-12-05A Script to change sway workspace name.Furkan Sahin-0/+130
This script automatically changes the workspace name when an application gets closed, moved or openend.
2019-12-05Improve transparency scriptFurkan Sahin-17/+53
Transparency gets reset when the script is terminated. Added command line option to set transparency strength without changing the script. Added support for multiple displays.
2019-12-03config: apply input type configs on reloadFurkan Sahin-0/+5
When making the reload validation improvements, I forgot that input type configs are stored in a separate list. This makes it so input type configs are correctly applied on reload.
2019-12-02Revert "fix bar_state_update/input event"Furkan Sahin-4/+4
This reverts commit 1945cbca2fb9f4b7c67780548e7235b016de4725.
2019-12-01fix bar_state_update/input eventFurkan Sahin-4/+4
2019-11-30output: Restore previous max_render_time behaviorFurkan Sahin-1/+1
2019-11-30output: Schedule idle frames if we do not renderFurkan Sahin-0/+7
Repaint scheduling delays output render and frame done events from output frame events, and block idle frame events from being scheduled in between output frame done and output render in this period of time. If a surface is committed after its frame done event, but before output render, idle frame requests will be blocked, and the surface relies on the upcoming render to schedule a frame. If when the repaint timer expires, output render is deemed unnecessary, no frame will be scheduled. This can lead to surfaces never having their frame callbacks fire. To fix this, we store that a surface has requested a frame in surface_needs_frame. When the repaint expires, if no render is deemed necessary, we check this flag and schedule an idle frame. Fixes #4768
2019-11-30output: Replace block_idle_frame with frame_pendingFurkan Sahin-2/+2
2019-11-13add scale_filter output config optionFurkan Sahin-1/+131
2019-11-28output: Ensure that frame_done is delayed on max_render_timeFurkan Sahin-1/+1
max_render_time can be set on output, view, or both. However, if only applied to the output, send_frame_done_iterator would erroneously send frame_done immediately, ignoring the output max_render_time. As damage_handle_frame processed max_render_time correctly, idle frames would be blocked in anticipation of the delay that was meant to happen. Without the delay, frame events would be dispatched during the idle frame block, and some clients would never receive the frame done events they had requested, at least not until something else actively drove another render. Respecting both view and output max_render_time in send_frame_done_iterator ensures that the frame events are always correctly delayed. Fixes #4756
2019-11-28Rename 'node' to 'nodes' in swayipc docFurkan Sahin-1/+1
2019-11-27input/keyboard: reset seat keyboard on destroyFurkan Sahin-3/+6
If a sway keyboard is being destroyed, then the keyboard is being removed from a seat. If the associated wlr_keyboard is the currently set keyboard for the wlr_seat, then we need to reset the wlr_seat's keyboard to NULL so it doesn't reference an invalid device for the seat. The next configured keyboard from the seat or the next keyboard from that seat that has an event will then become the seat keyboard. Similarly, this needs to be done for a wlr_keyboard_group's keyboard when the wlr_keyboard_group is being destroyed.