Commit Graph

5928 Commits

Author SHA1 Message Date
Drew DeVault 6b6eb147ec Bump meson version to 1.1 2019-06-03 08:50:12 -04:00
Rouven Czerwinski 5ff330e6bc desktop: output: fix use-after-free in destroy
handle_destroy would mark the output es being destroyed and commit the
transaction. Committing the transaction results in the output being
freed, the output manager can not retrieve the server reference
afterwards, resulting in the following use-after-free:

==22746==ERROR: AddressSanitizer: heap-use-after-free on address 0x614000017088 at pc 0x560c1ac17136 bp 0x7ffeab146f20 sp 0x7ffeab146f10
READ of size 8 at 0x614000017088 thread T0
    #0 0x560c1ac17135 in handle_destroy ../sway/desktop/output.c:566
    #1 0x7f38af69330e in wlr_signal_emit_safe ../subprojects/wlroots/util/signal.c:29
    #2 0x7f38af5d3dfc in drm_connector_cleanup ../subprojects/wlroots/backend/drm/drm.c:1448
    #3 0x7f38af5d2058 in scan_drm_connectors ../subprojects/wlroots/backend/drm/drm.c:1240
    #4 0x7f38af5c6a59 in drm_invalidated ../subprojects/wlroots/backend/drm/backend.c:135
    #5 0x7f38af69330e in wlr_signal_emit_safe ../subprojects/wlroots/util/signal.c:29
    #6 0x7f38af5e827a in udev_event ../subprojects/wlroots/backend/session/session.c:52
    #7 0x7f38aef5d7f1 in wl_event_loop_dispatch (/usr/lib/libwayland-server.so.0+0xa7f1)
    #8 0x7f38aef5c39b in wl_display_run (/usr/lib/libwayland-server.so.0+0x939b)
    #9 0x560c1ac0afbe in server_run ../sway/server.c:225
    #10 0x560c1ac09382 in main ../sway/main.c:397
    #11 0x7f38aed35ce2 in __libc_start_main (/usr/lib/libc.so.6+0x23ce2)
    #12 0x560c1abea10d in _start (/usr/local/bin/sway+0x3910d)

0x614000017088 is located 72 bytes inside of 432-byte region [0x614000017040,0x6140000171f0)
freed by thread T0 here:
    #0 0x7f38af82df89 in __interceptor_free /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:66
    #1 0x560c1acbd1ed in output_destroy ../sway/tree/output.c:243
    #2 0x560c1ac23ce5 in transaction_destroy ../sway/desktop/transaction.c:66
    #3 0x560c1ac26b71 in transaction_progress_queue ../sway/desktop/transaction.c:348
    #4 0x560c1ac284ca in transaction_commit_dirty ../sway/desktop/transaction.c:539
    #5 0x560c1ac17110 in handle_destroy ../sway/desktop/output.c:564
    #6 0x7f38af69330e in wlr_signal_emit_safe ../subprojects/wlroots/util/signal.c:29
    #7 0x7f38af5d3dfc in drm_connector_cleanup ../subprojects/wlroots/backend/drm/drm.c:1448
    #8 0x7f38af5d2058 in scan_drm_connectors ../subprojects/wlroots/backend/drm/drm.c:1240
    #9 0x7f38af5c6a59 in drm_invalidated ../subprojects/wlroots/backend/drm/backend.c:135
    #10 0x7f38af69330e in wlr_signal_emit_safe ../subprojects/wlroots/util/signal.c:29
    #11 0x7f38af5e827a in udev_event ../subprojects/wlroots/backend/session/session.c:52
    #12 0x7f38aef5d7f1 in wl_event_loop_dispatch (/usr/lib/libwayland-server.so.0+0xa7f1)

previously allocated by thread T0 here:
    #0 0x7f38af82e5a1 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:95
    #1 0x560c1acbc228 in output_create ../sway/tree/output.c:91
    #2 0x560c1ac17ba2 in handle_new_output ../sway/desktop/output.c:656
    #3 0x7f38af69330e in wlr_signal_emit_safe ../subprojects/wlroots/util/signal.c:29
    #4 0x7f38af5e4ce8 in new_output_reemit ../subprojects/wlroots/backend/multi/backend.c:143
    #5 0x7f38af69330e in wlr_signal_emit_safe ../subprojects/wlroots/util/signal.c:29
    #6 0x7f38af5d26d4 in scan_drm_connectors ../subprojects/wlroots/backend/drm/drm.c:1294
    #7 0x7f38af5c6a59 in drm_invalidated ../subprojects/wlroots/backend/drm/backend.c:135
    #8 0x7f38af69330e in wlr_signal_emit_safe ../subprojects/wlroots/util/signal.c:29
    #9 0x7f38af5e827a in udev_event ../subprojects/wlroots/backend/session/session.c:52
    #10 0x7f38aef5d7f1 in wl_event_loop_dispatch (/usr/lib/libwayland-server.so.0+0xa7f1)

