diff options
author | k3d3 | 2021-10-31 13:22:51 -0400 |
---|---|---|
committer | k3d3 | 2021-10-31 13:22:51 -0400 |
commit | 109adb6f609d91a765698dc21d26e5ee738cdf34 (patch) | |
tree | c1cb80781a6e4ee24a5c60a8792986baff2e291d | |
parent | 4b857cea8e58349be745758de3834f486d9549c6 (diff) | |
download | aur-109adb6f609d91a765698dc21d26e5ee738cdf34.tar.gz |
Create mask-modifiers patch based off sway-git package
-rw-r--r-- | .SRCINFO | 11 | ||||
-rw-r--r-- | PKGBUILD | 20 | ||||
-rw-r--r-- | mask-modifiers.patch | 155 |
3 files changed, 176 insertions, 10 deletions
@@ -1,6 +1,6 @@ -pkgbase = sway-git +pkgbase = sway-mask-modifiers-git pkgdesc = Tiling Wayland compositor and replacement for the i3 window manager - pkgver = r6607.28cadf55 + pkgver = r6815.38020d15 pkgrel = 1 url = https://swaywm.org arch = i686 @@ -31,13 +31,16 @@ pkgbase = sway-git optdepends = wallutils: Timed wallpapers optdepends = waybar: Highly customizable bar provides = sway + provides = sway-git conflicts = sway + conflicts = sway-git options = debug backup = etc/sway/config source = sway::git+https://github.com/swaywm/sway.git + source = mask-modifiers.patch source = 50-systemd-user.conf sha512sums = SKIP + sha512sums = SKIP sha512sums = 57590bc0d14c87289a4a9cd67991c6a841e54244d2a6186b5da5a08e633de2e8631959fa8c77ede211b0a5f315d920f2c1350951a53d6f2e9e81859056cb3c9e -pkgname = sway-git - +pkgname = sway-mask-modifiers-git @@ -1,8 +1,9 @@ -# Maintainer: Drew DeVault <sir@cmpwn.com> +# Maintainer: Keith <k-aur at 3d3 dot ca> +# Contributor: Drew DeVault <sir@cmpwn.com> # Contributor: Antonin Décimo <antonin dot decimo at gmail dot com> -pkgname=sway-git +pkgname=sway-mask-modifiers-git _pkgname=sway -pkgver=r6607.28cadf55 +pkgver=r6815.38020d15 pkgrel=1 license=("MIT") pkgdesc="Tiling Wayland compositor and replacement for the i3 window manager" @@ -39,12 +40,14 @@ optdepends=( backup=(etc/sway/config) arch=("i686" "x86_64") url="https://swaywm.org" -source=("${pkgname%-*}::git+https://github.com/swaywm/sway.git" +source=("sway::git+https://github.com/swaywm/sway.git" + "mask-modifiers.patch" 50-systemd-user.conf) sha512sums=('SKIP' + 'SKIP' '57590bc0d14c87289a4a9cd67991c6a841e54244d2a6186b5da5a08e633de2e8631959fa8c77ede211b0a5f315d920f2c1350951a53d6f2e9e81859056cb3c9e') -provides=("sway") -conflicts=("sway") +provides=("sway" "sway-git") +conflicts=("sway" "sway-git") options=(debug) pkgver() { @@ -52,6 +55,11 @@ pkgver() { printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" } +prepare() { + cd "$_pkgname" + patch --forward --strip=1 --input="${srcdir}/mask-modifiers.patch" +} + build() { arch-meson \ -Dsd-bus-provider=libsystemd \ diff --git a/mask-modifiers.patch b/mask-modifiers.patch new file mode 100644 index 000000000000..0dcfd1efe969 --- /dev/null +++ b/mask-modifiers.patch @@ -0,0 +1,155 @@ +diff --git a/include/sway/config.h b/include/sway/config.h +index 660245c1..1dd71588 100644 +--- a/include/sway/config.h ++++ b/include/sway/config.h +@@ -45,6 +45,7 @@ enum binding_flags { + BINDING_RELOAD = 1 << 6, // switch only; (re)trigger binding on reload + BINDING_INHIBITED = 1 << 7, // keyboard only: ignore shortcut inhibitor + BINDING_NOREPEAT = 1 << 8, // keyboard only; do not trigger when repeating a held key ++ BINDING_MASK_MODIFIERS = 1 << 9, // keyboard and mouse; only check modifiers defined in a binding + }; + + /** +diff --git a/sway/commands/bind.c b/sway/commands/bind.c +index 25be415e..0ac25f48 100644 +--- a/sway/commands/bind.c ++++ b/sway/commands/bind.c +@@ -376,6 +376,8 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv, + warn = false; + } else if (strcmp("--no-repeat", argv[0]) == 0) { + binding->flags |= BINDING_NOREPEAT; ++ } else if (strcmp("--mask-modifiers", argv[0]) == 0) { ++ binding->flags |= BINDING_MASK_MODIFIERS; + } else { + break; + } +diff --git a/sway/input/keyboard.c b/sway/input/keyboard.c +index f258ac7d..2be4eca8 100644 +--- a/sway/input/keyboard.c ++++ b/sway/input/keyboard.c +@@ -158,8 +158,13 @@ static void get_active_binding(const struct sway_shortcut_state *state, + bool binding_locked = (binding->flags & BINDING_LOCKED) != 0; + bool binding_inhibited = (binding->flags & BINDING_INHIBITED) != 0; + bool binding_release = binding->flags & BINDING_RELEASE; ++ bool binding_mask_modifiers = binding->flags & BINDING_MASK_MODIFIERS; + +- if (modifiers ^ binding->modifiers || ++ bool deny_modifiers = binding_mask_modifiers ? ++ (modifiers & binding->modifiers) != binding->modifiers : ++ modifiers ^ binding->modifiers; ++ ++ if (deny_modifiers || + release != binding_release || + locked > binding_locked || + inhibited > binding_inhibited || +diff --git a/sway/input/seatop_default.c b/sway/input/seatop_default.c +index 4320a3b4..63d0f51c 100644 +--- a/sway/input/seatop_default.c ++++ b/sway/input/seatop_default.c +@@ -115,7 +115,7 @@ enum wlr_edges find_resize_edge(struct sway_container *cont, + static struct sway_binding* get_active_mouse_binding( + struct seatop_default_event *e, list_t *bindings, uint32_t modifiers, + bool release, bool on_titlebar, bool on_border, bool on_content, +- bool on_workspace, const char *identifier) { ++ bool on_workspace, const char *identifier, uint32_t changed_button) { + uint32_t click_region = + ((on_titlebar || on_workspace) ? BINDING_TITLEBAR : 0) | + ((on_border || on_workspace) ? BINDING_BORDER : 0) | +@@ -124,8 +124,18 @@ static struct sway_binding* get_active_mouse_binding( + struct sway_binding *current = NULL; + for (int i = 0; i < bindings->length; ++i) { + struct sway_binding *binding = bindings->items[i]; +- if (modifiers ^ binding->modifiers || +- e->pressed_button_count != (size_t)binding->keys->length || ++ bool binding_mask_modifiers = binding->flags & BINDING_MASK_MODIFIERS; ++ ++ bool deny_modifiers = binding_mask_modifiers ? ++ (modifiers & binding->modifiers) != binding->modifiers : ++ modifiers ^ binding->modifiers; ++ ++ bool deny_button_count = binding_mask_modifiers ? ++ false : ++ e->pressed_button_count != (size_t)binding->keys->length; ++ ++ if (deny_modifiers || ++ deny_button_count || + release != (binding->flags & BINDING_RELEASE) || + !(click_region & binding->flags) || + (on_workspace && +@@ -136,11 +146,28 @@ static struct sway_binding* get_active_mouse_binding( + } + + bool match = true; +- for (size_t j = 0; j < e->pressed_button_count; j++) { +- uint32_t key = *(uint32_t *)binding->keys->items[j]; +- if (key != e->pressed_buttons[j]) { ++ if (binding_mask_modifiers) { ++ size_t matching_keys = 0; ++ bool matched_changed_button = false; ++ for (size_t j = 0, k = 0; j < e->pressed_button_count; j++) { ++ uint32_t key = *(uint32_t *)binding->keys->items[k]; ++ if (key == changed_button) { ++ matched_changed_button = true; ++ } ++ if (key == e->pressed_buttons[j]) { ++ matching_keys++; ++ } ++ } ++ if (!matched_changed_button || matching_keys != (size_t) binding->keys->length) { + match = false; +- break; ++ } ++ } else { ++ for (size_t j = 0; j < e->pressed_button_count; j++) { ++ uint32_t key = *(uint32_t *)binding->keys->items[j]; ++ if (key != e->pressed_buttons[j]) { ++ match = false; ++ break; ++ } + } + } + if (!match) { +@@ -304,12 +331,12 @@ static bool trigger_pointer_button_binding(struct sway_seat *seat, + binding = get_active_mouse_binding(e, + config->current_mode->mouse_bindings, modifiers, false, + on_titlebar, on_border, on_contents, on_workspace, +- device_identifier); ++ device_identifier, button); + } else { + binding = get_active_mouse_binding(e, + config->current_mode->mouse_bindings, modifiers, true, + on_titlebar, on_border, on_contents, on_workspace, +- device_identifier); ++ device_identifier, button); + state_erase_button(e, button); + } + +@@ -486,7 +513,9 @@ static void handle_button(struct sway_seat *seat, uint32_t time_msec, + // Handle mousedown on a container surface + if (surface && cont && state == WLR_BUTTON_PRESSED) { + seat_set_focus_container(seat, cont); +- seatop_begin_down(seat, cont, time_msec, sx, sy); ++ //seatop_begin_down(seat, cont, time_msec, sx, sy); ++ // Use default handler instead of down handler ++ // I'm not sure why this makes cursor button handling work + seat_pointer_notify_button(seat, time_msec, button, WLR_BUTTON_PRESSED); + return; + } +@@ -698,7 +727,7 @@ static void handle_pointer_axis(struct sway_seat *seat, + state_add_button(e, button); + binding = get_active_mouse_binding(e, config->current_mode->mouse_bindings, + modifiers, false, on_titlebar, on_border, on_contents, on_workspace, +- dev_id); ++ dev_id, button); + if (binding) { + seat_execute_command(seat, binding); + handled = true; +@@ -735,7 +764,7 @@ static void handle_pointer_axis(struct sway_seat *seat, + // Handle mouse bindings - x11 mouse buttons 4-7 - release event + binding = get_active_mouse_binding(e, config->current_mode->mouse_bindings, + modifiers, true, on_titlebar, on_border, on_contents, on_workspace, +- dev_id); ++ dev_id, button); + state_erase_button(e, button); + if (binding) { + seat_execute_command(seat, binding); |