![](https://secure.gravatar.com/avatar/df8330968b6df8cd1c1942c5fb4b720c.jpg?s=120&d=mm&r=g)
commit b61ece32a640abec13c2c3f45c2303b7f1e95770 Author: Tim Biermann <tbier@posteo.de> Date: Fri Jan 7 12:31:56 2022 +0100 [notify] sway: new dependency: xorg-libevdev diff --git a/sway/.signature b/sway/.signature index a7cee6677..be8daf804 100644 --- a/sway/.signature +++ b/sway/.signature @@ -1,6 +1,6 @@ untrusted comment: verify with /etc/ports/contrib.pub -RWSagIOpLGJF31sLy6atEMVw+71j8ULFNtB/kG9oBlAVkiw9kgk2ZBnC0bHNAq3fnNGqMRCuq5dce8afKW0zjySO7SuzzdkVrgw= -SHA256 (Pkgfile) = 4857a2972ed1193ffe3c8afe2d95d6a9d260c96336c3b2882e5703a12062e24a +RWSagIOpLGJF38jUd4xKNonUB23JB56L7JL7IAhP7JMK60cfFnSrYLrM3KkrYYcsfxSdnyUesb+uXAEDRCbS+vwk6N6Sqz7nAAU= +SHA256 (Pkgfile) = 930ec54b4622283d73d393edbe2e7547ef82953aaf028f230dbbf89800063103 SHA256 (.footprint) = 76cf242dac27363a8a964536eda5e54f00953e79380ee493090ca249bd688920 -SHA256 (sway-1.6.1.tar.gz) = 8b138867cd83217de07138144b1279fe58e0421eb10c91122aa33c8770fe7391 -SHA256 (6249.patch) = b12f7ba4663ac296d1bd435bd2d514fad0639391c6639bac695eb6f590917dd2 +SHA256 (sway-1.7-rc1.tar.gz) = 3bf95342eb94024589094273f4f495f8c0c9cae9bece1c08ab19101c99bbe8f2 +SHA256 (6249.patch) = 24fd8235405b82c163a260311b79936aefac3bef451fe314b1bf692038bf407a diff --git a/sway/6249.patch b/sway/6249.patch index 512c0fbbd..af9c72722 100644 --- a/sway/6249.patch +++ b/sway/6249.patch @@ -1,7 +1,10 @@ -From f641e581a5301eeaefcb0da51904946d83240a88 Mon Sep 17 00:00:00 2001 +From f65c7d9164ef18b21752259272ef6f43e1df4d2b Mon Sep 17 00:00:00 2001 From: Felix Weilbach <felix.weilbach@t-online.de> Date: Sun, 30 May 2021 20:45:01 +0200 -Subject: [PATCH] Tray: Implement dbusmenu +Subject: [PATCH 1/5] Tray: Implement dbusmenu + +Co-authored-by: Ian Fan <ianfan0@gmail.com> +Co-authored-by: Nathan Schulte <nmschulte@gmail.com> Signed-off-by: Felix Weilbach <felix.weilbach@t-online.de> --- @@ -9,12 +12,12 @@ Signed-off-by: Felix Weilbach <felix.weilbach@t-online.de> include/swaybar/tray/dbusmenu.h | 25 + include/swaybar/tray/item.h | 2 + include/swaybar/tray/tray.h | 3 + - swaybar/input.c | 56 +- + swaybar/input.c | 54 +- swaybar/meson.build | 3 +- swaybar/render.c | 29 +- - swaybar/tray/dbusmenu.c | 1346 +++++++++++++++++++++++++++++++ + swaybar/tray/dbusmenu.c | 1345 +++++++++++++++++++++++++++++++ swaybar/tray/item.c | 38 +- - 9 files changed, 1487 insertions(+), 25 deletions(-) + 9 files changed, 1481 insertions(+), 28 deletions(-) create mode 100644 include/swaybar/tray/dbusmenu.h create mode 100644 swaybar/tray/dbusmenu.c @@ -112,7 +115,7 @@ index d2e80a6d47..853f17cdc1 100644 struct swaybar_tray *create_tray(struct swaybar *bar); diff --git a/swaybar/input.c b/swaybar/input.c -index 6e13f17732..65c33db864 100644 +index c8c8f0d4f1..2c4c5d8fef 100644 --- a/swaybar/input.c +++ b/swaybar/input.c @@ -10,6 +10,10 @@ @@ -176,37 +179,30 @@ index 6e13f17732..65c33db864 100644 } static bool check_bindings(struct swaybar *bar, uint32_t button, -@@ -141,7 +164,11 @@ static bool check_bindings(struct swaybar *bar, uint32_t button, +@@ -141,14 +164,16 @@ static bool check_bindings(struct swaybar *bar, uint32_t button, } static bool process_hotspots(struct swaybar_output *output, - double x, double y, uint32_t button) { -+ struct swaybar_seat *seat, -+ uint32_t serial, -+ double x, -+ double y, ++ struct swaybar_seat *seat, uint32_t serial, double x, double y, + uint32_t button) { - double px = x * output->scale; - double py = y * output->scale; struct swaybar_hotspot *hotspot; -@@ -149,8 +176,14 @@ static bool process_hotspots(struct swaybar_output *output, - if (px >= hotspot->x && py >= hotspot->y - && px < hotspot->x + hotspot->width - && py < hotspot->y + hotspot->height) { + wl_list_for_each(hotspot, &output->hotspots, link) { +- if (x >= hotspot->x && y >= hotspot->y +- && x < hotspot->x + hotspot->width +- && y < hotspot->y + hotspot->height) { - if (HOTSPOT_IGNORE == hotspot->callback(output, hotspot, x, y, - button, hotspot->data)) { -+ if (HOTSPOT_IGNORE == hotspot->callback(output, -+ hotspot, -+ seat, -+ serial, -+ x, -+ y, -+ button, -+ hotspot->data)) { ++ if (x >= hotspot->x && y >= hotspot->y && ++ x < hotspot->x + hotspot->width && ++ y < hotspot->y + hotspot->height) { ++ if (HOTSPOT_IGNORE == ++ hotspot->callback(output, hotspot, seat, serial, x, y, ++ button, hotspot->data)) { return true; } } -@@ -162,6 +195,12 @@ static bool process_hotspots(struct swaybar_output *output, +@@ -160,6 +185,12 @@ static bool process_hotspots(struct swaybar_output *output, static void wl_pointer_button(void *data, struct wl_pointer *wl_pointer, uint32_t serial, uint32_t time, uint32_t button, uint32_t state) { struct swaybar_seat *seat = data; @@ -219,7 +215,7 @@ index 6e13f17732..65c33db864 100644 struct swaybar_pointer *pointer = &seat->pointer; struct swaybar_output *output = pointer->current; if (!sway_assert(output, "button with no active output")) { -@@ -175,7 +214,7 @@ static void wl_pointer_button(void *data, struct wl_pointer *wl_pointer, +@@ -173,7 +204,7 @@ static void wl_pointer_button(void *data, struct wl_pointer *wl_pointer, if (state != WL_POINTER_BUTTON_STATE_PRESSED) { return; } @@ -228,7 +224,7 @@ index 6e13f17732..65c33db864 100644 } static void workspace_next(struct swaybar *bar, struct swaybar_output *output, -@@ -232,7 +271,7 @@ static void process_discrete_scroll(struct swaybar_seat *seat, +@@ -230,7 +261,7 @@ static void process_discrete_scroll(struct swaybar_seat *seat, return; } @@ -237,7 +233,7 @@ index 6e13f17732..65c33db864 100644 return; } -@@ -405,7 +444,8 @@ static void wl_touch_up(void *data, struct wl_touch *wl_touch, +@@ -403,7 +434,8 @@ static void wl_touch_up(void *data, struct wl_touch *wl_touch, } if (time - slot->time < 500) { // Tap, treat it like a pointer click @@ -262,10 +258,10 @@ index 9feb3cd2d0..86abe93235 100644 swaybar_deps = [ diff --git a/swaybar/render.c b/swaybar/render.c -index fcc8be1d6f..68cbe853a7 100644 +index de468b4f19..e3133a422c 100644 --- a/swaybar/render.c +++ b/swaybar/render.c -@@ -160,8 +160,14 @@ static void render_sharp_line(cairo_t *cairo, uint32_t color, +@@ -158,8 +158,14 @@ static void render_sharp_line(cairo_t *cairo, uint32_t color, } static enum hotspot_event_handling block_hotspot_callback( @@ -282,7 +278,7 @@ index fcc8be1d6f..68cbe853a7 100644 struct i3bar_block *block = data; struct status_line *status = output->bar->status; return i3bar_block_send_click(status, block, x, y, -@@ -296,7 +302,7 @@ static uint32_t render_status_block(struct render_context *ctx, +@@ -294,7 +300,7 @@ static uint32_t render_status_block(struct render_context *ctx, } else if (strncmp(block->align, "right", 5) == 0) { offset = x_pos + width - text_width; } else if (strncmp(block->align, "center", 6) == 0) { @@ -291,7 +287,7 @@ index fcc8be1d6f..68cbe853a7 100644 } double text_y = height / 2.0 - text_height / 2.0; cairo_move_to(cairo, offset, (int)floor(text_y)); -@@ -325,7 +331,7 @@ static uint32_t render_status_block(struct render_context *ctx, +@@ -322,7 +328,7 @@ static uint32_t render_status_block(struct render_context *ctx, } cairo_set_source_u32(cairo, color); if (config->sep_symbol) { @@ -300,7 +296,7 @@ index fcc8be1d6f..68cbe853a7 100644 double sep_y = height / 2.0 - sep_height / 2.0; cairo_move_to(cairo, offset, (int)floor(sep_y)); choose_text_aa_mode(ctx, color); -@@ -334,7 +340,7 @@ static uint32_t render_status_block(struct render_context *ctx, +@@ -331,7 +337,7 @@ static uint32_t render_status_block(struct render_context *ctx, } else { cairo_set_operator(cairo, CAIRO_OPERATOR_SOURCE); cairo_set_line_width(cairo, 1); @@ -309,7 +305,7 @@ index fcc8be1d6f..68cbe853a7 100644 cairo_line_to(cairo, x_pos + sep_block_width / 2, height - margin); cairo_stroke(cairo); } -@@ -596,8 +602,14 @@ static uint32_t render_binding_mode_indicator(struct render_context *ctx, +@@ -593,8 +599,14 @@ static uint32_t render_binding_mode_indicator(struct render_context *ctx, } static enum hotspot_event_handling workspace_hotspot_callback( @@ -326,7 +322,7 @@ index fcc8be1d6f..68cbe853a7 100644 if (button != BTN_LEFT) { return HOTSPOT_PROCESS; } -@@ -662,7 +674,8 @@ static uint32_t render_workspace_button(struct render_context *ctx, +@@ -659,7 +671,8 @@ static uint32_t render_workspace_button(struct render_context *ctx, double text_y = height / 2.0 - text_height / 2.0; cairo_set_source_u32(cairo, box_colors.text); @@ -334,14 +330,14 @@ index fcc8be1d6f..68cbe853a7 100644 + cairo_move_to( + cairo, *x + width / 2.0 - text_width / 2.0, (int)floor(text_y)); choose_text_aa_mode(ctx, box_colors.text); - pango_printf(cairo, config->font, output->scale, config->pango_markup, + render_text(cairo, config->font, 1, config->pango_markup, "%s", ws->label); diff --git a/swaybar/tray/dbusmenu.c b/swaybar/tray/dbusmenu.c new file mode 100644 -index 0000000000..e39699f50f +index 0000000000..e8c6480b2a --- /dev/null +++ b/swaybar/tray/dbusmenu.c -@@ -0,0 +1,1346 @@ +@@ -0,0 +1,1345 @@ +#define _POSIX_C_SOURCE 200809L +#include <pool-buffer.h> +#include <wlr-layer-shell-unstable-v1-client-protocol.h> @@ -656,7 +652,7 @@ index 0000000000..e39699f50f + uint32_t disabled_color = c - ((c & 0xFF) >> 1); + cairo_set_source_u32(cairo, disabled_color); + } -+ pango_printf(cairo, config->font, output->scale, false, "%s", ++ render_text(cairo, config->font, output->scale, false, "%s", + item->label); + + // draw icon or menu indicator if needed @@ -1606,8 +1602,7 @@ index 0000000000..e39699f50f + uint32_t serial, struct wl_surface *surface) { + struct swaybar_seat *seat = data; + struct swaybar_tray *tray = seat->bar->tray; -+ struct swaybar_dbusmenu_menu *focused_menu = tray->menu_pointer_focus; -+ if (!(tray && tray->menu && focused_menu)) { ++ if (!(tray && tray->menu)) { + return false; + } + @@ -1772,3 +1767,196 @@ index 19f4beacaa..247eab33cc 100644 return HOTSPOT_IGNORE; } else { sway_log(SWAY_DEBUG, "but it doesn't exist"); + +From d3768e479c3f138aaa52ef7ef5994547a13df1c3 Mon Sep 17 00:00:00 2001 +From: Felix Weilbach <felix.weilbach@t-online.de> +Date: Wed, 15 Sep 2021 21:55:34 +0200 +Subject: [PATCH 2/5] fixup! don't scroll workspaces + +--- + include/swaybar/tray/dbusmenu.h | 3 +++ + swaybar/input.c | 6 ++++++ + swaybar/tray/dbusmenu.c | 9 +++++++++ + 3 files changed, 18 insertions(+) + +diff --git a/include/swaybar/tray/dbusmenu.h b/include/swaybar/tray/dbusmenu.h +index 55db61ddd9..442e40547b 100644 +--- a/include/swaybar/tray/dbusmenu.h ++++ b/include/swaybar/tray/dbusmenu.h +@@ -22,4 +22,7 @@ bool dbusmenu_pointer_enter(void *data, struct wl_pointer *wl_pointer, + bool dbusmenu_pointer_leave(void *data, struct wl_pointer *wl_pointer, + uint32_t serial, struct wl_surface *surface); + ++bool dbusmenu_pointer_frame(struct swaybar_seat *data, ++ struct wl_pointer *wl_pointer); ++ + #endif +diff --git a/swaybar/input.c b/swaybar/input.c +index 2c4c5d8fef..c6d176946d 100644 +--- a/swaybar/input.c ++++ b/swaybar/input.c +@@ -327,6 +327,12 @@ static void wl_pointer_frame(void *data, struct wl_pointer *wl_pointer) { + struct swaybar_pointer *pointer = &seat->pointer; + struct swaybar_output *output = pointer->current; + ++#if HAVE_TRAY ++ if (dbusmenu_pointer_frame(data, wl_pointer)) { ++ return; ++ } ++#endif ++ + if (output == NULL) { + return; + } +diff --git a/swaybar/tray/dbusmenu.c b/swaybar/tray/dbusmenu.c +index e8c6480b2a..739cf4c5a9 100644 +--- a/swaybar/tray/dbusmenu.c ++++ b/swaybar/tray/dbusmenu.c +@@ -1237,6 +1237,15 @@ static void close_child_menus_outside_pointer( + } + } + ++bool dbusmenu_pointer_frame(struct swaybar_seat *data, ++ struct wl_pointer *wl_pointer) { ++ struct swaybar_tray *tray = data->bar->tray; ++ if (!(tray && tray->menu && tray->menu_pointer_focus)) { ++ return false; ++ } ++ return true; ++} ++ + bool dbusmenu_pointer_enter(void *data, struct wl_pointer *wl_pointer, + uint32_t serial, struct wl_surface *surface, wl_fixed_t surface_x, + wl_fixed_t surface_y) { + +From 44f947aa9bb1cf36ef384f64867fcdfc89258573 Mon Sep 17 00:00:00 2001 +From: Felix Weilbach <felix.weilbach@t-online.de> +Date: Wed, 15 Sep 2021 22:44:28 +0200 +Subject: [PATCH 3/5] fixup! close submenus + +--- + swaybar/tray/dbusmenu.c | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/swaybar/tray/dbusmenu.c b/swaybar/tray/dbusmenu.c +index 739cf4c5a9..f8f31cf6b3 100644 +--- a/swaybar/tray/dbusmenu.c ++++ b/swaybar/tray/dbusmenu.c +@@ -1127,6 +1127,21 @@ static void close_child_menus(struct swaybar_dbusmenu_menu *menu) { + } + } + ++static void close_child_menus_except(struct swaybar_dbusmenu_menu *menu, ++ int id) { ++ if (!menu || !menu->child_menus) { ++ return; ++ } ++ ++ for (int i = 0; i < menu->child_menus->length; ++i) { ++ struct swaybar_dbusmenu_menu *child_menu = menu->child_menus->items[i]; ++ if (child_menu->item_id == id) { ++ continue; ++ } ++ close_menus(child_menu); ++ } ++} ++ + static void open_close_child_menu(struct swaybar_dbusmenu_menu *menu, + struct swaybar_dbusmenu_menu_item *item, int x, int y) { + +@@ -1137,6 +1152,7 @@ static void open_close_child_menu(struct swaybar_dbusmenu_menu *menu, + // No need to open the root menu + return; + } ++ close_child_menus_except(menu, item->id); + open_menu_id(menu->dbusmenu, item->id); + } else if (in_hotspot && !item->submenu) { + close_child_menus(menu); + +From d1a87205af0830a31fa993e4e956623bb3e59340 Mon Sep 17 00:00:00 2001 +From: Felix Weilbach <felix.weilbach@t-online.de> +Date: Wed, 15 Sep 2021 23:00:49 +0200 +Subject: [PATCH 4/5] fixup! Only set focused menu when pointer enters + +--- + swaybar/tray/dbusmenu.c | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/swaybar/tray/dbusmenu.c b/swaybar/tray/dbusmenu.c +index f8f31cf6b3..f389097a93 100644 +--- a/swaybar/tray/dbusmenu.c ++++ b/swaybar/tray/dbusmenu.c +@@ -670,12 +670,6 @@ static void swaybar_dbusmenu_draw(struct swaybar_dbusmenu *dbusmenu, int id) { + return; + } + swaybar_dbusmenu_draw_menu(dbusmenu->menu, id, true); +- +- if (!dbusmenu->sni->tray->menu_pointer_focus) { +- // First shown +- dbusmenu->sni->tray->menu_pointer_focus = +- find_menu_id(dbusmenu->menu, id); +- } + } + + struct png_stream { + +From 5c7aa54af364850c03d6f7aee8b486e53572a682 Mon Sep 17 00:00:00 2001 +From: Felix Weilbach <felix.weilbach@t-online.de> +Date: Thu, 16 Sep 2021 19:42:46 +0200 +Subject: [PATCH 5/5] fixup! handle also pointer axis when using tray + +--- + include/swaybar/tray/dbusmenu.h | 3 +++ + swaybar/input.c | 6 ++++++ + swaybar/tray/dbusmenu.c | 9 +++++++++ + 3 files changed, 18 insertions(+) + +diff --git a/include/swaybar/tray/dbusmenu.h b/include/swaybar/tray/dbusmenu.h +index 442e40547b..610b6e6285 100644 +--- a/include/swaybar/tray/dbusmenu.h ++++ b/include/swaybar/tray/dbusmenu.h +@@ -25,4 +25,7 @@ bool dbusmenu_pointer_leave(void *data, struct wl_pointer *wl_pointer, + bool dbusmenu_pointer_frame(struct swaybar_seat *data, + struct wl_pointer *wl_pointer); + ++bool dbusmenu_pointer_axis(struct swaybar_seat *data, ++ struct wl_pointer *wl_pointer); ++ + #endif +diff --git a/swaybar/input.c b/swaybar/input.c +index c6d176946d..adb4c940ea 100644 +--- a/swaybar/input.c ++++ b/swaybar/input.c +@@ -311,6 +311,12 @@ static void wl_pointer_axis(void *data, struct wl_pointer *wl_pointer, + return; + } + ++#if HAVE_TRAY ++ if (dbusmenu_pointer_axis(data, wl_pointer)) { ++ return; ++ } ++#endif ++ + // If there's a while since the last scroll event, + // set 'value' to zero as if to reset the "virtual scroll wheel" + if (seat->axis[axis].discrete_steps == 0 && +diff --git a/swaybar/tray/dbusmenu.c b/swaybar/tray/dbusmenu.c +index f389097a93..e4a6a9f6d6 100644 +--- a/swaybar/tray/dbusmenu.c ++++ b/swaybar/tray/dbusmenu.c +@@ -1256,6 +1256,15 @@ bool dbusmenu_pointer_frame(struct swaybar_seat *data, + return true; + } + ++bool dbusmenu_pointer_axis(struct swaybar_seat *data, ++ struct wl_pointer *wl_pointer) { ++ struct swaybar_tray *tray = data->bar->tray; ++ if (!(tray && tray->menu && tray->menu_pointer_focus)) { ++ return false; ++ } ++ return true; ++} ++ + bool dbusmenu_pointer_enter(void *data, struct wl_pointer *wl_pointer, + uint32_t serial, struct wl_surface *surface, wl_fixed_t surface_x, + wl_fixed_t surface_y) { diff --git a/sway/Pkgfile b/sway/Pkgfile index e02595cb4..ef341ef68 100644 --- a/sway/Pkgfile +++ b/sway/Pkgfile @@ -1,12 +1,12 @@ # Description: An i3-compatible wayland compositor. # URL: https://swaywm.org/ # Maintainer: Tim Biermann, tbier at posteo dot de -# Depends on: basu json-c pango wlroots +# Depends on: basu json-c pango wlroots xorg-libevdev # Optional: gdk-pixbuf scdoc seatd name=sway -version=1.6.1 -release=5 +version=1.7-rc1 +release=1 source=(https://github.com/swaywm/sway/archive/$version/$name-$version.tar.gz 6249.patch)