Commit graph

7020 commits

Author SHA1 Message Date
Kenny Levinsen 6b900bab60 seat: Set keyboard if seat keyboard is NULL
sway sends wl_keyboard.enter on seat focus change and when a keyboard
active on a seat is configured. If all keyboards are removed and a
keyboard is added back without changing the focused client, no new
notify event would be sent despite having keyboard focus. This could
lead to key events without notify, which is a protocol violation.

As a quick fix, when configuring a keyboard on a seat where no keyboard
is currently active, activate the keyboard so that a focused surface
will receive a notify event.

Regressed by: e1b268af98
Closes: https://github.com/swaywm/sway/issues/7330

(cherry picked from commit 1ade0ce753)
2022-12-19 10:39:53 +01:00
Ankit Pandey 51663bb120 commands/move: Warp cursor after moving workspace to another output
This makes sway's behavior consistent with i3 when `mouse_warping` is
set to any value besides `none`.

Fixes #7027.

(cherry picked from commit e3c63bf58d)
2022-12-19 10:39:53 +01:00
Simon Ser 54d1e0d568 build: bump version to 1.8-rc3 2022-12-12 11:26:40 +01:00
Ronan Pigott 8d78ab6a45 criteria: be lenient on window_role and instance too 2022-12-12 11:26:11 +01:00
Kenny Levinsen 817f1bbec3 seat: Avoid sending redundant keymaps on reload
When we reload the config, we reset every input device and re-apply
configuration from the config file. This means that the keyboard keymap
is updated at least once during config reload, more if the config file
contains keyboard configuration.

When they keyboard keymap changes and is updated through wlr_seat, the
keymap ends up sent to every keyboard bound in every client, seemingly
multiple times. On an x230 of mine with a keyboard layout set in the
config file, I see 42 keymap events sent to foot on config reload.

Reduce events from keyboard configurations by skipping all but the
currently active keyboard for the seat, and by clearing the active
keyboard during input manager device reset. After this change, I only
see a single just-in-time keymap event.

Fixes: https://github.com/swaywm/sway/issues/6654
2022-12-12 11:26:11 +01:00
Simon Ser fb1cb0aa3a build: bump version to 1.8-rc2 2022-12-03 17:56:30 +01:00
Simon Ser 194fdc6c35 build: fix have_xwayland when xcb-icccm is not found
xcb-icccm is required to build Xwayland support.

Backported from commit d41f11e6bd.
2022-12-03 17:48:41 +01:00
nerdopolis baf027fc5b Fix build on Debian Stable
(cherry picked from commit dca0bb5749)
2022-11-29 00:09:44 +01:00
Simon Ser 27a56e63d3 build: bump version to 1.8-rc1 2022-11-26 23:27:03 +01:00
Simon Ser 6afe74ffec build: drop unused wayland-egl dependency
(cherry picked from commit 37e4a3d637)
2022-11-26 23:26:47 +01:00
Joan Bruguera 0a9b468540 swaybar: Make hotspots block bar release bindings
The previous commit prioritized hotspots before bar bindings for press events,
which matches i3's behaviour. However, since hotspots don't need to do any
processing on release events, those were not handled, and simply fell through
to `bindsym --release` bar bindings (if any).

This is counter-intuitive, and doesn't match i3's behaviour. Instead in case
a hotspot handles the press event, it should also handle the release event,
doing nothing, but blocking the event from triggering a --release bar binding.

E.g., in Sway, without this commit, this config. shows a text on tray clicks:

    bar {
        # ...
        bindsym --release button1 exec swaynag -m I_got_the_release_event.
    }

But the same configuration in i3 (with i3-nagbar) doesn't show the text.

Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
(cherry picked from commit 94b69acf0d)
2022-11-26 10:29:59 +01:00
Joan Bruguera b92af7e3ca swaybar: Prioritize hotspot events to bar bindings
This is consistent with i3bar's behaviour, and for example, allows binding a
command to button1, while still being able to click on tray icons or other
zones on the bar's status line which may have their own bindings.

E.g., in Sway, without this commit, this config. makes tray icons unclickable:

    bar {
        # ...
        bindsym button1 exec swaynag -m You_clicked_the_tray._Want_some_help?
    }

