Commit graph

7210 commits

Author SHA1 Message Date
Rouven Czerwinski 0efc28e2f5 input/seatop_default: release on empty workspace
Instead of handling presses and releases on empty workspaces as setting
focus to the workspace, handle releases by notifying the seat of a
pointer action. This way DnDs are correctly released if the button is
released over an empty workspace. This is achieved by removing the early
return and letting the handle_button() call seat_pointer_notify_button()
at the very end.

Fixes #3932
2020-04-15 13:40:38 +02:00
Di Ma c0bce9138b Fix a use-after-free error in switch binding 2020-04-14 19:41:30 -04:00
Di Ma 2bece94b9b Fix a use-after-free error in switch binding 2020-04-14 19:41:30 -04:00
Di Ma c1c2fe04bb Fix a use-after-free error in switch binding 2020-04-14 19:41:30 -04:00
Di Ma a3e574f63f Fix a use-after-free error in switch binding 2020-04-14 19:41:30 -04:00
Simon Ser b300bace0f Implement create_output command for headless backend 2020-04-14 16:06:20 +02:00
Andri Yngvason b18d943442 input: keyboard: Never group virtual keyboards.
This fixes #5134
2020-04-14 12:07:24 +02:00
Andri Yngvason 46599df0a2 input: Mark virtual devices as such
This is for internal configuration purposes
2020-04-14 12:07:24 +02:00
roshal a1275055ea add dots to man 2020-04-14 10:10:35 +02:00
Simon Ser 4d13cee59a Use bitshifts for bitfields
Instead of hardcoded power of 2 values, use bitshifts. This makes the
enums more readable, avoids mistakes, and makes it clear how much of the
int32_t bit space we have left.

While at it, fix other minor style issues.
2020-04-10 18:08:46 -04:00
Aleksei Bavshin 525b48ede7 Adjust focus order to match rendering order of layer shell popups. 2020-04-10 10:45:47 +02:00
David96 8c62278207 Render layer shell popups over the top layer 2020-04-10 10:45:47 +02:00
Rouven Czerwinski ac0637708f output: remove damage listeners in damage destroy
Instead of removing the destroy listeners in the output destroy, remove
them in the damage destroy handler. Fixes the following use after free:

  ==646625==ERROR: AddressSanitizer: heap-use-after-free on address 0x61200017cab8 at pc 0x0000004f8f29 bp 0x7ffdf465ad30 sp 0x7ffdf465ad20
  WRITE of size 8 at 0x61200017cab8 thread T0

      #0 0x4f8f28 in wl_list_remove ../common/list.c:181
      #1 0x43dd24 in handle_destroy ../sway/desktop/output.c:790
  (`wl_list_remove(&output->damage_destroy.link);` here, 214e3030e1dce master branch)
      #2 0x7f0e573a1c93 in wlr_signal_emit_safe ../util/signal.c:29
      #3 0x7f0e57390954 in wlr_output_destroy ../types/wlr_output.c:365
      #4 0x7f0e5735e37f in backend_destroy ../backend/x11/backend.c:128
      #5 0x7f0e57348147 in wlr_backend_destroy ../backend/backend.c:47
      #6 0x7f0e57356f75 in multi_backend_destroy ../backend/multi/backend.c:54
      #7 0x7f0e5735710e in handle_display_destroy ../backend/multi/backend.c:107
      #8 0x7f0e573f23e4 in wl_display_destroy (/lib64/libwayland-server.so.0+0x93e4)
      #9 0x42f0b2 in server_fini ../sway/server.c:177
      #10 0x42dd01 in main ../sway/main.c:414
      #11 0x7f0e570f7041 in __libc_start_main (/lib64/libc.so.6+0x27041)
      #12 0x40e3bd in _start (/opt/wayland/bin/sway+0x40e3bd)

  0x61200017cab8 is located 120 bytes inside of 320-byte region [0x61200017ca40,0x61200017cb80)
  freed by thread T0 here:
      #0 0x7f0e57aa9357 in __interceptor_free (/lib64/libasan.so.6+0xb0357)
      #1 0x7f0e5738b877 in wlr_output_damage_destroy ../types/wlr_output_damage.c:143
      #2 0x7f0e5738b2b9 in output_handle_destroy ../types/wlr_output_damage.c:13
      #3 0x7f0e573a1c93 in wlr_signal_emit_safe ../util/signal.c:29
      #4 0x7f0e57390954 in wlr_output_destroy ../types/wlr_output.c:365
      #5 0x7f0e5735e37f in backend_destroy ../backend/x11/backend.c:128
      #6 0x7f0e57348147 in wlr_backend_destroy ../backend/backend.c:47
      #7 0x7f0e57356f75 in multi_backend_destroy ../backend/multi/backend.c:54
      #8 0x7f0e5735710e in handle_display_destroy ../backend/multi/backend.c:107
      #9 0x7f0e573f23e4 in wl_display_destroy (/lib64/libwayland-server.so.0+0x93e4)

  previously allocated by thread T0 here:
      #0 0x7f0e57aa9887 in __interceptor_calloc (/lib64/libasan.so.6+0xb0887)
      #1 0x7f0e5738b532 in wlr_output_damage_create ../types/wlr_output_damage.c:91
      #2 0x43e4a7 in handle_new_output ../sway/desktop/output.c:875
      #3 0x7f0e573a1c93 in wlr_signal_emit_safe ../util/signal.c:29
      #4 0x7f0e57357261 in new_output_reemit ../backend/multi/backend.c:143
      #5 0x7f0e573a1c93 in wlr_signal_emit_safe ../util/signal.c:29
      #6 0x7f0e5736030a in wlr_x11_output_create ../backend/x11/output.c:253
      #7 0x7f0e5735e309 in backend_start ../backend/x11/backend.c:113
      #8 0x7f0e573480fb in wlr_backend_start ../backend/backend.c:36
      #9 0x7f0e57356e61 in multi_backend_start ../backend/multi/backend.c:31
      #10 0x7f0e573480fb in wlr_backend_start ../backend/backend.c:36
      #11 0x42f4ba in server_start ../sway/server.c:205
      #12 0x42dbd7 in main ../sway/main.c:394
      #13 0x7f0e570f7041 in __libc_start_main (/lib64/libc.so.6+0x27041)

