Commit graph

6133 commits

Author SHA1 Message Date
Thorben Günther 1cad862458 A Script to change sway workspace name.
This script automatically changes the workspace name when an application
gets closed, moved or openend.
2019-12-06 15:52:33 -05:00
Thorben Günther 6235423544 Improve transparency script
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-06 15:52:33 -05:00
Brian Ashworth fe7ec8024c config: apply input type configs on reload
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-04 02:11:22 +01:00
Jayce Fayne ad189d27f9 Revert "fix bar_state_update/input event"
This reverts commit a3da7fec32.
2019-12-02 19:57:06 +01:00
Rex Hackbro a3da7fec32 fix bar_state_update/input event 2019-12-01 16:40:26 -05:00
Kenny Levinsen 275af2ad62 output: Restore previous max_render_time behavior 2019-12-01 12:44:07 +01:00
Kenny Levinsen d1eab10266 output: Schedule idle frames if we do not render
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-12-01 12:44:07 +01:00
Kenny Levinsen 57f615e122 output: Replace block_idle_frame with frame_pending 2019-12-01 12:44:07 +01:00
Ronan Pigott 6968fb3123 add scale_filter output config option 2019-11-29 18:13:37 +01:00
Kenny Levinsen 4b57953628 output: Ensure that frame_done is delayed on max_render_time
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-28 23:40:36 +01:00
Rex Hackbro 9979382d56 Rename 'node' to 'nodes' in swayipc doc 2019-11-28 23:29:17 +01:00
Brian Ashworth 0cdad33f1a input/keyboard: reset seat keyboard on destroy
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.
2019-11-28 10:34:49 +01:00
Brian Ashworth 1a5797803a config: improvements to the reload validation
For the validation pass of reloading, there is no need to touch swaybg,
swaynag, inputs, outputs, or seats. This drastically improves the speed
of a reload by skipping over the expensive I/O configuration and
handling of wayland clients. As long as the syntax is valid, the
CMD_FAILURE's can be relayed during the actual reload.
2019-11-27 02:04:13 +01:00
Brian Ashworth 90e3d25009 input/keyboard: check keyboard group before remove
In sway_keyboard_destroy, only remove the keyboard from a keyboard
group, if it is part of a keyboard group. If the keyboard is not part of
a keyboard group, then there is nothing to remove it from
2019-11-26 11:31:55 +01:00
Paul Riou 3334d11adc input: seat: Fix seat device list not initialised before use
When being created, non first seats would get through the list of devices
without the list being first initialised -> segfault.
Issue introduced with ab0248a545

Fixes #4750: Crash when reloading Sway with multiple seats configured
2019-11-24 21:51:06 +01:00
Jason 939c7b2d52 Amend typos 2019-11-23 11:48:31 +01:00
Simon Ser 1d3cbe9f27 Use new presentation-time helper
This has the advantage to (1) reduce boilerplate and (2) make us
correctly handle wlr_output_event_present.commit_seq.
2019-11-21 11:19:00 -05:00
Brian Ashworth 5d882cb5fc Add support for wlr_keyboard_group
A wlr_keyboard_group allows for multiple keyboard devices to be
combined into one logical keyboard. This is useful for keyboards that
are split into multiple input devices despite appearing as one physical
keyboard in the user's mind.

This adds support for wlr_keyboard_groups to sway. There are two
keyboard groupings currently supported, which can be set on a per-seat
basis. The first keyboard grouping is none, which disables all grouping
and provides no functional change. The second is keymap, which groups
the keyboard devices in the seat by their keymap. With this grouping,
the effective layout and repeat info is also synced across keyboard
devices in the seat. Device specific bindings will still be executed as
normal, but everything else related to key and modifier events will be
handled by the keyboard group's keyboard.
2019-11-21 10:42:10 -05:00
Brian Ashworth 2f858a1ada input_cmd_xkb_file: allow shell path expansion
This allows for shell path expansion for input_cmd_xkb_file. The logic
has been extracted from output_cmd_background
2019-11-21 10:36:15 -05:00
Brian Ashworth 66725f2e27 input/keyboard: cleanup xkb_file error handing
This fixes an inverted fclose return value check and simplifies the
error handling and logging for xkb_file in sway_keyboard_compile_keymap
2019-11-21 09:49:25 -05:00
Ivan Molodetskikh ba8586e282 Add note about backends to output max_render_time 2019-11-17 20:18:42 +01:00
Ivan Molodetskikh 76210c141d output: check wlr_output in repaint handler
It's possible for the output to be disconnected in just the right moment
for wlr_output to be NULL in the repaint handler, causing a crash. This
check fixes that crash.
2019-11-17 20:18:42 +01:00
Ivan Molodetskikh 7f8a47855c Add max_render_time to view JSON 2019-11-17 20:18:42 +01:00
Ivan Molodetskikh fe84ec2f24 Add max_render_time to output JSON 2019-11-17 20:18:42 +01:00
Ivan Molodetskikh bd9a53f1a3 view: add max_render_time 2019-11-17 20:18:42 +01:00
Ivan Molodetskikh 5421198489 Add sway_surface
For extending wlr_surface with additional things.
2019-11-17 20:18:42 +01:00
Ivan Molodetskikh 022df2542b output: add max_render_time 2019-11-17 20:18:42 +01:00
Simon Ser cb905effde Add -Wno-missing-braces
-Wmissing-braces makes it annoying to zero-initialize structs with = {0}
when the first field is a struct. See for instance [1].