SUMMARY: AddressSanitizer: heap-use-after-free ../sway/desktop/output.c:566 in handle_destroy
Shadow bytes around the buggy address:
  0x0c287fffadc0: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x0c287fffadd0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c287fffade0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c287fffadf0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c287fffae00: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
=>0x0c287fffae10: fd[fd]fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c287fffae20: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c287fffae30: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fa fa
  0x0c287fffae40: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x0c287fffae50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c287fffae60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Retrieve the reference before the output is destroyed and update the
output_management state with the saved reference.
2019-06-02 19:36:16 +03:00
Simon Ser 4105982169 Remove orbital gamma-control protocol 2019-06-02 10:12:58 -04:00
Kenny Levinsen 4925882920 Use parent get_root_coords in subsurfaces
Subsurfaces need access to the parent get_root_coords impl for positioning in
popups. To do this, we store a reference to the parent view_child where
applicable.

Fixes #4191.
2019-05-30 14:25:07 -04:00
Brian Ashworth c3532bc8a1 Add swaybar protocol documentation
This adds swaybar-protocol.7.scd documenting the swaybar status line
protocol including some differences from the i3bar counterpart.
2019-05-30 10:54:23 -04:00
Brian Ashworth 6afb392823 bindings: allow unlocked and locked bindings
This changes the behavior of bindings to make the `BINDING_LOCKED` flag
conflicting, which will allow for both unlocked and locked bindings.

If there are two matching bindings and one has `--locked` and the other
does not, the one with `--locked` will be preferred when locked and
the one without will be preferred when unlocked.

If there are two matching bindings and one has both a matching
`--input-device=<input>` and `--locked` and the other has neither, the
former will be preferred for both unlocked and locked.

This also refactors `get_active_binding` in `sway/input/keyboard.c`
to make it easier to read.
2019-05-30 10:47:42 +03:00
Josef Gajdusek 2c6a10c4ba Provide current DPMS state in GET_OUTPUTS 2019-05-28 22:43:11 -04:00
Brian Ashworth 18476b0ec1 common/ipc-client: remove ipc recv timeout log
This just removes the ipc recv timeout log statement in
`ipc_recv_set_timeout`. The `tv_sec` field of `struct timeval` has
varying types and/or sizes depending on the platform and architecture.
On some of these, the current format string will cause compilation
errors. Additionally, the log statement is not extremely useful and the
function is currently only used by swaymsg, which has a hardcoded log
level that will prevent it from even being shown, so there is no point
in even keeping it.
2019-05-27 08:02:10 +03:00
Brian Ashworth de5cfa7232 input/switch: fix indentation of file
This just changes the indentation of `sway/input/switch.c` to use
tabs instead of spaces since I messed up and missed it when approving
the PR that added the file.
2019-05-27 07:55:24 +03:00
Drew DeVault e92ac7d552
Create FUNDING.yml 2019-05-25 12:35:43 -04:00
Josef Gajdusek 0e582f1a51 Update output manager config on all output events
The output manager config was not properly updated when output
configuration was changed through some other means (such as a command).
2019-05-24 22:52:07 +03:00
Josef Gajdusek b3a5effef2 Implement wlr-output-management-v1 2019-05-24 18:59:14 +03:00
Brian Ashworth 00cffb8e20 commands/bar: fix mode and hidden_state at runtime
For compatibility with i3, `bar mode` and `bar hidden_state` do not
require bar-ids (in the normal location) at runtime since they follow
the alternative syntax: `bar mode|hidden_state <option> [<bar-id>]`

This removes the incorrect error that the bar-id is missing for those
two bar subcommands
2019-05-22 22:33:10 +03:00
Nick Paladino 08ec88692a Make comment casing consistient
Makes the first letter of all the comments uppercase. THus making the config file more consistient
2019-05-21 08:12:49 -06:00
Alyssa Ross e4f1ffe601 commands/bar: improve error for invalid subcommand
Running a command like this produced a confusing error message:

    $ swaymsg bar bar-0 colors background #ff0000
    Error: Unknown/invalid command 'bar-0'