But the same configuration in i3 (with i3-nagbar) keeps tray items clickable.

Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
(cherry picked from commit 53f9dbd424)
2022-11-26 10:29:59 +01:00
Ronan Pigott d5872d0880 launcher: export X startup ids and use them for workspace matching
(cherry picked from commit 28fda4c0d3)
2022-11-26 10:29:59 +01:00
Ronan Pigott 97423ca9c7 launcher: export xdga tokens and use them for workspace matching
(cherry picked from commit 30ad4dc4a5)
2022-11-26 10:29:59 +01:00
Ronan Pigott ee9266cf8c launcher: fudge the interface a bit
We want to create a context before knowing the pid it will match with.

(cherry picked from commit bdeb9f9565)
2022-11-26 10:29:59 +01:00
Ronan Pigott 66be031f6c launcher: initialize launcher_ctxs once on startup
(cherry picked from commit 66568508c0)
2022-11-26 10:29:59 +01:00
Ronan Pigott 5794a223ce view: associate launch contexts with views
Views now maintain a reference to a launch context which, as a last
resort, is populated at map time with a context associated with its pid.
This opens the possibility of populating it before map via another
source, e.g. xdga-tokens or configuration.

(cherry picked from commit 864b3a9a18)
2022-11-26 10:29:59 +01:00
Ronan Pigott 9d78ede905 launcher: rename pid_workspace to launcher_ctx
Soon we will match views with more than just a pid.

(cherry picked from commit d75c9f9722)
2022-11-26 10:29:59 +01:00
Ronan Pigott cb13b9d628 launcher: use xdga tokens
This reuses wlroots token tracking for workspace matching. It doesn't
export any xdga tokens for clients yet.

(cherry picked from commit bd66f4943d)
2022-11-26 10:29:59 +01:00
Ronan Pigott 69abc41d25 launcher: track workspaces by node
This removes the need to rename the pid_workspaces when a workspace
is renamed.

It also opens the possibility of tracking other node types. Tracking
containers would allow application to be placed correctly in the
container tree even if the user has moved their focus elsewhere since
it was launched.

(cherry picked from commit 3b49f2782e)
2022-11-26 10:29:59 +01:00
Ronan Pigott 16b391db48 node: prettify node type names
(cherry picked from commit 1c4b94ae3c)
2022-11-26 10:29:59 +01:00
Ronan Pigott 25f559dcde root: move the workspace matching code to its own file
This removes the pid_workspace bits from tree/root before it gets
too interesting.

No functional change.

(cherry picked from commit eb5021ef99)
2022-11-26 10:29:59 +01:00
Simon Ser 52166bc1f5 build: drop intermediate libraries for protocols
(cherry picked from commit af8a5a8918)
2022-11-26 10:29:58 +01:00
Simon Ser 2a6bcc6738 build: drop "server" from target name for protocol code
(cherry picked from commit e5475d9310)
2022-11-26 10:29:58 +01:00
Simon Ser 61e4e65ea6 build: unify server & client protocol generation
No need to make a difference here, let's just generate header
files for both.

(cherry picked from commit 5be5a038da)
2022-11-26 10:29:58 +01:00
Simon Ser ceece55850 build: drop wayland-scanner fallback
(cherry picked from commit 366f6ef3d3)
2022-11-26 10:29:58 +01:00
Manuel Stoeckl 9f4229827f Use shm_open instead of mkstemp
shm_open is more reliable because it does not require
a writeable filesystem folder, unlike mkstemp.