Fixes #5158
2020-04-10 10:20:21 +02:00
Simon Ser 34dccd4224 Don't add disabled outputs back to output layout
Return early from apply_output_config if the output is disabled.
This restores our previous behavior [1].

[1]: 0cdcf66bbc (diff-4f65f4327e987fef8ec3796cdb07644eL349)
2020-04-09 15:45:29 +02:00
Simon Ser 97a6524a5a Fix initial modeset
An if branch takes care of the case where the output needs to be turned
off (DPMS'ed or disabled). The other branch needs to unconditionally
enable the output.

output->current_mode is already taken care of in apply_config.

Sorry about that, probably made a bad change by mistake after my DRM testing.

Closes: https://github.com/swaywm/sway/issues/5193
2020-04-09 15:45:29 +02:00
Simon Ser c9fa751042 ci: remove epoll-shim hardcoded pkg-config file
The upstream package now provides one.
2020-04-08 16:37:00 +02:00
Simon Ser 3df32d0310 ci: don't build scdoc
scodc is now available in all distributions we have CI for.
2020-04-08 16:37:00 +02:00
Simon Ser f03d50f54b Add test-only support to wlr-output-management-unstable-v1
Use the new test_output_config function to implement
wlr-output-management-unstable-v1's test request.
2020-04-08 16:36:40 +02:00
Simon Ser 0cdcf66bbc Introduce test_output_config
This function checks whether the backend would accept an output
configuration, without applying the changes.
2020-04-08 16:36:40 +02:00
Simon Ser 40e87fa98a Stop checking wlr_output_attach_buffer return value
Update for [1]. Everything is now checked at commit-time.

[1]: https://github.com/swaywm/wlroots/pull/2097
2020-04-08 16:36:40 +02:00
Thomas Hebb 3078f23258 config: fix unfocused text color
This color, both in i3 and as described in sway(5), defaults to #888888.
However, the actual default also has an alpha of 88 instead of FF,
meaning it ends up significantly darker than intended.
2020-04-04 23:25:04 +02:00
Dominique Martinet 4e82d0fb15 build: make completions respect install prefixes
Tell pkgconfig about prefix and datadir as required in the .pc files, so
if the prefix isn't standard nothing is installed outside of it.

For fish, this requires https://github.com/fish-shell/fish-shell/pull/6778

Fixes swaywm/swaybg#13
2020-04-04 17:55:09 +02:00
Leo 3c96a1d374 im: Fix crash when im destorying and no focused surface exists 2020-04-04 11:42:04 +02:00
xdavidwu e6805ce6e9 im: remove listener on pending surface destoryed 2020-04-04 11:42:04 +02:00
xdavidwu 4e1e5e4e33 im: make text-input listeners per text-input 2020-04-04 11:42:04 +02:00
xdavidwu 9d455b48e4 input-method: avoid and log unneeded set_focus 2020-04-04 11:42:04 +02:00
xdavidwu 1241b42c88 input-method: remove surface listener before set
This make sure pending focused surface listener is not reachable from
old surface.
2020-04-04 11:42:04 +02:00
xdavidwu 5886187c6e Port input method and text input from rootston
This ports swaywm/wlroots#1203, swaywm/wlroots#1303,
swaywm/wlroots#1308, swaywm/wlroots#1759 rootston part to sway.

Co-Authored-By: Leo Chen <leo881003@gmail.com>
2020-04-04 11:42:04 +02:00
Some Chinese Guy 7c44c76989 swapped hiding the cursor and sending a touch event as a more logical sequence 2020-04-03 16:47:11 +02:00
Dominique Martinet 284dcb2dc7 swaynag: exit on wl_display_roundtrip error
fixes loop when sway closes the socket in the middle of querying outputs,
see #5138.
2020-04-02 23:27:57 +02:00
Tobi Fuhrimann ac3444295d Reference wev instead of xev 2020-04-02 23:25:34 +02:00
Simon Ser 3a5d9b3b32 Update for new wlr_buffer API
Update for [1].

[1]: https://github.com/swaywm/wlroots/pull/2044
2020-04-02 23:23:56 +02:00
Leon Plickat dffc184a68 change apply_exclusive() to closer match layer shell protocol
With these changes, sway will respect positive exclusive zones of layer
surfaces anchored to one or three sides.

This matches the protocol, which states that a positive exclusive zone
should be respected, "if the surface is anchored to one edge or an
edge and both perpendicular edges". If the surfaces is "anchored to
only two perpendicular edges (a corner), anchored to only two
parallel edges or anchored to all edges a positive value will be
treated the same as zero".
2020-03-30 17:45:05 +02:00
Ian Fan 65501f0e46 tray: track SNI callbacks
This removes any pending messages once the item is destroyed.
Furthermore, this installs SNI event calbacks asynchronously
in order to prevent sd-bus from bypassing pending messages.
2020-03-30 17:31:00 +02:00
Ian Fan 68f53cd509 tray: tidy code
This includes some refactoring and fixing a small memory leak.
2020-03-30 17:31:00 +02:00
Ian Fan 3b894c387d tray: allow themes to inherit from multiple themes 2020-03-30 17:31:00 +02:00
Ian Fan 66f0c91bb8 tray: better errors when parsing index.theme 2020-03-30 17:31:00 +02:00
Ian Fan b54f5e170a swaybar: fix memory leaks 2020-03-30 17:31:00 +02:00
Linus Heckemann df48c48123 add --no-repeat option for bindings
This allows e.g. triggering one command while a key is held, then
triggering another to undo the change performed by it afterwards. One
use case for this is triggering push-to-talk functionality for VoIP
tools without granting them full access to all input events.

Fixes #3151
2020-03-30 14:18:27 +02:00
Simon Ser 5e41e6600b Change focus_on_window_activation default to urgent
Before the default was "smart". This means a visible app could steal focus
whenever it wanted to. This can be an issue since having focus allows for
e.g. clipboard access.

This commit changes the default to "urgent" instead.

Closes: https://github.com/swaywm/sway/issues/5139
2020-03-29 20:58:15 +02:00
Some Chinese Guy 63e45bf321 switched to setting focus with seat_set_focus 2020-03-29 20:50:36 +02:00
Some Chinese Guy 798fc24081 Added focus following for touch_down 2020-03-29 20:50:36 +02:00
Dominique Martinet 484f7677b0 swaynag: fix segfault on exit when arguments are not correct
swaynag_destroy is called on all cleanup cases and needs the lists to be valid,
just init them early
2020-03-29 11:17:32 +02:00
rinpatch 214e3030e1 sway.5: fix missing background scaling mode in a block example 2020-03-28 20:33:07 +01:00
Josh Shone 82d02ce782 Fix hit test for floaters that cross outputs
In the case of multiple overlapping floating windows, this commit fixes an issue where the wrong window would be focused in response to a cursor if one of the windows came from a different output (overhanging).
2020-03-27 21:32:26 +01:00
r-c-f 854497b242
check for workspace command name arg
* check for workspace command name arg (fix #5131)

For the 'workspace <name> output <output>' command, output_location must
be greater than zero or the attempt to get the workspace name with
join_args will segfault or abort() (depending on the flavor of
sway_assert() in use). This checks and returns an error instead.

* put workspace output error string on one line

To ease grepping as requested

* check for name in workspace gaps command as well

A malformed command here will lead to the same result seen in #5131, so
add a check. Done inside the cmd_workspace_gaps() function itself, to
take advantage of the existing 'Expected...' string.
2020-03-24 16:07:12 +01:00
Leo 0b9feb6f39 Fix redundant call to seat_send_focus()
This commit fix calling to seat_send_focus() twice when a view is
closed. This codes revert #2580, but the original issue nolonger
exists.
2020-03-23 17:30:02 +01:00
Simon Ser b34c198f0b Fix output mode usage
The "Hz" part is required.
2020-03-21 17:46:06 +01:00
Jason Nader fcd524bb0d sway/input/cursor.c: fix undefined behaviour when event is NULL 2020-03-16 14:27:36 +01:00
Dennis Schridde 6498542b24 Document input selector precedence
Signed-off-by: Dennis Schridde <devurandom@gmx.net>
2020-03-15 18:05:14 -04:00