This patch makes the error message use argv[1] instead of argv[0] (from
config_subcommand's implementation), so it actually uses the name of the
command, rather than the id of the bar.
2019-05-19 11:47:16 -04:00
Alyssa Ross 5fb5984e94 bar: fix segfault with missing or invalid bar id
Prior to this patch, if I ran something like this, sway would crash:

    swaymsg bar height 50

or

    swaymsg bar not-a-bar-id color bg #ff0000

This was in contrast to other bar subcommands, like status_command,
which would exit with a "No bar defined" message.

The difference between the subcommands that crashed and the ones that
exited was that some subcommands had a check to see if a bar was
specified, while others just assumed that it had been and carried on
until they segfaulted.

Because this check was identical in every subcommand it was present in,
and I couldn't think of a case where it would be valid to run a bar
subcommand without specifying which bar to apply it to, I moved this
check from individual subcommands into the bar command, which is already
responsible for actually setting the specified bar. This reduced code
duplication, and fixed the crash for the subcommands that were missing
this check.
2019-05-17 15:33:57 -04:00
Nomeji 578c1956ac Add infos to help using for_window to man 5 2019-05-14 10:40:22 -06:00
Brian Ashworth 23c64ab22d input/keyboard: attempt default keymap on failure
This attempts to use the default keymap when the one defined in the
input config fails to compile. The goal is to make it so the keyboard
is always in a usable state, even if it is not the user's requested
settings as usability is more important.

This also removes the calls to `getenv` for the `XKB_DEFAULT_*` family
of environment variables. The reasoning is libxkbcommon will fallback
to using those (and then the system defaults) when any of the rule
names are `NULL` or an empty string anyway so there is no need for
sway to duplicate the efforts.
2019-05-14 08:23:26 -06:00
Moelf ed2e553b8d Implement output toggle
discussed in #4136, this can't handle wildcard but won't crash.
2019-05-14 00:11:04 -04:00
Brian Ashworth 18ce0eec60 Spawn swaybar as a wayland client
This just makes it so swaybar is handled as a wayland client
2019-05-12 11:02:42 +03:00
Brian Ashworth 8c8e6a6c90 config/output: fix typo in merge_id_on_name
This fixes a typo in `merge_id_on_name` for output configs that
resulted in incorrect id-on-name output configs being generated.
Instead of using the output that matched the name or identifier, the
first output in the list was being used instead. This could cause
merging across unrelated output configs and preventing output configs
from being applied correctly
2019-05-09 23:52:01 +03:00
Drew DeVault 9dca18b6f7 Add Firefox note to ISSUE_TEMPALTE.md 2019-05-06 15:32:37 -04:00
Brian Ashworth 51c077798c Destroy swaybg client on reload
When reloading, this destroys the old config's swaybg client before
spawning the new config's swaybg. This fixes a race condition where the
old config's swaybg client's destroy was being called after the new
config's swaybg client was being spawned. This was causing the
reference to the new swaybg client to be removed and never destroyed.

This also modifies handle_swaybg_client_destroy to grab the config
reference using wl_container_of on the listener since the swaybg client
may be the old config swaybg client and should be used instead of the
global config instance
2019-05-04 09:06:43 +03:00
Simon Ser 32087ad77d Fix xdg-decoration unconfigured if set before first commit
In case a set_mode/unset_mode request is sent before the first commit, we need
to handle the value and send our preference accordingly.

This fixes xdg-decoration support for Qt apps.
2019-05-03 15:37:32 -06:00
Drew DeVault 464a3b4fdd Bump required wlroots version 2019-05-03 13:10:53 -04:00
Brian Ashworth c8e4ca355d swaymsg: fix quiet error reporting
This makes it so swaymsg still returns the correct successful or failed
error code when in quiet mode
2019-05-03 11:09:49 -06:00
Brian Ashworth c118618278 sway.5.scd: clarify workspace config commands
This clarifies that `workspace <name> output <outputs...>` and
`workspace <name> gaps ...` do not operate on existing workspaces.
Additionally, alternate commands/solutions that operate on existing
workspaces are listed.
2019-04-30 21:38:00 -06:00
Brian Ashworth 13cbb3b7fc cmd_move: add support for output current
This adds support for the following commands for i3 compatibility:
- `move [window|container] [to] output current`
- `move workspace to [output] current`
- `move workspace [to] output current`

The above commands are only useful when used with criteria.
2019-04-30 15:22:02 -06:00
Alex Maese 3b3e0560be Fix a silly mistake 2019-04-28 21:07:47 +03:00
Alex Maese 5b454ac441 Don't send pointer motion when rebasing the cursor 2019-04-28 21:07:47 +03:00
Alex Maese 866a19b743 Clear pointer focus during move and resize seatops 2019-04-28 21:07:47 +03:00
Lane Surface 812651d53e Remove extra inclusion of stdio.h 2019-04-27 20:53:21 -06:00
Ilja Kocken e41e8d3330 Add link to i3 in first mention of README 2019-04-27 17:28:24 -06:00
jajo-11 957a704936 Add German translation of the README 2019-04-27 15:05:43 -06:00
Simon Ser 9aafef352b Don't submit too much damage 2019-04-27 09:50:49 -06:00
Konstantin Pospelov e6fbb3c6bb config: fix clang warning 2019-04-26 20:56:48 +03:00
Konstantin Pospelov c42497aca0 bindsym: change xkb_rule_names initialization 2019-04-26 20:56:48 +03:00
Konstantin Pospelov ddf63ffabe bindsym: consider xkb_rule_names for --to-code 2019-04-26 20:56:48 +03:00
Konstantin Pospelov d27a5e1cb0 bindsym: update the man page to include --to-code 2019-04-26 20:56:48 +03:00
Konstantin Pospelov 998de8fbc5 bindsym: change default keymap for --to-code
Replace XKB_DEFAULT_LAYOUT with NULL as the default layout.
2019-04-26 20:56:48 +03:00
Konstantin Pospelov f1609abe4c config: simplify keysym translation fields
Do not store `xkb_keymap` since it can be retrieved from `xkb_state`.
2019-04-26 20:56:48 +03:00
Konstantin Pospelov a09c144b8b Implement bindsym --to-code
* `bindsym --to-code` enables keysym to keycode translation.
* If there are no `xkb_layout` commands in the config file, the translation
uses the XKB_DEFAULT_LAYOUT value.
* It there is one or more `xkb_layout` command, the translation uses
the first one.
* If the translation is unsuccessful, a message is logged and the binding
is stored as BINDING_KEYSYM.
* The binding keysyms are stored and re-translated when a change in the input
configuration may affect the translated bindings.
2019-04-26 20:56:48 +03:00
Simon Ser bd32b300fb ci: enable all features
If unspecified, feature options are set to "auto", which means enabled only if
the required dependencies are found. In CI we don't want to miss compilation
errors because a dependency hasn't been found and code isn't built.

Leave FreeBSD out for now because it uses a subproject (haven't found a way to
make auto_features=enabled only apply to the toplevel project).
2019-04-25 10:00:55 -06:00
Drew DeVault 236ca63419 swaybg: split into standalone project
The new upstream is https://github.com/swaywm/swaybg

This commit also refactors our use of gdk-pixbuf a bit, since the only
remaining reverse dependency is swaybar tray support.
2019-04-25 18:44:28 +03:00
Drew DeVault f62c755a9f Remove obsolete README translations
Everything which still mentioned wlc has been removed.
2019-04-25 11:18:05 -04:00
bschacht 8adb70f9c5 Set the correct version for wlroots dependency 2019-04-25 09:31:38 +03:00
Brian Ashworth 462ad4ea83 cmd_move: respect workspace layout when inserting
When moving a container to become a direct child of the workspace and
the workspace's layout is tabbed or stacked, wrap it in a container
with the same layout. This allows for the following:
- Run `layout tabbed|stacked` on an empty workspace (or use
  `workspace_layout tabbed|stacked` in the config)
- Open some views
- Move one of the views in any direction
- Open another view
- The new container should also be `tabbed`/`stacked`
2019-04-24 19:12:24 -06:00
Brian Ashworth dc7a3930a7 swaybar: add multiseat support
This just adds multiseat support to swaybar
2019-04-24 07:16:37 -06:00
Brian Ashworth 583ceff6f6 swaybar: hide mode visibility improvements
This allows swaybar to become visible when the mode changes (to any
mode other than the default). swaybar will be hidden again when the
modifier is pressed and released or when switching back to the default
mode.

This also applies the same logic to visible by urgency to hide swaybar
when the modifier is pressed and released.

These changes are to match i3's behavior.
2019-04-24 07:14:48 -06:00
Simon Ser b6e55064fe Update for wlroots#1660 2019-04-23 14:37:44 -06:00