(cherry picked from commit e2bc8866f4)
2022-11-26 10:29:58 +01:00
Kirill Primak 68b4ed3a4a output: set damage ring bounds to pixel values
Fixes: https://github.com/swaywm/sway/issues/7254
(cherry picked from commit 85005b52fe)
2022-11-26 10:29:58 +01:00
Alexander Orzechowski 5a2563b1a4 workspace_create: Don't allow NULL name
(cherry picked from commit 34933bb843)
2022-11-26 10:29:58 +01:00
Simon Ser 0143c7ade8 ci: checkout wlroots 0.16.0 2022-11-11 22:30:10 +01:00
Baltazár Radics 5c239eaac5 container_get_siblings: handle NULL workspace 2022-11-11 18:57:29 +01:00
Simon Ser d945c8f519 lock: fix crash on output destroy
Closes: https://github.com/swaywm/sway/issues/7120
2022-11-11 17:01:50 +01:00
Kirill Primak 7862fa670e
Use wlr_damage_ring
wlr_output_damage is to be replaced with wlr_damage_ring, so use that.
2022-11-11 16:29:04 +01:00
Simon Ser dcd2076f38 Use wl_signal_emit_mutable()
This function fixes segfaults when emitting a signal potentially
removes arbitrary listeners.
2022-11-10 22:27:38 +03:00
Kirill Primak 6c3b35701d ci: install hwdata 2022-11-09 10:43:44 +01:00
Callum Andrew 3e19836f0e criteria: allow matching for NULL string criteria 2022-11-04 10:02:11 +01:00
Puck Meerburg e40eb338b9 criteria: allow matching on empty (NULL) titles 2022-10-30 10:57:19 +01:00
Puck Meerburg 0fdeb4ca84 tree: support formatting null titles
Any windows that have never had a title set visually behave closer to
that of an empty title, but are unformattable, as the code bails out
early on a NULL title.
2022-10-30 10:57:19 +01:00
pudiva chip líquida 7cc8ab6d6c Support libinput's 1.21 new dwtp option
Support the new dwtp (disable while trackpointing) option introduced in
libinput 1.21, allowing users to control whether the trackpoint (like
those in Thinkpads, but not only) should be disabled while using the
keyboard/touchpad.

See: https://gitlab.freedesktop.org/libinput/libinput/-/issues/731
2022-10-30 10:56:34 +01:00
Alexander Orzechowski a61815d385 container_floating_set_default_size: Store workspace size box on the stack 2022-10-29 00:47:01 +02:00
Daniel De Graaf 8aa89dc277 Fix focus tracking when session lock is active
Remove the incorrect attempt to block focus changes when an input grab
is present and replace it with the same logic used for layer_shell-based
screen lockers: restore the focus after changing it.

This fixes a use-after-free of seat->workspace if outputs are destroyed
while a screen lock is enabled.
2022-10-28 19:41:24 +02:00
Daniel De Graaf 8f7bb145b7 Rework session lock keyboard focus handling
When removing outputs, it is possible to end up in a situation where
none of the session lock client's surfaces have keyboard focus,
resulting in it not receiving keyboard events.  Track the focused
surface and update it as needed on surface destroy.
2022-10-28 19:41:24 +02:00
Yaroslav de la Peña Smirnov 9d99bb956f Fix keymap being NULL and segfaulting on dev add
Moved `libinput_config` to the callers of
`sway_input_configure_libinput_device` so that we send the event after
the added event.
2022-10-23 11:56:29 +02:00
Tudor Brindus 5e514e6474 input: tweak focus behavior to allow focusing parent containers
Sway focuses the inactive child when focusing split containers. However,
there is currently no way to focus the parent container itself by mouse.
A user must use the keyboard to do so.

This commit maintains the current behavior, but makes it such that a
second click on the split container titlebar (i.e., after its children
are visible) focuses the split container itself.
2022-10-21 10:05:00 +02:00
Simon Ser 9400bd963c Add support for ext-idle-notify-v1
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3753
2022-10-14 15:56:07 +02:00
cparm 99fd096d69 Avoid double free in criteria_destroy() 2022-10-13 14:56:10 +02:00
Simon Ser 7a6afc5199 Fix leaks in criteria_destroy() 2022-10-10 09:51:01 -04:00
Tudor Brindus c7bced9329 input: focus container when scrolling on titlebar
Fixes #6503.
2022-10-10 08:56:51 +02:00
Tudor Brindus 09354db878 input: focus floating container when clicked on border
Fixes #7209.
2022-10-10 08:55:21 +02:00
Ferdinand Schober 99acdb4e62 Use keyboard_state.focused_surface directly 2022-10-09 10:07:51 +02:00