aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--community/rofi-wayland/0002-Wayland-Implement-partial-support-for-offset-propert.patch93
-rw-r--r--community/rofi-wayland/APKBUILD4
2 files changed, 96 insertions, 1 deletions
diff --git a/community/rofi-wayland/0002-Wayland-Implement-partial-support-for-offset-propert.patch b/community/rofi-wayland/0002-Wayland-Implement-partial-support-for-offset-propert.patch
new file mode 100644
index 0000000000..f5808fb260
--- /dev/null
+++ b/community/rofi-wayland/0002-Wayland-Implement-partial-support-for-offset-propert.patch
@@ -0,0 +1,93 @@
+From e963c3174a6e7d6d9f9617666bbec8b13077f13c Mon Sep 17 00:00:00 2001
+From: Jakub Jirutka <jakub@jirutka.cz>
+Date: Wed, 13 Oct 2021 01:42:32 +0200
+Subject: [PATCH] [Wayland] Implement partial support for offset properties
+ on window
+
+...using zwlr_layer_surface_v1::set_margin. It's only partial because
+surface margin has effect only when the the window is located on edge of
+the screen, not in center. Also the anchor property is not implemented,
+the anchor point is always the edge of the window corresponding to the
+location property.
+---
+ include/wayland.h | 4 +++-
+ source/wayland/display.c | 12 +++++++++++-
+ source/wayland/view.c | 12 ++++++++++++
+ 3 files changed, 26 insertions(+), 2 deletions(-)
+
+diff --git a/include/wayland.h b/include/wayland.h
+index 7a077d0d..c25c02ab 100644
+--- a/include/wayland.h
++++ b/include/wayland.h
+@@ -41,6 +41,8 @@ cairo_surface_t *display_buffer_pool_get_next_buffer(display_buffer_pool *pool);
+ void display_surface_commit(cairo_surface_t *surface);
+
+ gboolean display_get_surface_dimensions(int *width, int *height);
+-void display_set_surface_dimensions(int width, int height, int loc);
++void display_set_surface_dimensions(int width, int height,
++ int x_margin, int y_margin,
++ int loc);
+
+ #endif
+diff --git a/source/wayland/display.c b/source/wayland/display.c
+index b8efb9b0..9b1efd33 100644
+--- a/source/wayland/display.c
++++ b/source/wayland/display.c
+@@ -1278,7 +1278,9 @@ gboolean display_get_surface_dimensions(int *width, int *height) {
+ return FALSE;
+ }
+
+-void display_set_surface_dimensions(int width, int height, int loc) {
++void display_set_surface_dimensions(
++ int width, int height, int x_margin, int y_margin, int loc) {
++
+ wayland->layer_width = width;
+ wayland->layer_height = height;
+ zwlr_layer_surface_v1_set_size(wayland->wlr_surface, width, height);
+@@ -1328,6 +1330,14 @@ void display_set_surface_dimensions(int width, int height, int loc) {
+ }
+
+ zwlr_layer_surface_v1_set_anchor(wayland->wlr_surface, wlr_anchor);
++
++ // NOTE: Setting margin for edges we are not anchored to has no effect, so we
++ // can safely set contradictory margins (e.g. top vs bottom) - at most one of
++ // the margins on a given axis will have effect.
++ // This also means that margin has no effect if the window is centered. :(
++ zwlr_layer_surface_v1_set_margin(wayland->wlr_surface,
++ y_margin, -x_margin,
++ -y_margin, x_margin);
+ }
+
+ static void wayland_display_early_cleanup(void) {}
+diff --git a/source/wayland/view.c b/source/wayland/view.c
+index 85a8b010..e6293dd7 100644
+--- a/source/wayland/view.c
++++ b/source/wayland/view.c
+@@ -121,12 +121,24 @@ static int rofi_get_location(RofiViewState *state) {
+ loc_transtable[config.location]);
+ }
+
++static int rofi_get_offset_px(RofiViewState *state, RofiOrientation ori) {
++ char *property = ori == ROFI_ORIENTATION_HORIZONTAL ? "x-offset" : "y-offset";
++
++ RofiDistance offset = rofi_theme_get_distance(WIDGET(state->main_window),
++ property, 0);
++ return distance_get_pixel(offset, ori);
++}
++
+ static void wayland_rofi_view_window_update_size(RofiViewState *state) {
+ if (state == NULL) {
+ return;
+ }
++ int offset_x = rofi_get_offset_px(state, ROFI_ORIENTATION_HORIZONTAL);
++ int offset_y = rofi_get_offset_px(state, ROFI_ORIENTATION_VERTICAL);
++
+ widget_resize(WIDGET(state->main_window), state->width, state->height);
+ display_set_surface_dimensions(state->width, state->height,
++ offset_x, offset_y,
+ rofi_get_location(state));
+ }
+
+--
+2.33.0
+
diff --git a/community/rofi-wayland/APKBUILD b/community/rofi-wayland/APKBUILD
index fffe968124..e6d99bc16b 100644
--- a/community/rofi-wayland/APKBUILD
+++ b/community/rofi-wayland/APKBUILD
@@ -5,7 +5,7 @@ pkgname=rofi-wayland
_projname=rofi
pkgver=1.7.0_p1
_pkgver="${pkgver%_p*}+wayland${pkgver#*_p}"
-pkgrel=1
+pkgrel=2
pkgdesc="Window switcher, run dialog and dmenu replacement - fork with wayland support"
url="https://github.com/lbonn/rofi"
arch="all !s390x !mips !mips64 !riscv64" # limited by librsvg -> rust
@@ -29,6 +29,7 @@ provider_priority=10 # lowest (other provider is rofi aport)
subpackages="$pkgname-dev $pkgname-doc"
source="https://github.com/lbonn/rofi/releases/download/$_pkgver/rofi-$_pkgver.tar.gz
0001-Meson-Fix-version-in-rofi.pc-again.patch
+ 0002-Wayland-Implement-partial-support-for-offset-propert.patch
rofi-sensible-terminal-use-sh.patch
disable-scrollbar-test.patch
"
@@ -56,6 +57,7 @@ package() {
sha512sums="
c76ed0d732ac43d2065a2220952903ea61eba159ff5a2c38a5d6d1f9c267aaad2eda894fec7201e07dc3f6624c382d1208dbcf2a8fab4e656e71c9a2f2ee3ee2 rofi-1.7.0+wayland1.tar.gz
706eac9cb186d80a0e9244dac342049815314c92a6dabfef3ca8f59a2a2078d8c7c564fee0515906799f792a50bec05086fc6fa7575106ec0fd893bf7c214644 0001-Meson-Fix-version-in-rofi.pc-again.patch
+b1724a50d571714e08e9eb124f798cbc4165d6ff2e98ec4efc4a24568d3501d202ddbe4e28fdacd389542a10ba6bcb531230913422017fdd2b0b8bd9312b4e4d 0002-Wayland-Implement-partial-support-for-offset-propert.patch
13a93621337b4f317031da9007ed9d426b055190fc946a87eb12333469f9a23e85763e2c1e0492ff2d1d50ceebd429d8125a0b275d1ab0573a4d10cd812bccd9 rofi-sensible-terminal-use-sh.patch
5d8bd347c119b9cace9ed5a3639cdca396d8daeb418fd541f3dc4ede837307f6142cb1f7b34d44a108051e536a95cae5ef3e49b468d6e8018527567d6d0cb7f4 disable-scrollbar-test.patch
"