[1]: https://builds.sr.ht/~sircmpwn/job/110425
2019-11-17 17:21:13 +01:00
Manuel Mendez 8ffa3cf439 grimshot: fix branching on command exit status
The previous behavior was incorrect because `if` was checking the return
status of the `[` command which was never going to be an error. `[`
seems to only return an error if no args are provided. This was
basically a useless use of `[` anyway since it was just meant as a
straight interpretation of command exit, something that `if` can do
itself.

Compare:

```sh
[ ]; echo ?=$?
[ /bin/false ]; echo ?=$?
if [ /bin/false ]; then echo this is the unintended bug; fi
if /bin/false; then echo this will not be printed; fi
```
2019-11-17 17:18:54 +01:00
Tadeo Kondrak 7f54495b5e Use an enum instead of a marker string for map_to_ 2019-11-17 13:34:24 +01:00
Tadeo Kondrak 4829f1c26a Implement input map_to_region command 2019-11-17 13:34:24 +01:00
Rouven Czerwinski df1a046875 xwayland: get_constraints using size hints
Previously, Xwayland windows did not have size_constraints implemented,
resulting in the window being resizable. This implements the constraints
through the X11 size hints supplied by the window itself.
2019-11-16 10:18:26 +01:00
Ronan Pigott 37afbc4dbc seatop_default: handle focus for unmanaged xwayland windows last
Fixes #4707
2019-11-08 19:06:00 -05:00
Simon Ser f576bcdb8c Use wlr_output_preferred_mode instead of the last mode
Instead of relying on the order of modes, use wlr_output_preferred_mode
to get the preferred mode.
2019-11-05 14:00:23 -05:00
Simon Ser 01b5350bdc Fix segfault in set_mode
best is NULL prior to being assigned to a mode.

Closes: https://github.com/swaywm/sway/issues/4705
Fixes: f33dcd4c60 ("Prefer higher refresh rate default modes")
2019-11-05 13:35:56 -05:00
Ronan Pigott f33dcd4c60 Prefer higher refresh rate default modes 2019-11-05 10:34:44 +01:00
Ronan Pigott 3975ca28c2 smart_borders: separate smartness from edge types 2019-11-04 21:16:27 -05:00
Simon Ser 38b37247ff Add --custom to output mode command
This forces to set the mode as a custom mode.
2019-11-04 19:40:47 -05:00
Ronan Pigott eaee087c17 seatop_default: handle focus for xwayland_unmanaged views 2019-11-04 23:56:27 +01:00
Ronan Pigott d159b98744 seatop_move_floating: make container respect pointer constraint 2019-11-04 23:53:30 +01:00
Ronan Pigott 1f469e1692 focus: do nothing on focus prev|next for workspaces 2019-11-04 23:48:39 +01:00
Sheena Artrip 7efb5d4673 Rename symbol set_cloexec to sway_set_cloexec, remove duplicates.
set_cloexec is defined by both sway and wlroots (and who-knows-else),
so rename the sway one for supporting static linkage. We also remove
the duplicate version of this in client/.

Fixes: https://github.com/swaywm/sway/issues/4677
2019-11-01 12:41:08 -04:00
lbonn cf95de9cae focus: add a NULL check in focus <direction>
container is checked for NULL in other conditions earlier, it's not
obvious that it can't be undefined here.
2019-11-01 12:18:09 -04:00
lbonn 30fa7d191e Fix potential NULL reference on cleanup
If allocation of bindings failed.

Found with clang-tidy
2019-11-01 12:18:09 -04:00
lbonn a6307aed00 Fix various memory leaks
Found with clang-tidy
2019-11-01 12:18:09 -04:00
lbonn 32caabc7a1 seat: simplify a strdup 2019-11-01 12:18:09 -04:00
Robert Günzler 354e705a7b Skip line continuation when it is a comment
Currently commented lines ending in the backslash character will be
concatenated with the following line.

```
 # with this comment \
exec swaynag -m 'will not run'
```

This change modifies `getline_with_cont` to stop reading when the
initial character is a '#'.
2019-10-31 23:05:06 +01:00
Simon Ser 1a253ca7ab Fix presentation feedback when scanning out fullscreen view
Closes: https://github.com/swaywm/sway/issues/4663
2019-10-27 11:07:48 -04:00
Simon Ser ad07886543 Handle layer changes for layer shell surfaces
Closes: https://github.com/swaywm/sway/issues/4644
References: 1982106c9b
2019-10-27 11:07:18 -04:00
Ronan Pigott 7c9b71f5c6 criteria: make literal comparison for __focused__ values 2019-10-27 11:06:05 -04:00