Subject: [PATCH] community/ibus: add cursor location patch

From: Drew DeVault <[email-masked]>
Date: Tue, 15 Feb 2022 09:27:34 +0100

References: https://gitlab.alpinelinux.org/alpine/aports/-/issues/13518
---
 community/ibus/APKBUILD                       |  4 ++-
 ...x-wrong-cursor-location-in-gtk3-apps.patch | 30 +++++++++++++++++++
 2 files changed, 33 insertions(+), 1 deletion(-)
 create mode 100644 community/ibus/Fix-wrong-cursor-location-in-gtk3-apps.patch

diff --git a/community/ibus/APKBUILD b/community/ibus/APKBUILD
index 36680e3885..982dd6f797 100644
--- a/community/ibus/APKBUILD
+++ b/community/ibus/APKBUILD
@@ -1,7 +1,7 @@
 # Maintainer: Drew DeVault <[email-masked]>
 pkgname=ibus
 pkgver=1.5.25
-pkgrel=0
+pkgrel=1
 pkgdesc="Next Generation Input Bus for Linux"
 url="https://github.com/ibus/ibus/wiki"
 arch="all"
@@ -25,6 +25,7 @@ subpackages="
 source="
 	$pkgname-$pkgver.tar.gz::https://github.com/ibus/ibus/archive/$pkgver.tar.gz
 	0001-Use-more-portable-call-to-mktemp.patch
+	Fix-wrong-cursor-location-in-gtk3-apps.patch
 "
 install="$pkgname.post-install"
 
@@ -78,4 +79,5 @@ bashcomp() {
 sha512sums="
 128373c6c35c7c8df02fa9e8e5458db6e38a35a7a7debf340c2b21d8e2ec803e3c95ed800211785b13b99210e1877322adb67ce47e5e9ef25e2734487af388fa  ibus-1.5.25.tar.gz
 1e2e62ce52becf75d794c403e8f21bb72e8406aacbdbc5189f62a3b7c54166c40da0032d3f3865f5a23d9d2c782f974b7bcc9ba5ce437d9eb435dd3db3ff0b06  0001-Use-more-portable-call-to-mktemp.patch
+426c261b79d1e6f57527edbc02f10ba01aefd444222638a370ed5213d9667624d608951845cd749ad6f4d6c7d2a17b7d1698147608b60edfb1a1be554fb00534  Fix-wrong-cursor-location-in-gtk3-apps.patch
 "
diff --git a/community/ibus/Fix-wrong-cursor-location-in-gtk3-apps.patch b/community/ibus/Fix-wrong-cursor-location-in-gtk3-apps.patch
new file mode 100644
index 0000000000..1bf43c789c
--- /dev/null
+++ b/community/ibus/Fix-wrong-cursor-location-in-gtk3-apps.patch
@@ -0,0 +1,30 @@
+From 936a0e76df79d92a8bdc03e9205330fb84a2083e Mon Sep 17 00:00:00 2001
+From: Alynx Zhou <[email-masked]>
+Date: Wed, 1 Sep 2021 12:04:12 +0900
+Subject: [PATCH] client/gtk2/ibusimcontext: Fix wrong cursor location in gtk3
+ apps
+
+If you apply this patch in your tarball, please also apply this to
+client/gtk3/ibusimcontext.c besides client/gtk2/ibusimcontext.c .
+
+BUG=https://github.com/ibus/ibus/issues/2337
+---
+ client/gtk2/ibusimcontext.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c
+index da9a402ff..b1ccede95 100644
+--- a/client/gtk2/ibusimcontext.c
++++ b/client/gtk2/ibusimcontext.c
+@@ -1497,7 +1497,10 @@ _set_cursor_location_internal (IBusIMContext *ibusimcontext)
+ 
+ #if GTK_CHECK_VERSION (3, 98, 4)
+ #elif GTK_CHECK_VERSION (2, 91, 0)
+-    area.y += gdk_window_get_height (ibusimcontext->client_window);
++    if (area.x == -1 && area.y == -1 && area.width == 0 && area.height == 0) {
++        area.x = 0;
++        area.y += gdk_window_get_height (ibusimcontext->client_window);
++    }
+ #else
+     if (area.x == -1 && area.y == -1 && area.width == 0 && area.height == 0) {
+         gint w, h;
-- 
2.35.1