Commit Graph

6359 Commits

Author SHA1 Message Date
Jason Nader
8b21bc6a79 commands/bind.c: remove unnecessary check 2020-03-15 14:30:05 +01:00
Jason
55016729a5 Update fish completions
`--config` should autocomplete filepaths
2020-03-13 10:11:25 +01:00
Jason Nader
50dc49f35a Limit workspace numbers within 0..INT32_MAX
See 83c7aff089
2020-03-12 19:43:45 -04:00
Olivier Fourdan
7dd9cd29a6 input: Avoid creating the PAD device multiple times
If a pad device for a tablet exists, reloading the configuration,
removing/reading the device or even suspending the system will recreate
the same Wayland input device multiple times.

Make sure we don't re-create the same Wayland device more than
necessary.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2020-03-12 18:02:09 +01:00
Simon Ser
5efdde8868 readme: git is an optional dependency 2020-03-12 14:51:42 +01:00
Michael Weiser
30e666f171 commands: Adjust style in cursors command
Remove some unnecessary brackets in an error condition check identified
during review of the shortcuts inhibitor command code (#5021).

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
2020-03-11 23:51:37 -04:00
Michael Weiser
3ee5aace33 commands: Add shortcuts_inhibitor command
Add a command to influence keyboard shortcuts inhibitors. In its current
form it can be used to activate, deactivate or toggle an existing
inhibitor on the surface currently receiving input. This can be used to
define an escape shortcut such as:

bindsym --inhibited $mod+Escape seat - shortcuts_inhibitor deactivate

It also allows the user to configure a per-seat default of whether
keyboard inhibitors are honoured by default (the default) or not. Using
the activate/toggle command they can then enable the lingering inhibitor
at a later time of their choosing.

As a side effect this allows to specifically address a named seat for
actions as well, whatever use-case that might serve.

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
2020-03-11 23:51:37 -04:00
Michael Weiser
eeac0aa170 input: Add support for keyboard shortcuts inhibit
Adding support for the keyboard shortcuts inhibit protocol allows remote
desktop and virtualisation software to receive all keyboard input in
order to pass it through to their clients so users can fully interact
the their remote/virtual session. The software usually provides its own
key combination to release its "grab" to all keyboard input. The
inhibitor can be deactivated by the user by removing focus from the
surface using another input device such as the pointer.

Use support for the procotol in wlroots to add support to sway. Extend
the input manager with handlers for inhibitor creation and destruction
and appropriate bookkeeping. Attach the inhibitors to the seats they
apply to to avoid having to search the list of all currently existing
inhibitors on every keystroke and passing the inhibitor manager around.
Add a helper function to retrieve the inhibitor applying to the
currently focused surface of a seat, if one exists.

Extend bindsym with a flag for bindings that should be processed even if
an inhibitor is active. Conversely this disables all normal shortcuts if
an inhibitor is found for the currently focused surface in
keyboard::handle_key_event() since they don't have that flag set. Use
above helper function to determine if an inhibitor exists for the
surface that would eventually receive input.

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
2020-03-11 23:51:37 -04:00
Michael Weiser
ef9c597fcb config: Fix typo in reload bindsym flag bitmask
Fix a typo in the bit mask value of the BINDING_RELOAD flag introduced
in commit 152e30c37 so it can work as intended.

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
2020-03-11 23:51:37 -04:00
Bor Grošelj Simić
27d5cf1316 input: implement cycling through keyboard layout list 2020-03-11 12:12:23 +01:00
Ian Fan
28e3187df1 ipc: add missing required properties 2020-03-10 15:55:54 +01:00
Tadeo Kondrak
91c0ffd6cf Null check sway_layer_surface when checking damage
Before this change, an overlay layer-shell surface without a buffer
attached would segfault the compositor on screen damage.
2020-03-10 10:59:05 +01:00
Jan Beich
fafc060909 common/log: bump POSIX version used after e81d9fde66
../common/log.c:63:16: error: use of undeclared identifier 'CLOCK_MONOTONIC'
        clock_gettime(CLOCK_MONOTONIC, &start_time);
                      ^
../common/log.c:75:16: error: use of undeclared identifier 'CLOCK_MONOTONIC'
        clock_gettime(CLOCK_MONOTONIC, &ts);
                      ^
2020-03-07 12:05:51 +01:00
Simon Ser
e81d9fde66 common/log: improve time prefix
Same as [1].

[1]: https://github.com/swaywm/wlroots/pull/2052
2020-03-07 00:35:35 +01:00
Simon Ser
a2d49099e1 Add adaptive_sync_status to output IPC reply 2020-03-07 00:32:04 +01:00
Simon Ser
5d692b0581 Add an adaptive_sync output command
This enables/disables adaptive synchronization on the output.

For now, the default is disabled because it might cause flickering on
some hardware if clients don't submit frames at regular enough
intervals. In the future an "auto" option will only enable adaptive sync
if a fullscreen client opts-in via a Wayland protocol.
2020-03-07 00:32:04 +01:00
Simon Ser
9d0aa0cb83 Use wlr_client_buffer
Update for breaking changes in [1].

[1]: https://github.com/swaywm/wlroots/pull/2043
2020-03-06 23:57:43 +01:00
Simon Ser
241684eb1d Drop sway_output.surface_needs_frame
wlr_output_schedule_frame now sets output->needs_frame [1], so this
isn't needed anymore.

[1]: https://github.com/swaywm/wlroots/pull/2053
2020-03-06 21:37:53 +01:00
Simon Ser
f5ba8006c9 Only schedule a frame if client has requested a frame callback
When a client hasn't damaged its surface, we only need to schedule an
output frame if the client has requested a frame callback.
2020-03-06 21:37:53 +01:00
Simon Ser
c0811fcf87 Make handle_destroy and output_repaint_timer_handler static 2020-03-04 03:09:43 +01:00
Jason Nader
476773dd32 ipc-server: improve error message 2020-02-29 19:59:42 +01:00
Brian Ashworth
7fea36750e sway.5: correct description of workspace [number]
This correct the description of the commmand:
workspace [--no-auto-back-and-forth] [number] <[num:]name>

Previously, the number and num pieces were being confused. This also
documents the behavior of the --no-auto-back-and-forth flag.
2020-02-29 02:03:03 +01:00
Bill Doyle
920d85d35f Only destroy swaybar surface via ipc when needed 2020-02-27 15:34:49 +01:00
Ryan Dwyer
2045ac3472 Introduce pid criteria token
This can be used as a workaround to flag terminal windows as urgent when
commands are completed, until urgency is introduced in the Wayland
protocol.

Configure your shell to run `swaymsg "[pid=$PPID] urgent enable"` when
commands are completed, and use a terminal which uses one process per
window.
2020-02-27 14:03:22 +01:00
Simon Ser
5ed01c861a Add support for wlr-output-power-management-unstable-v1 2020-02-26 16:26:13 +01:00
Brian Ashworth
e0f8235fbf Revert "Don't apply exclusive zones of unmapped layer-shell surfaces"
This reverts commit e1eda8a09c.
2020-02-25 08:35:43 +01:00
Simon Ser
e1eda8a09c Don't apply exclusive zones of unmapped layer-shell surfaces
Backport of [1].

[1]: https://github.com/emersion/rootston/pull/15/files
2020-02-24 19:38:36 -05:00
Simon Ser
f2a60d2d05 Fix get_int_prop(WINDOW_TYPE) crash 2020-02-19 12:07:15 -05:00
Torstein Husebø
af294289b1 treewide: fix typos 2020-02-18 21:53:57 +01:00
Brian Ashworth
ec7d3f181d input_cmd_events: add support for input types
This adds support for input type configs to input_cmd_events. This works
similar to the wildcard handling that existed where configs for the
devices are stored and the type config is reset to INT_MIN so that it
does not override.

This also condenses the toggle_send_events and
toggle_wildcard_send_events functions into a single function to reduce
code duplication.
2020-02-18 18:08:45 +01:00
Brian Ashworth
0c23525d47 tree/view: do not attempt enter on hidden child
If a subsurface is created for a surface that is associated with a
scratchpad hidden view, do not attempt to send an enter to it. The
subsurface is not on any output and since there is no workspace
associated with the view, attempting to get the output for the NULL
workspace will result in a SIGSEGV.
2020-02-18 10:27:37 +01:00
Jason Nader
d2cab83833 i3compat: add window_type to IPC response
i3 added these in i3/i3#3797
2020-02-17 21:58:05 +01:00
Jason Nader
8608a1c38b i3compat: add window_type to IPC response
i3 added these in i3/i3#3797
2020-02-17 21:58:05 +01:00
Simon Ser
f96dbf748a Specify that output transform applies clockwise rotations 2020-02-17 21:47:36 +01:00
Simon Ser
ab00f7f319 Fix output transform rotation direction
This patch makes it so users that have configured their screen with a
transform don't have to update their config after the wlroots breaking
change.

References: https://github.com/swaywm/wlroots/pull/2023
2020-02-17 21:47:36 +01:00
Simon Ser
a5a4d32816 Fix output transform anticlockwise
This wouldn't have any effect if the transform was flipped.
2020-02-17 21:47:36 +01:00
Brian Ashworth
8b593677d2 output: fix updating output manager config
The output manager config is created when the output is created. It is
updated when the mode, transform, scale, or layout for the output
changes, as well as, when the output is destroyed.

Since the output->enabled property was not being set before calling
apply_output_config, the output event handlers were early returning and
never updating the output manager config when the output state was
committed.

This fixes the issue by setting output->enabled in apply_output_config
below the output disabling section. There are also a few other minor
changes that are required to function.

Additionally, this renames output_enable to output_configure to better
describe the recent changes.
2020-02-16 09:42:22 +01:00
Yorick van Pelt
447967ad3a Fix crash: use wlr_output->name instead of possibly missing oc->name
Fixes segfault on start:
https://gist.github.com/yorickvP/89eccb3782c6edb22aeda6ce9c6d4fcb
2020-02-13 13:05:17 +01:00
Brian Ashworth
7999845357 cmd_swap: fix test_mark condition
The condition in test_mark was checking the negation of list_seq_find.
This works fine for the first mark, but fails for every other mark. This
fixes the condition to check for anything other than -1, which is the
value returned from list_seq_find for index not found.
2020-02-13 10:26:14 +01:00
Simon Ser
47763c99f9 Apply the output scale filter after the output commit
The smart output filter uses the current output scale.
2020-02-11 20:52:02 -05:00
Simon Ser
f5fa0c7124 Stop calling apply_output_config from output_enable
The only output_enable caller is now apply_output_config. Stop calling
apply_output_config from output_enable to simplify the code and avoid
the back-and-forth between these two functions.

output_enable is now the symmetric of output_disable: it just marks the
output as enabled and performs bookkeeping (e.g. creating teh default
workspace). It is called from apply_output_config after the output
commit, so that it can read the current output state and act
accordingly.

This change also allows us to avoid an extraneous wlr_output_commit.

References: https://github.com/swaywm/sway/issues/4921
2020-02-11 20:52:02 -05:00
Simon Ser
5e90080468 Call apply_output_config instead of output_enable
apply_output_config will call output_enable if necessary.

This fixes a lone wlr_output_enable call (without a matching
wlr_output_commit call) which was a no-op.
2020-02-11 20:52:02 -05:00
Simon Ser
555b0d4087 Fix output scale auto-detection
Closes: https://github.com/swaywm/sway/issues/4960
2020-02-11 20:52:02 -05:00
Brian Ashworth
33a984bbc5 config: fix validation exit code and log level
This makes it so invalid configs will return the exit code 1 when the
validation flag is given. This also reduces the log level to SWAY_ERROR,
which makes it so only the errors are shown. If someone wants more
verbose output, the can use the -V/--verbose or -d/--debug flags.
Additionally, this also makes it so swaybg will not be spawned when
validating the config.
2020-02-11 16:02:11 +01:00
Teddy Reed
31a83bd48d Fix ordering of setgid and setuid
It looks like the code to drop privileges may have been broken via
commit 37f0e1f. That commit reverted the correct order from #911, which
first drops the gid then the uid. If setuid is called first then the
target user may not have the ability to setgid.
2020-02-11 10:17:45 +01:00
Brian Ashworth
0b709702c1 container_at_{tabbed,stacked}: check x-axis bounds
The container_at_tabbed and container_at_stacked container were checking
the bounds along the y-axis, but not the x-axis. This made it possible
to cause a segfault for specific resolution, horizontal gap, and
workspace children lengths. The issue is that child_index was -1 and was
resulting in a buffer underflow. Adding the x-axis bound checks for
early returns should prevent this from happening.
2020-02-11 10:09:37 +01:00
Andri Yngvason
803e89018a input: Map virtual-pointer to the requested output 2020-02-10 21:54:00 +01:00
Hristo Venev
7affe5c1bd swaybar: fix i3bar relative coordinates when scaling is used
24e8ba048a did not take scaling into account.
The hotspot size used pixel coordinates, the absolute coordinates were logical,
and the relative coordinates were completely wrong.

This commit makes all coordinates use logical values. If
`"float_event_coords":true` is sent in the handshake message, coordinates are
sent as floating-point values.

The "scale" field is an integer containing the scale value.
2020-02-10 18:58:09 +01:00
Hristo Venev
fca32b6334 Do not truncate pointer coordinates to int.
This increases the precision of the clicks when using i3bar.
2020-02-10 18:58:09 +01:00
Till Hofmann
0f5157668d Avoid calling strcmp on nullptr
The function group_handler may get a nullptr as `new_group`. If that's
the case, return true, as if `new_group` was the empty string.

Also make the conversion to bool explicit when calling `strcmp`.
2020-02-10 13:29:07 +01:00