Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] New package: keynav-20180821
@ 2022-01-28  9:47 hazen2215
  2022-01-28 10:31 ` [PR PATCH] [Updated] " hazen2215
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: hazen2215 @ 2022-01-28  9:47 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1054 bytes --]

There is a new pull request by hazen2215 against master on the void-packages repository

https://github.com/hazen2215/void-packages keynav
https://github.com/void-linux/void-packages/pull/35271

New package: keynav-20180821
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements): **YES**

<!-- Note: If the build is likely to take more than 2 hours, please [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration)
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, (x86_64-musl)

A patch file from https://github.com/void-linux/void-packages/pull/35271.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-keynav-35271.patch --]
[-- Type: text/x-diff, Size: 9335 bytes --]

From 5c0c81022669c79d5c6de2d67ac0a051c86326c1 Mon Sep 17 00:00:00 2001
From: hazen2215 <haz@disroot.org>
Date: Fri, 28 Jan 2022 18:06:24 +0900
Subject: [PATCH] New package: keynav-20180821

---
 .../patches/fix-cursor-passthrough.patch      | 161 ++++++++++++++++++
 .../patches/fix-overlapping-screens.patch     |  57 +++++++
 srcpkgs/keynav/template                       |  27 +++
 3 files changed, 245 insertions(+)
 create mode 100644 srcpkgs/keynav/patches/fix-cursor-passthrough.patch
 create mode 100644 srcpkgs/keynav/patches/fix-overlapping-screens.patch
 create mode 100644 srcpkgs/keynav/template

diff --git a/srcpkgs/keynav/patches/fix-cursor-passthrough.patch b/srcpkgs/keynav/patches/fix-cursor-passthrough.patch
new file mode 100644
index 000000000000..85fcce7ebb6c
--- /dev/null
+++ b/srcpkgs/keynav/patches/fix-cursor-passthrough.patch
@@ -0,0 +1,161 @@
+From 024fc8fe47454f460faa14cbb1727e04596886c0 Mon Sep 17 00:00:00 2001
+From: jabashque <jabashque@gmail.com>
+Date: Sun, 23 Feb 2020 01:50:36 -0800
+Subject: [PATCH 1/2] Set input shape to 0x0 to passthrough mouse
+
+Define the input shape to be empty so that one cannot click on the grid.
+This resolves all issues where the cursor ends up pointing to the grid
+itself instead of the window under the grid due to openpixel() not being
+called.
+---
+ keynav.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/keynav.c b/keynav.c
+index 65abe7c..4453fc8 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -983,6 +983,9 @@ void cmd_start(char *args) {
+     /* Tell the window manager not to manage us */
+     winattr.override_redirect = 1;
+     XChangeWindowAttributes(dpy, zone, CWOverrideRedirect, &winattr);
++    /* Set the input shape to be nothing so that the mouse can still
++     * click/scroll if on the grid */
++    XShapeCombineRectangles(dpy, zone, ShapeInput, 0, 0, NULL, 0, ShapeSet, 0);
+ 
+     XSelectInput(dpy, zone, StructureNotifyMask | ExposureMask
+                  | PointerMotionMask | LeaveWindowMask );
+
+From 88aba2415bd20e70be91a24e2eb2409cb44b4076 Mon Sep 17 00:00:00 2001
+From: jabashque <jabashque@gmail.com>
+Date: Sun, 23 Feb 2020 04:35:37 -0800
+Subject: [PATCH 2/2] Remove {open,close}pixel(), var mouseinfo, type
+ mouseinfo_t
+
+Input shape is now set to 0x0, which takes care of the functionality
+that {open,close}pixel() previously provided. As such, completely remove
+{open,close}pixel() since they're no longer needed. In addition, remove
+the mouseinfo var and the mouseinfo_t type since those were used only by
+{open,close}pixel().
+---
+ keynav.c | 64 +-------------------------------------------------------
+ 1 file changed, 1 insertion(+), 63 deletions(-)
+
+diff --git a/keynav.c b/keynav.c
+index 4453fc8..fae5a76 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -80,11 +80,6 @@ typedef struct wininfo {
+   int curviewport;
+ } wininfo_t;
+ 
+-typedef struct mouseinfo {
+-  int x;
+-  int y;
+-} mouseinfo_t;
+-
+ typedef struct viewport {
+   int x;
+   int y;
+@@ -96,7 +91,6 @@ typedef struct viewport {
+ } viewport_t;
+ 
+ static wininfo_t wininfo;
+-static mouseinfo_t mouseinfo;
+ static viewport_t *viewports;
+ static int nviewports = 0;
+ static int xinerama = 0;
+@@ -191,8 +185,6 @@ void sighup(int sig);
+ void restart();
+ void recordings_save(const char *filename);
+ void parse_recordings(const char *filename);
+-void openpixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo);
+-void closepixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo);
+ 
+ typedef struct dispatch {
+   char *command;
+@@ -1178,21 +1170,7 @@ void cmd_warp(char *args) {
+   x = wininfo.x + wininfo.w / 2;
+   y = wininfo.y + wininfo.h / 2;
+ 
+-  if (mouseinfo.x != -1 && mouseinfo.y != -1) {
+-    closepixel(dpy, zone, &mouseinfo);
+-  }
+-
+-  /* Open pixels hould be relative to the window coordinates,
+-   * not screen coordinates. */
+-  mouseinfo.x = x - wininfo.x;
+-  mouseinfo.y = y - wininfo.y;
+-  openpixel(dpy, zone, &mouseinfo);
+-
+   xdo_move_mouse(xdo, x, y, viewports[wininfo.curviewport].screen_num);
+-  xdo_wait_for_mouse_move_to(xdo, x, y);
+-
+-  /* TODO(sissel): do we need to open again? */
+-  openpixel(dpy, zone, &mouseinfo);
+ }
+ 
+ void cmd_click(char *args) {
+@@ -1981,36 +1959,6 @@ void parse_recordings(const char *filename) {
+   fclose(fp);
+ }
+ 
+-void openpixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo) {
+-  XRectangle rect;
+-  if (mouseinfo->x == -1 && mouseinfo->y == -1) {
+-    return;
+-  }
+-
+-  rect.x = mouseinfo->x;
+-  rect.y = mouseinfo->y;
+-  rect.width = 1;
+-  rect.height = 1;
+-
+-  XShapeCombineRectangles(dpy, zone, ShapeBounding, 0, 0, &rect, 1,
+-                          ShapeSubtract, 0);
+-} /* void openpixel */
+-
+-void closepixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo) {
+-  XRectangle rect;
+-  if (mouseinfo->x == -1 && mouseinfo->y == -1) {
+-    return;
+-  }
+-
+-  rect.x = mouseinfo->x;
+-  rect.y = mouseinfo->y;
+-  rect.width = 1;
+-  rect.height = 1;
+-
+-  XShapeCombineRectangles(dpy, zone, ShapeBounding, 0, 0, &rect, 1,
+-                          ShapeUnion, 0);
+-} /* void closepixel */
+-
+ int main(int argc, char **argv) {
+   char *pcDisplay;
+   int ret;
+@@ -2099,17 +2047,6 @@ int main(int argc, char **argv) {
+         }
+         break;
+ 
+-      case MotionNotify:
+-        if (zone) {
+-        if (mouseinfo.x != -1 && mouseinfo.y != -1) {
+-          closepixel(dpy, zone, &mouseinfo);
+-        }
+-        mouseinfo.x = e.xmotion.x;
+-        mouseinfo.y = e.xmotion.y;
+-        openpixel(dpy, zone, &mouseinfo);
+-        }
+-        break;
+-
+       // Ignorable events.
+       case GraphicsExpose:
+       case NoExpose:
+@@ -2118,6 +2055,7 @@ int main(int argc, char **argv) {
+       case DestroyNotify: // window was destroyed
+       case UnmapNotify:   // window was unmapped (hidden)
+       case MappingNotify: // when keyboard mapping changes
++      case MotionNotify:  // when mouse movement is detected
+         break;
+       default:
+         if (e.type == xrandr_event_base + RRScreenChangeNotify) {
diff --git a/srcpkgs/keynav/patches/fix-overlapping-screens.patch b/srcpkgs/keynav/patches/fix-overlapping-screens.patch
new file mode 100644
index 000000000000..ea9385b9f7a5
--- /dev/null
+++ b/srcpkgs/keynav/patches/fix-overlapping-screens.patch
@@ -0,0 +1,57 @@
+From b3d7a0966c94ea9b6dd0265c512cb7a14293f71e Mon Sep 17 00:00:00 2001
+From: Yutao Yuan <infmagic2047reg@outlook.com>
+Date: Mon, 4 Oct 2021 22:33:32 +0800
+Subject: [PATCH] Treat overlapping screens (like xrandr --same-as) as one
+ screen
+
+---
+ keynav.c | 33 ++++++++++++++++++++++-----------
+ 1 file changed, 22 insertions(+), 11 deletions(-)
+
+diff --git a/keynav.c b/keynav.c
+index 65abe7c..b4e5103 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -1811,20 +1811,31 @@ void query_screens() {
+ }
+ 
+ void query_screen_xinerama() {
+-  int i;
++  int i, j, num_screens;
+   XineramaScreenInfo *screeninfo;
+ 
+-  screeninfo = XineramaQueryScreens(dpy, &nviewports);
++  screeninfo = XineramaQueryScreens(dpy, &num_screens);
+   free(viewports);
+-  viewports = calloc(nviewports, sizeof(viewport_t));
+-  for (i = 0; i < nviewports; i++) {
+-    viewports[i].x = screeninfo[i].x_org;
+-    viewports[i].y = screeninfo[i].y_org;
+-    viewports[i].w = screeninfo[i].width;
+-    viewports[i].h = screeninfo[i].height;
+-    viewports[i].screen_num = 0;
+-    viewports[i].screen = ScreenOfDisplay(dpy, 0);
+-    viewports[i].root = DefaultRootWindow(dpy);
++  viewports = calloc(num_screens, sizeof(viewport_t));
++  nviewports = 0;
++  for (i = 0; i < num_screens; i++) {
++    int overlapping = 0;
++    for (j = 0; j < nviewports; j++) {
++      if (viewports[j].x == screeninfo[i].x_org && viewports[j].y == screeninfo[i].y_org) {
++        overlapping = 1;
++        break;
++      }
++    }
++    if (!overlapping) {
++      viewports[nviewports].x = screeninfo[i].x_org;
++      viewports[nviewports].y = screeninfo[i].y_org;
++      viewports[nviewports].w = screeninfo[i].width;
++      viewports[nviewports].h = screeninfo[i].height;
++      viewports[nviewports].screen_num = 0;
++      viewports[nviewports].screen = ScreenOfDisplay(dpy, 0);
++      viewports[nviewports].root = DefaultRootWindow(dpy);
++      nviewports++;
++    }
+   }
+   XFree(screeninfo);
+ }
diff --git a/srcpkgs/keynav/template b/srcpkgs/keynav/template
new file mode 100644
index 000000000000..da524caa997f
--- /dev/null
+++ b/srcpkgs/keynav/template
@@ -0,0 +1,27 @@
+# Template file for 'keynav'
+pkgname=keynav
+version=20180821
+revision=1
+_githash="78f9e076a5618aba43b030fbb9344c415c30c1e5"
+wrksrc="${pkgname}-${_githash}"
+build_style=gnu-makefile
+make_use_env=yes
+hostmakedepends="pkg-config perl"
+makedepends="cairo-devel libXinerama-devel xdotool-devel libglib-devel libXrandr-devel "
+checkdepends="xorg-server-xvfb"
+short_desc="Quick way to use cursor via the keyboard"
+maintainer="hazen2215 <haz@disroot.org>"
+license="BSD-3-Clause"
+homepage="https://www.semicomplete.com/projects/keynav/"
+distfiles="https://github.com/jordansissel/keynav/archive/${_githash}.tar.gz"
+checksum=def79c32ea8aec57ec65310ede962f4d5d54ef26c5adccb351a19fb5683b678f
+
+do_check() {
+	./test.sh
+}
+
+do_install() {
+	make PREFIX=${DESTDIR}/usr install
+	vsconf keynavrc
+	vlicense COPYRIGHT
+}

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PR PATCH] [Updated] New package: keynav-20180821
  2022-01-28  9:47 [PR PATCH] New package: keynav-20180821 hazen2215
@ 2022-01-28 10:31 ` hazen2215
  2022-01-28 17:42 ` hazen2215
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: hazen2215 @ 2022-01-28 10:31 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1059 bytes --]

There is an updated pull request by hazen2215 against master on the void-packages repository

https://github.com/hazen2215/void-packages keynav
https://github.com/void-linux/void-packages/pull/35271

New package: keynav-20180821
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements): **YES**

<!-- Note: If the build is likely to take more than 2 hours, please [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration)
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, (x86_64-musl)

A patch file from https://github.com/void-linux/void-packages/pull/35271.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-keynav-35271.patch --]
[-- Type: text/x-diff, Size: 9334 bytes --]

From f618d10109eaeb0c0d9a5ea48cbd32f7e5f66903 Mon Sep 17 00:00:00 2001
From: hazen2215 <haz@disroot.org>
Date: Fri, 28 Jan 2022 18:06:24 +0900
Subject: [PATCH] New package: keynav-20180821

---
 .../patches/fix-cursor-passthrough.patch      | 161 ++++++++++++++++++
 .../patches/fix-overlapping-screens.patch     |  57 +++++++
 srcpkgs/keynav/template                       |  27 +++
 3 files changed, 245 insertions(+)
 create mode 100644 srcpkgs/keynav/patches/fix-cursor-passthrough.patch
 create mode 100644 srcpkgs/keynav/patches/fix-overlapping-screens.patch
 create mode 100644 srcpkgs/keynav/template

diff --git a/srcpkgs/keynav/patches/fix-cursor-passthrough.patch b/srcpkgs/keynav/patches/fix-cursor-passthrough.patch
new file mode 100644
index 000000000000..85fcce7ebb6c
--- /dev/null
+++ b/srcpkgs/keynav/patches/fix-cursor-passthrough.patch
@@ -0,0 +1,161 @@
+From 024fc8fe47454f460faa14cbb1727e04596886c0 Mon Sep 17 00:00:00 2001
+From: jabashque <jabashque@gmail.com>
+Date: Sun, 23 Feb 2020 01:50:36 -0800
+Subject: [PATCH 1/2] Set input shape to 0x0 to passthrough mouse
+
+Define the input shape to be empty so that one cannot click on the grid.
+This resolves all issues where the cursor ends up pointing to the grid
+itself instead of the window under the grid due to openpixel() not being
+called.
+---
+ keynav.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/keynav.c b/keynav.c
+index 65abe7c..4453fc8 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -983,6 +983,9 @@ void cmd_start(char *args) {
+     /* Tell the window manager not to manage us */
+     winattr.override_redirect = 1;
+     XChangeWindowAttributes(dpy, zone, CWOverrideRedirect, &winattr);
++    /* Set the input shape to be nothing so that the mouse can still
++     * click/scroll if on the grid */
++    XShapeCombineRectangles(dpy, zone, ShapeInput, 0, 0, NULL, 0, ShapeSet, 0);
+ 
+     XSelectInput(dpy, zone, StructureNotifyMask | ExposureMask
+                  | PointerMotionMask | LeaveWindowMask );
+
+From 88aba2415bd20e70be91a24e2eb2409cb44b4076 Mon Sep 17 00:00:00 2001
+From: jabashque <jabashque@gmail.com>
+Date: Sun, 23 Feb 2020 04:35:37 -0800
+Subject: [PATCH 2/2] Remove {open,close}pixel(), var mouseinfo, type
+ mouseinfo_t
+
+Input shape is now set to 0x0, which takes care of the functionality
+that {open,close}pixel() previously provided. As such, completely remove
+{open,close}pixel() since they're no longer needed. In addition, remove
+the mouseinfo var and the mouseinfo_t type since those were used only by
+{open,close}pixel().
+---
+ keynav.c | 64 +-------------------------------------------------------
+ 1 file changed, 1 insertion(+), 63 deletions(-)
+
+diff --git a/keynav.c b/keynav.c
+index 4453fc8..fae5a76 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -80,11 +80,6 @@ typedef struct wininfo {
+   int curviewport;
+ } wininfo_t;
+ 
+-typedef struct mouseinfo {
+-  int x;
+-  int y;
+-} mouseinfo_t;
+-
+ typedef struct viewport {
+   int x;
+   int y;
+@@ -96,7 +91,6 @@ typedef struct viewport {
+ } viewport_t;
+ 
+ static wininfo_t wininfo;
+-static mouseinfo_t mouseinfo;
+ static viewport_t *viewports;
+ static int nviewports = 0;
+ static int xinerama = 0;
+@@ -191,8 +185,6 @@ void sighup(int sig);
+ void restart();
+ void recordings_save(const char *filename);
+ void parse_recordings(const char *filename);
+-void openpixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo);
+-void closepixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo);
+ 
+ typedef struct dispatch {
+   char *command;
+@@ -1178,21 +1170,7 @@ void cmd_warp(char *args) {
+   x = wininfo.x + wininfo.w / 2;
+   y = wininfo.y + wininfo.h / 2;
+ 
+-  if (mouseinfo.x != -1 && mouseinfo.y != -1) {
+-    closepixel(dpy, zone, &mouseinfo);
+-  }
+-
+-  /* Open pixels hould be relative to the window coordinates,
+-   * not screen coordinates. */
+-  mouseinfo.x = x - wininfo.x;
+-  mouseinfo.y = y - wininfo.y;
+-  openpixel(dpy, zone, &mouseinfo);
+-
+   xdo_move_mouse(xdo, x, y, viewports[wininfo.curviewport].screen_num);
+-  xdo_wait_for_mouse_move_to(xdo, x, y);
+-
+-  /* TODO(sissel): do we need to open again? */
+-  openpixel(dpy, zone, &mouseinfo);
+ }
+ 
+ void cmd_click(char *args) {
+@@ -1981,36 +1959,6 @@ void parse_recordings(const char *filename) {
+   fclose(fp);
+ }
+ 
+-void openpixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo) {
+-  XRectangle rect;
+-  if (mouseinfo->x == -1 && mouseinfo->y == -1) {
+-    return;
+-  }
+-
+-  rect.x = mouseinfo->x;
+-  rect.y = mouseinfo->y;
+-  rect.width = 1;
+-  rect.height = 1;
+-
+-  XShapeCombineRectangles(dpy, zone, ShapeBounding, 0, 0, &rect, 1,
+-                          ShapeSubtract, 0);
+-} /* void openpixel */
+-
+-void closepixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo) {
+-  XRectangle rect;
+-  if (mouseinfo->x == -1 && mouseinfo->y == -1) {
+-    return;
+-  }
+-
+-  rect.x = mouseinfo->x;
+-  rect.y = mouseinfo->y;
+-  rect.width = 1;
+-  rect.height = 1;
+-
+-  XShapeCombineRectangles(dpy, zone, ShapeBounding, 0, 0, &rect, 1,
+-                          ShapeUnion, 0);
+-} /* void closepixel */
+-
+ int main(int argc, char **argv) {
+   char *pcDisplay;
+   int ret;
+@@ -2099,17 +2047,6 @@ int main(int argc, char **argv) {
+         }
+         break;
+ 
+-      case MotionNotify:
+-        if (zone) {
+-        if (mouseinfo.x != -1 && mouseinfo.y != -1) {
+-          closepixel(dpy, zone, &mouseinfo);
+-        }
+-        mouseinfo.x = e.xmotion.x;
+-        mouseinfo.y = e.xmotion.y;
+-        openpixel(dpy, zone, &mouseinfo);
+-        }
+-        break;
+-
+       // Ignorable events.
+       case GraphicsExpose:
+       case NoExpose:
+@@ -2118,6 +2055,7 @@ int main(int argc, char **argv) {
+       case DestroyNotify: // window was destroyed
+       case UnmapNotify:   // window was unmapped (hidden)
+       case MappingNotify: // when keyboard mapping changes
++      case MotionNotify:  // when mouse movement is detected
+         break;
+       default:
+         if (e.type == xrandr_event_base + RRScreenChangeNotify) {
diff --git a/srcpkgs/keynav/patches/fix-overlapping-screens.patch b/srcpkgs/keynav/patches/fix-overlapping-screens.patch
new file mode 100644
index 000000000000..ea9385b9f7a5
--- /dev/null
+++ b/srcpkgs/keynav/patches/fix-overlapping-screens.patch
@@ -0,0 +1,57 @@
+From b3d7a0966c94ea9b6dd0265c512cb7a14293f71e Mon Sep 17 00:00:00 2001
+From: Yutao Yuan <infmagic2047reg@outlook.com>
+Date: Mon, 4 Oct 2021 22:33:32 +0800
+Subject: [PATCH] Treat overlapping screens (like xrandr --same-as) as one
+ screen
+
+---
+ keynav.c | 33 ++++++++++++++++++++++-----------
+ 1 file changed, 22 insertions(+), 11 deletions(-)
+
+diff --git a/keynav.c b/keynav.c
+index 65abe7c..b4e5103 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -1811,20 +1811,31 @@ void query_screens() {
+ }
+ 
+ void query_screen_xinerama() {
+-  int i;
++  int i, j, num_screens;
+   XineramaScreenInfo *screeninfo;
+ 
+-  screeninfo = XineramaQueryScreens(dpy, &nviewports);
++  screeninfo = XineramaQueryScreens(dpy, &num_screens);
+   free(viewports);
+-  viewports = calloc(nviewports, sizeof(viewport_t));
+-  for (i = 0; i < nviewports; i++) {
+-    viewports[i].x = screeninfo[i].x_org;
+-    viewports[i].y = screeninfo[i].y_org;
+-    viewports[i].w = screeninfo[i].width;
+-    viewports[i].h = screeninfo[i].height;
+-    viewports[i].screen_num = 0;
+-    viewports[i].screen = ScreenOfDisplay(dpy, 0);
+-    viewports[i].root = DefaultRootWindow(dpy);
++  viewports = calloc(num_screens, sizeof(viewport_t));
++  nviewports = 0;
++  for (i = 0; i < num_screens; i++) {
++    int overlapping = 0;
++    for (j = 0; j < nviewports; j++) {
++      if (viewports[j].x == screeninfo[i].x_org && viewports[j].y == screeninfo[i].y_org) {
++        overlapping = 1;
++        break;
++      }
++    }
++    if (!overlapping) {
++      viewports[nviewports].x = screeninfo[i].x_org;
++      viewports[nviewports].y = screeninfo[i].y_org;
++      viewports[nviewports].w = screeninfo[i].width;
++      viewports[nviewports].h = screeninfo[i].height;
++      viewports[nviewports].screen_num = 0;
++      viewports[nviewports].screen = ScreenOfDisplay(dpy, 0);
++      viewports[nviewports].root = DefaultRootWindow(dpy);
++      nviewports++;
++    }
+   }
+   XFree(screeninfo);
+ }
diff --git a/srcpkgs/keynav/template b/srcpkgs/keynav/template
new file mode 100644
index 000000000000..a4c89bd3a776
--- /dev/null
+++ b/srcpkgs/keynav/template
@@ -0,0 +1,27 @@
+# Template file for 'keynav'
+pkgname=keynav
+version=20180821
+revision=1
+_githash="78f9e076a5618aba43b030fbb9344c415c30c1e5"
+wrksrc="${pkgname}-${_githash}"
+build_style=gnu-makefile
+make_use_env=yes
+hostmakedepends="pkg-config perl"
+makedepends="cairo-devel libXinerama-devel xdotool-devel libglib-devel libXrandr-devel"
+checkdepends="xorg-server-xvfb"
+short_desc="Quick way to use cursor via the keyboard"
+maintainer="hazen2215 <haz@disroot.org>"
+license="BSD-3-Clause"
+homepage="https://www.semicomplete.com/projects/keynav/"
+distfiles="https://github.com/jordansissel/keynav/archive/${_githash}.tar.gz"
+checksum=def79c32ea8aec57ec65310ede962f4d5d54ef26c5adccb351a19fb5683b678f
+
+do_check() {
+	./test.sh
+}
+
+do_install() {
+	make PREFIX=${DESTDIR}/usr install
+	vsconf keynavrc
+	vlicense COPYRIGHT
+}

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PR PATCH] [Updated] New package: keynav-20180821
  2022-01-28  9:47 [PR PATCH] New package: keynav-20180821 hazen2215
  2022-01-28 10:31 ` [PR PATCH] [Updated] " hazen2215
@ 2022-01-28 17:42 ` hazen2215
  2022-02-06  4:28 ` hazen2215
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: hazen2215 @ 2022-01-28 17:42 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1059 bytes --]

There is an updated pull request by hazen2215 against master on the void-packages repository

https://github.com/hazen2215/void-packages keynav
https://github.com/void-linux/void-packages/pull/35271

New package: keynav-20180821
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements): **YES**

<!-- Note: If the build is likely to take more than 2 hours, please [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration)
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, (x86_64-musl)

A patch file from https://github.com/void-linux/void-packages/pull/35271.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-keynav-35271.patch --]
[-- Type: text/x-diff, Size: 9332 bytes --]

From 2b6e51c2561cf11e64276067fc566d8baf88db84 Mon Sep 17 00:00:00 2001
From: hazen2215 <haz@disroot.org>
Date: Fri, 28 Jan 2022 18:06:24 +0900
Subject: [PATCH] New package: keynav-20180821

---
 .../patches/fix-cursor-passthrough.patch      | 161 ++++++++++++++++++
 .../patches/fix-overlapping-screens.patch     |  57 +++++++
 srcpkgs/keynav/template                       |  27 +++
 3 files changed, 245 insertions(+)
 create mode 100644 srcpkgs/keynav/patches/fix-cursor-passthrough.patch
 create mode 100644 srcpkgs/keynav/patches/fix-overlapping-screens.patch
 create mode 100644 srcpkgs/keynav/template

diff --git a/srcpkgs/keynav/patches/fix-cursor-passthrough.patch b/srcpkgs/keynav/patches/fix-cursor-passthrough.patch
new file mode 100644
index 000000000000..85fcce7ebb6c
--- /dev/null
+++ b/srcpkgs/keynav/patches/fix-cursor-passthrough.patch
@@ -0,0 +1,161 @@
+From 024fc8fe47454f460faa14cbb1727e04596886c0 Mon Sep 17 00:00:00 2001
+From: jabashque <jabashque@gmail.com>
+Date: Sun, 23 Feb 2020 01:50:36 -0800
+Subject: [PATCH 1/2] Set input shape to 0x0 to passthrough mouse
+
+Define the input shape to be empty so that one cannot click on the grid.
+This resolves all issues where the cursor ends up pointing to the grid
+itself instead of the window under the grid due to openpixel() not being
+called.
+---
+ keynav.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/keynav.c b/keynav.c
+index 65abe7c..4453fc8 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -983,6 +983,9 @@ void cmd_start(char *args) {
+     /* Tell the window manager not to manage us */
+     winattr.override_redirect = 1;
+     XChangeWindowAttributes(dpy, zone, CWOverrideRedirect, &winattr);
++    /* Set the input shape to be nothing so that the mouse can still
++     * click/scroll if on the grid */
++    XShapeCombineRectangles(dpy, zone, ShapeInput, 0, 0, NULL, 0, ShapeSet, 0);
+ 
+     XSelectInput(dpy, zone, StructureNotifyMask | ExposureMask
+                  | PointerMotionMask | LeaveWindowMask );
+
+From 88aba2415bd20e70be91a24e2eb2409cb44b4076 Mon Sep 17 00:00:00 2001
+From: jabashque <jabashque@gmail.com>
+Date: Sun, 23 Feb 2020 04:35:37 -0800
+Subject: [PATCH 2/2] Remove {open,close}pixel(), var mouseinfo, type
+ mouseinfo_t
+
+Input shape is now set to 0x0, which takes care of the functionality
+that {open,close}pixel() previously provided. As such, completely remove
+{open,close}pixel() since they're no longer needed. In addition, remove
+the mouseinfo var and the mouseinfo_t type since those were used only by
+{open,close}pixel().
+---
+ keynav.c | 64 +-------------------------------------------------------
+ 1 file changed, 1 insertion(+), 63 deletions(-)
+
+diff --git a/keynav.c b/keynav.c
+index 4453fc8..fae5a76 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -80,11 +80,6 @@ typedef struct wininfo {
+   int curviewport;
+ } wininfo_t;
+ 
+-typedef struct mouseinfo {
+-  int x;
+-  int y;
+-} mouseinfo_t;
+-
+ typedef struct viewport {
+   int x;
+   int y;
+@@ -96,7 +91,6 @@ typedef struct viewport {
+ } viewport_t;
+ 
+ static wininfo_t wininfo;
+-static mouseinfo_t mouseinfo;
+ static viewport_t *viewports;
+ static int nviewports = 0;
+ static int xinerama = 0;
+@@ -191,8 +185,6 @@ void sighup(int sig);
+ void restart();
+ void recordings_save(const char *filename);
+ void parse_recordings(const char *filename);
+-void openpixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo);
+-void closepixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo);
+ 
+ typedef struct dispatch {
+   char *command;
+@@ -1178,21 +1170,7 @@ void cmd_warp(char *args) {
+   x = wininfo.x + wininfo.w / 2;
+   y = wininfo.y + wininfo.h / 2;
+ 
+-  if (mouseinfo.x != -1 && mouseinfo.y != -1) {
+-    closepixel(dpy, zone, &mouseinfo);
+-  }
+-
+-  /* Open pixels hould be relative to the window coordinates,
+-   * not screen coordinates. */
+-  mouseinfo.x = x - wininfo.x;
+-  mouseinfo.y = y - wininfo.y;
+-  openpixel(dpy, zone, &mouseinfo);
+-
+   xdo_move_mouse(xdo, x, y, viewports[wininfo.curviewport].screen_num);
+-  xdo_wait_for_mouse_move_to(xdo, x, y);
+-
+-  /* TODO(sissel): do we need to open again? */
+-  openpixel(dpy, zone, &mouseinfo);
+ }
+ 
+ void cmd_click(char *args) {
+@@ -1981,36 +1959,6 @@ void parse_recordings(const char *filename) {
+   fclose(fp);
+ }
+ 
+-void openpixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo) {
+-  XRectangle rect;
+-  if (mouseinfo->x == -1 && mouseinfo->y == -1) {
+-    return;
+-  }
+-
+-  rect.x = mouseinfo->x;
+-  rect.y = mouseinfo->y;
+-  rect.width = 1;
+-  rect.height = 1;
+-
+-  XShapeCombineRectangles(dpy, zone, ShapeBounding, 0, 0, &rect, 1,
+-                          ShapeSubtract, 0);
+-} /* void openpixel */
+-
+-void closepixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo) {
+-  XRectangle rect;
+-  if (mouseinfo->x == -1 && mouseinfo->y == -1) {
+-    return;
+-  }
+-
+-  rect.x = mouseinfo->x;
+-  rect.y = mouseinfo->y;
+-  rect.width = 1;
+-  rect.height = 1;
+-
+-  XShapeCombineRectangles(dpy, zone, ShapeBounding, 0, 0, &rect, 1,
+-                          ShapeUnion, 0);
+-} /* void closepixel */
+-
+ int main(int argc, char **argv) {
+   char *pcDisplay;
+   int ret;
+@@ -2099,17 +2047,6 @@ int main(int argc, char **argv) {
+         }
+         break;
+ 
+-      case MotionNotify:
+-        if (zone) {
+-        if (mouseinfo.x != -1 && mouseinfo.y != -1) {
+-          closepixel(dpy, zone, &mouseinfo);
+-        }
+-        mouseinfo.x = e.xmotion.x;
+-        mouseinfo.y = e.xmotion.y;
+-        openpixel(dpy, zone, &mouseinfo);
+-        }
+-        break;
+-
+       // Ignorable events.
+       case GraphicsExpose:
+       case NoExpose:
+@@ -2118,6 +2055,7 @@ int main(int argc, char **argv) {
+       case DestroyNotify: // window was destroyed
+       case UnmapNotify:   // window was unmapped (hidden)
+       case MappingNotify: // when keyboard mapping changes
++      case MotionNotify:  // when mouse movement is detected
+         break;
+       default:
+         if (e.type == xrandr_event_base + RRScreenChangeNotify) {
diff --git a/srcpkgs/keynav/patches/fix-overlapping-screens.patch b/srcpkgs/keynav/patches/fix-overlapping-screens.patch
new file mode 100644
index 000000000000..ea9385b9f7a5
--- /dev/null
+++ b/srcpkgs/keynav/patches/fix-overlapping-screens.patch
@@ -0,0 +1,57 @@
+From b3d7a0966c94ea9b6dd0265c512cb7a14293f71e Mon Sep 17 00:00:00 2001
+From: Yutao Yuan <infmagic2047reg@outlook.com>
+Date: Mon, 4 Oct 2021 22:33:32 +0800
+Subject: [PATCH] Treat overlapping screens (like xrandr --same-as) as one
+ screen
+
+---
+ keynav.c | 33 ++++++++++++++++++++++-----------
+ 1 file changed, 22 insertions(+), 11 deletions(-)
+
+diff --git a/keynav.c b/keynav.c
+index 65abe7c..b4e5103 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -1811,20 +1811,31 @@ void query_screens() {
+ }
+ 
+ void query_screen_xinerama() {
+-  int i;
++  int i, j, num_screens;
+   XineramaScreenInfo *screeninfo;
+ 
+-  screeninfo = XineramaQueryScreens(dpy, &nviewports);
++  screeninfo = XineramaQueryScreens(dpy, &num_screens);
+   free(viewports);
+-  viewports = calloc(nviewports, sizeof(viewport_t));
+-  for (i = 0; i < nviewports; i++) {
+-    viewports[i].x = screeninfo[i].x_org;
+-    viewports[i].y = screeninfo[i].y_org;
+-    viewports[i].w = screeninfo[i].width;
+-    viewports[i].h = screeninfo[i].height;
+-    viewports[i].screen_num = 0;
+-    viewports[i].screen = ScreenOfDisplay(dpy, 0);
+-    viewports[i].root = DefaultRootWindow(dpy);
++  viewports = calloc(num_screens, sizeof(viewport_t));
++  nviewports = 0;
++  for (i = 0; i < num_screens; i++) {
++    int overlapping = 0;
++    for (j = 0; j < nviewports; j++) {
++      if (viewports[j].x == screeninfo[i].x_org && viewports[j].y == screeninfo[i].y_org) {
++        overlapping = 1;
++        break;
++      }
++    }
++    if (!overlapping) {
++      viewports[nviewports].x = screeninfo[i].x_org;
++      viewports[nviewports].y = screeninfo[i].y_org;
++      viewports[nviewports].w = screeninfo[i].width;
++      viewports[nviewports].h = screeninfo[i].height;
++      viewports[nviewports].screen_num = 0;
++      viewports[nviewports].screen = ScreenOfDisplay(dpy, 0);
++      viewports[nviewports].root = DefaultRootWindow(dpy);
++      nviewports++;
++    }
+   }
+   XFree(screeninfo);
+ }
diff --git a/srcpkgs/keynav/template b/srcpkgs/keynav/template
new file mode 100644
index 000000000000..8bdc2e91bf1e
--- /dev/null
+++ b/srcpkgs/keynav/template
@@ -0,0 +1,27 @@
+# Template file for 'keynav'
+pkgname=keynav
+version=20180821
+revision=1
+_githash=78f9e076a5618aba43b030fbb9344c415c30c1e5
+wrksrc="${pkgname}-${_githash}"
+build_style=gnu-makefile
+make_use_env=yes
+hostmakedepends="pkg-config perl"
+makedepends="cairo-devel libXinerama-devel xdotool-devel libglib-devel libXrandr-devel"
+checkdepends="xorg-server-xvfb"
+short_desc="Quick way to use cursor via the keyboard"
+maintainer="hazen2215 <haz@disroot.org>"
+license="BSD-3-Clause"
+homepage="https://www.semicomplete.com/projects/keynav/"
+distfiles="https://github.com/jordansissel/keynav/archive/${_githash}.tar.gz"
+checksum=def79c32ea8aec57ec65310ede962f4d5d54ef26c5adccb351a19fb5683b678f
+
+do_check() {
+	./test.sh
+}
+
+do_install() {
+	make PREFIX=${DESTDIR}/usr install
+	vsconf keynavrc
+	vlicense COPYRIGHT
+}

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PR PATCH] [Updated] New package: keynav-20180821
  2022-01-28  9:47 [PR PATCH] New package: keynav-20180821 hazen2215
  2022-01-28 10:31 ` [PR PATCH] [Updated] " hazen2215
  2022-01-28 17:42 ` hazen2215
@ 2022-02-06  4:28 ` hazen2215
  2022-02-20  7:58 ` hazen2215
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: hazen2215 @ 2022-02-06  4:28 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1059 bytes --]

There is an updated pull request by hazen2215 against master on the void-packages repository

https://github.com/hazen2215/void-packages keynav
https://github.com/void-linux/void-packages/pull/35271

New package: keynav-20180821
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements): **YES**

<!-- Note: If the build is likely to take more than 2 hours, please [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration)
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, (x86_64-musl)

A patch file from https://github.com/void-linux/void-packages/pull/35271.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-keynav-35271.patch --]
[-- Type: text/x-diff, Size: 9332 bytes --]

From 5ee05c06944ad8aef8e667bfc79027dea4d14021 Mon Sep 17 00:00:00 2001
From: hazen2215 <haz@disroot.org>
Date: Fri, 28 Jan 2022 18:06:24 +0900
Subject: [PATCH] New package: keynav-20180821

---
 .../patches/fix-cursor-passthrough.patch      | 161 ++++++++++++++++++
 .../patches/fix-overlapping-screens.patch     |  57 +++++++
 srcpkgs/keynav/template                       |  27 +++
 3 files changed, 245 insertions(+)
 create mode 100644 srcpkgs/keynav/patches/fix-cursor-passthrough.patch
 create mode 100644 srcpkgs/keynav/patches/fix-overlapping-screens.patch
 create mode 100644 srcpkgs/keynav/template

diff --git a/srcpkgs/keynav/patches/fix-cursor-passthrough.patch b/srcpkgs/keynav/patches/fix-cursor-passthrough.patch
new file mode 100644
index 000000000000..85fcce7ebb6c
--- /dev/null
+++ b/srcpkgs/keynav/patches/fix-cursor-passthrough.patch
@@ -0,0 +1,161 @@
+From 024fc8fe47454f460faa14cbb1727e04596886c0 Mon Sep 17 00:00:00 2001
+From: jabashque <jabashque@gmail.com>
+Date: Sun, 23 Feb 2020 01:50:36 -0800
+Subject: [PATCH 1/2] Set input shape to 0x0 to passthrough mouse
+
+Define the input shape to be empty so that one cannot click on the grid.
+This resolves all issues where the cursor ends up pointing to the grid
+itself instead of the window under the grid due to openpixel() not being
+called.
+---
+ keynav.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/keynav.c b/keynav.c
+index 65abe7c..4453fc8 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -983,6 +983,9 @@ void cmd_start(char *args) {
+     /* Tell the window manager not to manage us */
+     winattr.override_redirect = 1;
+     XChangeWindowAttributes(dpy, zone, CWOverrideRedirect, &winattr);
++    /* Set the input shape to be nothing so that the mouse can still
++     * click/scroll if on the grid */
++    XShapeCombineRectangles(dpy, zone, ShapeInput, 0, 0, NULL, 0, ShapeSet, 0);
+ 
+     XSelectInput(dpy, zone, StructureNotifyMask | ExposureMask
+                  | PointerMotionMask | LeaveWindowMask );
+
+From 88aba2415bd20e70be91a24e2eb2409cb44b4076 Mon Sep 17 00:00:00 2001
+From: jabashque <jabashque@gmail.com>
+Date: Sun, 23 Feb 2020 04:35:37 -0800
+Subject: [PATCH 2/2] Remove {open,close}pixel(), var mouseinfo, type
+ mouseinfo_t
+
+Input shape is now set to 0x0, which takes care of the functionality
+that {open,close}pixel() previously provided. As such, completely remove
+{open,close}pixel() since they're no longer needed. In addition, remove
+the mouseinfo var and the mouseinfo_t type since those were used only by
+{open,close}pixel().
+---
+ keynav.c | 64 +-------------------------------------------------------
+ 1 file changed, 1 insertion(+), 63 deletions(-)
+
+diff --git a/keynav.c b/keynav.c
+index 4453fc8..fae5a76 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -80,11 +80,6 @@ typedef struct wininfo {
+   int curviewport;
+ } wininfo_t;
+ 
+-typedef struct mouseinfo {
+-  int x;
+-  int y;
+-} mouseinfo_t;
+-
+ typedef struct viewport {
+   int x;
+   int y;
+@@ -96,7 +91,6 @@ typedef struct viewport {
+ } viewport_t;
+ 
+ static wininfo_t wininfo;
+-static mouseinfo_t mouseinfo;
+ static viewport_t *viewports;
+ static int nviewports = 0;
+ static int xinerama = 0;
+@@ -191,8 +185,6 @@ void sighup(int sig);
+ void restart();
+ void recordings_save(const char *filename);
+ void parse_recordings(const char *filename);
+-void openpixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo);
+-void closepixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo);
+ 
+ typedef struct dispatch {
+   char *command;
+@@ -1178,21 +1170,7 @@ void cmd_warp(char *args) {
+   x = wininfo.x + wininfo.w / 2;
+   y = wininfo.y + wininfo.h / 2;
+ 
+-  if (mouseinfo.x != -1 && mouseinfo.y != -1) {
+-    closepixel(dpy, zone, &mouseinfo);
+-  }
+-
+-  /* Open pixels hould be relative to the window coordinates,
+-   * not screen coordinates. */
+-  mouseinfo.x = x - wininfo.x;
+-  mouseinfo.y = y - wininfo.y;
+-  openpixel(dpy, zone, &mouseinfo);
+-
+   xdo_move_mouse(xdo, x, y, viewports[wininfo.curviewport].screen_num);
+-  xdo_wait_for_mouse_move_to(xdo, x, y);
+-
+-  /* TODO(sissel): do we need to open again? */
+-  openpixel(dpy, zone, &mouseinfo);
+ }
+ 
+ void cmd_click(char *args) {
+@@ -1981,36 +1959,6 @@ void parse_recordings(const char *filename) {
+   fclose(fp);
+ }
+ 
+-void openpixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo) {
+-  XRectangle rect;
+-  if (mouseinfo->x == -1 && mouseinfo->y == -1) {
+-    return;
+-  }
+-
+-  rect.x = mouseinfo->x;
+-  rect.y = mouseinfo->y;
+-  rect.width = 1;
+-  rect.height = 1;
+-
+-  XShapeCombineRectangles(dpy, zone, ShapeBounding, 0, 0, &rect, 1,
+-                          ShapeSubtract, 0);
+-} /* void openpixel */
+-
+-void closepixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo) {
+-  XRectangle rect;
+-  if (mouseinfo->x == -1 && mouseinfo->y == -1) {
+-    return;
+-  }
+-
+-  rect.x = mouseinfo->x;
+-  rect.y = mouseinfo->y;
+-  rect.width = 1;
+-  rect.height = 1;
+-
+-  XShapeCombineRectangles(dpy, zone, ShapeBounding, 0, 0, &rect, 1,
+-                          ShapeUnion, 0);
+-} /* void closepixel */
+-
+ int main(int argc, char **argv) {
+   char *pcDisplay;
+   int ret;
+@@ -2099,17 +2047,6 @@ int main(int argc, char **argv) {
+         }
+         break;
+ 
+-      case MotionNotify:
+-        if (zone) {
+-        if (mouseinfo.x != -1 && mouseinfo.y != -1) {
+-          closepixel(dpy, zone, &mouseinfo);
+-        }
+-        mouseinfo.x = e.xmotion.x;
+-        mouseinfo.y = e.xmotion.y;
+-        openpixel(dpy, zone, &mouseinfo);
+-        }
+-        break;
+-
+       // Ignorable events.
+       case GraphicsExpose:
+       case NoExpose:
+@@ -2118,6 +2055,7 @@ int main(int argc, char **argv) {
+       case DestroyNotify: // window was destroyed
+       case UnmapNotify:   // window was unmapped (hidden)
+       case MappingNotify: // when keyboard mapping changes
++      case MotionNotify:  // when mouse movement is detected
+         break;
+       default:
+         if (e.type == xrandr_event_base + RRScreenChangeNotify) {
diff --git a/srcpkgs/keynav/patches/fix-overlapping-screens.patch b/srcpkgs/keynav/patches/fix-overlapping-screens.patch
new file mode 100644
index 000000000000..ea9385b9f7a5
--- /dev/null
+++ b/srcpkgs/keynav/patches/fix-overlapping-screens.patch
@@ -0,0 +1,57 @@
+From b3d7a0966c94ea9b6dd0265c512cb7a14293f71e Mon Sep 17 00:00:00 2001
+From: Yutao Yuan <infmagic2047reg@outlook.com>
+Date: Mon, 4 Oct 2021 22:33:32 +0800
+Subject: [PATCH] Treat overlapping screens (like xrandr --same-as) as one
+ screen
+
+---
+ keynav.c | 33 ++++++++++++++++++++++-----------
+ 1 file changed, 22 insertions(+), 11 deletions(-)
+
+diff --git a/keynav.c b/keynav.c
+index 65abe7c..b4e5103 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -1811,20 +1811,31 @@ void query_screens() {
+ }
+ 
+ void query_screen_xinerama() {
+-  int i;
++  int i, j, num_screens;
+   XineramaScreenInfo *screeninfo;
+ 
+-  screeninfo = XineramaQueryScreens(dpy, &nviewports);
++  screeninfo = XineramaQueryScreens(dpy, &num_screens);
+   free(viewports);
+-  viewports = calloc(nviewports, sizeof(viewport_t));
+-  for (i = 0; i < nviewports; i++) {
+-    viewports[i].x = screeninfo[i].x_org;
+-    viewports[i].y = screeninfo[i].y_org;
+-    viewports[i].w = screeninfo[i].width;
+-    viewports[i].h = screeninfo[i].height;
+-    viewports[i].screen_num = 0;
+-    viewports[i].screen = ScreenOfDisplay(dpy, 0);
+-    viewports[i].root = DefaultRootWindow(dpy);
++  viewports = calloc(num_screens, sizeof(viewport_t));
++  nviewports = 0;
++  for (i = 0; i < num_screens; i++) {
++    int overlapping = 0;
++    for (j = 0; j < nviewports; j++) {
++      if (viewports[j].x == screeninfo[i].x_org && viewports[j].y == screeninfo[i].y_org) {
++        overlapping = 1;
++        break;
++      }
++    }
++    if (!overlapping) {
++      viewports[nviewports].x = screeninfo[i].x_org;
++      viewports[nviewports].y = screeninfo[i].y_org;
++      viewports[nviewports].w = screeninfo[i].width;
++      viewports[nviewports].h = screeninfo[i].height;
++      viewports[nviewports].screen_num = 0;
++      viewports[nviewports].screen = ScreenOfDisplay(dpy, 0);
++      viewports[nviewports].root = DefaultRootWindow(dpy);
++      nviewports++;
++    }
+   }
+   XFree(screeninfo);
+ }
diff --git a/srcpkgs/keynav/template b/srcpkgs/keynav/template
new file mode 100644
index 000000000000..8bdc2e91bf1e
--- /dev/null
+++ b/srcpkgs/keynav/template
@@ -0,0 +1,27 @@
+# Template file for 'keynav'
+pkgname=keynav
+version=20180821
+revision=1
+_githash=78f9e076a5618aba43b030fbb9344c415c30c1e5
+wrksrc="${pkgname}-${_githash}"
+build_style=gnu-makefile
+make_use_env=yes
+hostmakedepends="pkg-config perl"
+makedepends="cairo-devel libXinerama-devel xdotool-devel libglib-devel libXrandr-devel"
+checkdepends="xorg-server-xvfb"
+short_desc="Quick way to use cursor via the keyboard"
+maintainer="hazen2215 <haz@disroot.org>"
+license="BSD-3-Clause"
+homepage="https://www.semicomplete.com/projects/keynav/"
+distfiles="https://github.com/jordansissel/keynav/archive/${_githash}.tar.gz"
+checksum=def79c32ea8aec57ec65310ede962f4d5d54ef26c5adccb351a19fb5683b678f
+
+do_check() {
+	./test.sh
+}
+
+do_install() {
+	make PREFIX=${DESTDIR}/usr install
+	vsconf keynavrc
+	vlicense COPYRIGHT
+}

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PR PATCH] [Updated] New package: keynav-20180821
  2022-01-28  9:47 [PR PATCH] New package: keynav-20180821 hazen2215
                   ` (2 preceding siblings ...)
  2022-02-06  4:28 ` hazen2215
@ 2022-02-20  7:58 ` hazen2215
  2022-02-20 21:03 ` [PR REVIEW] " Duncaen
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: hazen2215 @ 2022-02-20  7:58 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1059 bytes --]

There is an updated pull request by hazen2215 against master on the void-packages repository

https://github.com/hazen2215/void-packages keynav
https://github.com/void-linux/void-packages/pull/35271

New package: keynav-20180821
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements): **YES**

<!-- Note: If the build is likely to take more than 2 hours, please [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration)
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, (x86_64-musl)

A patch file from https://github.com/void-linux/void-packages/pull/35271.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-keynav-35271.patch --]
[-- Type: text/x-diff, Size: 9332 bytes --]

From 5a4f3d0099a216eb9f5fa0c3a8f26e86beaf1180 Mon Sep 17 00:00:00 2001
From: hazen2215 <haz@disroot.org>
Date: Fri, 28 Jan 2022 18:06:24 +0900
Subject: [PATCH] New package: keynav-20180821

---
 .../patches/fix-cursor-passthrough.patch      | 161 ++++++++++++++++++
 .../patches/fix-overlapping-screens.patch     |  57 +++++++
 srcpkgs/keynav/template                       |  27 +++
 3 files changed, 245 insertions(+)
 create mode 100644 srcpkgs/keynav/patches/fix-cursor-passthrough.patch
 create mode 100644 srcpkgs/keynav/patches/fix-overlapping-screens.patch
 create mode 100644 srcpkgs/keynav/template

diff --git a/srcpkgs/keynav/patches/fix-cursor-passthrough.patch b/srcpkgs/keynav/patches/fix-cursor-passthrough.patch
new file mode 100644
index 000000000000..85fcce7ebb6c
--- /dev/null
+++ b/srcpkgs/keynav/patches/fix-cursor-passthrough.patch
@@ -0,0 +1,161 @@
+From 024fc8fe47454f460faa14cbb1727e04596886c0 Mon Sep 17 00:00:00 2001
+From: jabashque <jabashque@gmail.com>
+Date: Sun, 23 Feb 2020 01:50:36 -0800
+Subject: [PATCH 1/2] Set input shape to 0x0 to passthrough mouse
+
+Define the input shape to be empty so that one cannot click on the grid.
+This resolves all issues where the cursor ends up pointing to the grid
+itself instead of the window under the grid due to openpixel() not being
+called.
+---
+ keynav.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/keynav.c b/keynav.c
+index 65abe7c..4453fc8 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -983,6 +983,9 @@ void cmd_start(char *args) {
+     /* Tell the window manager not to manage us */
+     winattr.override_redirect = 1;
+     XChangeWindowAttributes(dpy, zone, CWOverrideRedirect, &winattr);
++    /* Set the input shape to be nothing so that the mouse can still
++     * click/scroll if on the grid */
++    XShapeCombineRectangles(dpy, zone, ShapeInput, 0, 0, NULL, 0, ShapeSet, 0);
+ 
+     XSelectInput(dpy, zone, StructureNotifyMask | ExposureMask
+                  | PointerMotionMask | LeaveWindowMask );
+
+From 88aba2415bd20e70be91a24e2eb2409cb44b4076 Mon Sep 17 00:00:00 2001
+From: jabashque <jabashque@gmail.com>
+Date: Sun, 23 Feb 2020 04:35:37 -0800
+Subject: [PATCH 2/2] Remove {open,close}pixel(), var mouseinfo, type
+ mouseinfo_t
+
+Input shape is now set to 0x0, which takes care of the functionality
+that {open,close}pixel() previously provided. As such, completely remove
+{open,close}pixel() since they're no longer needed. In addition, remove
+the mouseinfo var and the mouseinfo_t type since those were used only by
+{open,close}pixel().
+---
+ keynav.c | 64 +-------------------------------------------------------
+ 1 file changed, 1 insertion(+), 63 deletions(-)
+
+diff --git a/keynav.c b/keynav.c
+index 4453fc8..fae5a76 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -80,11 +80,6 @@ typedef struct wininfo {
+   int curviewport;
+ } wininfo_t;
+ 
+-typedef struct mouseinfo {
+-  int x;
+-  int y;
+-} mouseinfo_t;
+-
+ typedef struct viewport {
+   int x;
+   int y;
+@@ -96,7 +91,6 @@ typedef struct viewport {
+ } viewport_t;
+ 
+ static wininfo_t wininfo;
+-static mouseinfo_t mouseinfo;
+ static viewport_t *viewports;
+ static int nviewports = 0;
+ static int xinerama = 0;
+@@ -191,8 +185,6 @@ void sighup(int sig);
+ void restart();
+ void recordings_save(const char *filename);
+ void parse_recordings(const char *filename);
+-void openpixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo);
+-void closepixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo);
+ 
+ typedef struct dispatch {
+   char *command;
+@@ -1178,21 +1170,7 @@ void cmd_warp(char *args) {
+   x = wininfo.x + wininfo.w / 2;
+   y = wininfo.y + wininfo.h / 2;
+ 
+-  if (mouseinfo.x != -1 && mouseinfo.y != -1) {
+-    closepixel(dpy, zone, &mouseinfo);
+-  }
+-
+-  /* Open pixels hould be relative to the window coordinates,
+-   * not screen coordinates. */
+-  mouseinfo.x = x - wininfo.x;
+-  mouseinfo.y = y - wininfo.y;
+-  openpixel(dpy, zone, &mouseinfo);
+-
+   xdo_move_mouse(xdo, x, y, viewports[wininfo.curviewport].screen_num);
+-  xdo_wait_for_mouse_move_to(xdo, x, y);
+-
+-  /* TODO(sissel): do we need to open again? */
+-  openpixel(dpy, zone, &mouseinfo);
+ }
+ 
+ void cmd_click(char *args) {
+@@ -1981,36 +1959,6 @@ void parse_recordings(const char *filename) {
+   fclose(fp);
+ }
+ 
+-void openpixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo) {
+-  XRectangle rect;
+-  if (mouseinfo->x == -1 && mouseinfo->y == -1) {
+-    return;
+-  }
+-
+-  rect.x = mouseinfo->x;
+-  rect.y = mouseinfo->y;
+-  rect.width = 1;
+-  rect.height = 1;
+-
+-  XShapeCombineRectangles(dpy, zone, ShapeBounding, 0, 0, &rect, 1,
+-                          ShapeSubtract, 0);
+-} /* void openpixel */
+-
+-void closepixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo) {
+-  XRectangle rect;
+-  if (mouseinfo->x == -1 && mouseinfo->y == -1) {
+-    return;
+-  }
+-
+-  rect.x = mouseinfo->x;
+-  rect.y = mouseinfo->y;
+-  rect.width = 1;
+-  rect.height = 1;
+-
+-  XShapeCombineRectangles(dpy, zone, ShapeBounding, 0, 0, &rect, 1,
+-                          ShapeUnion, 0);
+-} /* void closepixel */
+-
+ int main(int argc, char **argv) {
+   char *pcDisplay;
+   int ret;
+@@ -2099,17 +2047,6 @@ int main(int argc, char **argv) {
+         }
+         break;
+ 
+-      case MotionNotify:
+-        if (zone) {
+-        if (mouseinfo.x != -1 && mouseinfo.y != -1) {
+-          closepixel(dpy, zone, &mouseinfo);
+-        }
+-        mouseinfo.x = e.xmotion.x;
+-        mouseinfo.y = e.xmotion.y;
+-        openpixel(dpy, zone, &mouseinfo);
+-        }
+-        break;
+-
+       // Ignorable events.
+       case GraphicsExpose:
+       case NoExpose:
+@@ -2118,6 +2055,7 @@ int main(int argc, char **argv) {
+       case DestroyNotify: // window was destroyed
+       case UnmapNotify:   // window was unmapped (hidden)
+       case MappingNotify: // when keyboard mapping changes
++      case MotionNotify:  // when mouse movement is detected
+         break;
+       default:
+         if (e.type == xrandr_event_base + RRScreenChangeNotify) {
diff --git a/srcpkgs/keynav/patches/fix-overlapping-screens.patch b/srcpkgs/keynav/patches/fix-overlapping-screens.patch
new file mode 100644
index 000000000000..ea9385b9f7a5
--- /dev/null
+++ b/srcpkgs/keynav/patches/fix-overlapping-screens.patch
@@ -0,0 +1,57 @@
+From b3d7a0966c94ea9b6dd0265c512cb7a14293f71e Mon Sep 17 00:00:00 2001
+From: Yutao Yuan <infmagic2047reg@outlook.com>
+Date: Mon, 4 Oct 2021 22:33:32 +0800
+Subject: [PATCH] Treat overlapping screens (like xrandr --same-as) as one
+ screen
+
+---
+ keynav.c | 33 ++++++++++++++++++++++-----------
+ 1 file changed, 22 insertions(+), 11 deletions(-)
+
+diff --git a/keynav.c b/keynav.c
+index 65abe7c..b4e5103 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -1811,20 +1811,31 @@ void query_screens() {
+ }
+ 
+ void query_screen_xinerama() {
+-  int i;
++  int i, j, num_screens;
+   XineramaScreenInfo *screeninfo;
+ 
+-  screeninfo = XineramaQueryScreens(dpy, &nviewports);
++  screeninfo = XineramaQueryScreens(dpy, &num_screens);
+   free(viewports);
+-  viewports = calloc(nviewports, sizeof(viewport_t));
+-  for (i = 0; i < nviewports; i++) {
+-    viewports[i].x = screeninfo[i].x_org;
+-    viewports[i].y = screeninfo[i].y_org;
+-    viewports[i].w = screeninfo[i].width;
+-    viewports[i].h = screeninfo[i].height;
+-    viewports[i].screen_num = 0;
+-    viewports[i].screen = ScreenOfDisplay(dpy, 0);
+-    viewports[i].root = DefaultRootWindow(dpy);
++  viewports = calloc(num_screens, sizeof(viewport_t));
++  nviewports = 0;
++  for (i = 0; i < num_screens; i++) {
++    int overlapping = 0;
++    for (j = 0; j < nviewports; j++) {
++      if (viewports[j].x == screeninfo[i].x_org && viewports[j].y == screeninfo[i].y_org) {
++        overlapping = 1;
++        break;
++      }
++    }
++    if (!overlapping) {
++      viewports[nviewports].x = screeninfo[i].x_org;
++      viewports[nviewports].y = screeninfo[i].y_org;
++      viewports[nviewports].w = screeninfo[i].width;
++      viewports[nviewports].h = screeninfo[i].height;
++      viewports[nviewports].screen_num = 0;
++      viewports[nviewports].screen = ScreenOfDisplay(dpy, 0);
++      viewports[nviewports].root = DefaultRootWindow(dpy);
++      nviewports++;
++    }
+   }
+   XFree(screeninfo);
+ }
diff --git a/srcpkgs/keynav/template b/srcpkgs/keynav/template
new file mode 100644
index 000000000000..8bdc2e91bf1e
--- /dev/null
+++ b/srcpkgs/keynav/template
@@ -0,0 +1,27 @@
+# Template file for 'keynav'
+pkgname=keynav
+version=20180821
+revision=1
+_githash=78f9e076a5618aba43b030fbb9344c415c30c1e5
+wrksrc="${pkgname}-${_githash}"
+build_style=gnu-makefile
+make_use_env=yes
+hostmakedepends="pkg-config perl"
+makedepends="cairo-devel libXinerama-devel xdotool-devel libglib-devel libXrandr-devel"
+checkdepends="xorg-server-xvfb"
+short_desc="Quick way to use cursor via the keyboard"
+maintainer="hazen2215 <haz@disroot.org>"
+license="BSD-3-Clause"
+homepage="https://www.semicomplete.com/projects/keynav/"
+distfiles="https://github.com/jordansissel/keynav/archive/${_githash}.tar.gz"
+checksum=def79c32ea8aec57ec65310ede962f4d5d54ef26c5adccb351a19fb5683b678f
+
+do_check() {
+	./test.sh
+}
+
+do_install() {
+	make PREFIX=${DESTDIR}/usr install
+	vsconf keynavrc
+	vlicense COPYRIGHT
+}

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PR REVIEW] New package: keynav-20180821
  2022-01-28  9:47 [PR PATCH] New package: keynav-20180821 hazen2215
                   ` (3 preceding siblings ...)
  2022-02-20  7:58 ` hazen2215
@ 2022-02-20 21:03 ` Duncaen
  2022-02-21  7:39 ` [PR PATCH] [Updated] " hazen2215
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: Duncaen @ 2022-02-20 21:03 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 246 bytes --]

New review comment by Duncaen on void-packages repository

https://github.com/void-linux/void-packages/pull/35271#discussion_r810684123

Comment:
use something like `0.0.20180821` to avoid having to revert all version if they ever tag a release.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PR PATCH] [Updated] New package: keynav-20180821
  2022-01-28  9:47 [PR PATCH] New package: keynav-20180821 hazen2215
                   ` (4 preceding siblings ...)
  2022-02-20 21:03 ` [PR REVIEW] " Duncaen
@ 2022-02-21  7:39 ` hazen2215
  2022-02-21  7:42 ` hazen2215
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: hazen2215 @ 2022-02-21  7:39 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1059 bytes --]

There is an updated pull request by hazen2215 against master on the void-packages repository

https://github.com/hazen2215/void-packages keynav
https://github.com/void-linux/void-packages/pull/35271

New package: keynav-20180821
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements): **YES**

<!-- Note: If the build is likely to take more than 2 hours, please [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration)
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, (x86_64-musl)

A patch file from https://github.com/void-linux/void-packages/pull/35271.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-keynav-35271.patch --]
[-- Type: text/x-diff, Size: 9336 bytes --]

From 12ad80388257b80ee442512b5205d684406a37f6 Mon Sep 17 00:00:00 2001
From: hazen2215 <haz@disroot.org>
Date: Fri, 28 Jan 2022 18:06:24 +0900
Subject: [PATCH] New package: keynav-20180821

---
 .../patches/fix-cursor-passthrough.patch      | 161 ++++++++++++++++++
 .../patches/fix-overlapping-screens.patch     |  57 +++++++
 srcpkgs/keynav/template                       |  27 +++
 3 files changed, 245 insertions(+)
 create mode 100644 srcpkgs/keynav/patches/fix-cursor-passthrough.patch
 create mode 100644 srcpkgs/keynav/patches/fix-overlapping-screens.patch
 create mode 100644 srcpkgs/keynav/template

diff --git a/srcpkgs/keynav/patches/fix-cursor-passthrough.patch b/srcpkgs/keynav/patches/fix-cursor-passthrough.patch
new file mode 100644
index 000000000000..85fcce7ebb6c
--- /dev/null
+++ b/srcpkgs/keynav/patches/fix-cursor-passthrough.patch
@@ -0,0 +1,161 @@
+From 024fc8fe47454f460faa14cbb1727e04596886c0 Mon Sep 17 00:00:00 2001
+From: jabashque <jabashque@gmail.com>
+Date: Sun, 23 Feb 2020 01:50:36 -0800
+Subject: [PATCH 1/2] Set input shape to 0x0 to passthrough mouse
+
+Define the input shape to be empty so that one cannot click on the grid.
+This resolves all issues where the cursor ends up pointing to the grid
+itself instead of the window under the grid due to openpixel() not being
+called.
+---
+ keynav.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/keynav.c b/keynav.c
+index 65abe7c..4453fc8 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -983,6 +983,9 @@ void cmd_start(char *args) {
+     /* Tell the window manager not to manage us */
+     winattr.override_redirect = 1;
+     XChangeWindowAttributes(dpy, zone, CWOverrideRedirect, &winattr);
++    /* Set the input shape to be nothing so that the mouse can still
++     * click/scroll if on the grid */
++    XShapeCombineRectangles(dpy, zone, ShapeInput, 0, 0, NULL, 0, ShapeSet, 0);
+ 
+     XSelectInput(dpy, zone, StructureNotifyMask | ExposureMask
+                  | PointerMotionMask | LeaveWindowMask );
+
+From 88aba2415bd20e70be91a24e2eb2409cb44b4076 Mon Sep 17 00:00:00 2001
+From: jabashque <jabashque@gmail.com>
+Date: Sun, 23 Feb 2020 04:35:37 -0800
+Subject: [PATCH 2/2] Remove {open,close}pixel(), var mouseinfo, type
+ mouseinfo_t
+
+Input shape is now set to 0x0, which takes care of the functionality
+that {open,close}pixel() previously provided. As such, completely remove
+{open,close}pixel() since they're no longer needed. In addition, remove
+the mouseinfo var and the mouseinfo_t type since those were used only by
+{open,close}pixel().
+---
+ keynav.c | 64 +-------------------------------------------------------
+ 1 file changed, 1 insertion(+), 63 deletions(-)
+
+diff --git a/keynav.c b/keynav.c
+index 4453fc8..fae5a76 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -80,11 +80,6 @@ typedef struct wininfo {
+   int curviewport;
+ } wininfo_t;
+ 
+-typedef struct mouseinfo {
+-  int x;
+-  int y;
+-} mouseinfo_t;
+-
+ typedef struct viewport {
+   int x;
+   int y;
+@@ -96,7 +91,6 @@ typedef struct viewport {
+ } viewport_t;
+ 
+ static wininfo_t wininfo;
+-static mouseinfo_t mouseinfo;
+ static viewport_t *viewports;
+ static int nviewports = 0;
+ static int xinerama = 0;
+@@ -191,8 +185,6 @@ void sighup(int sig);
+ void restart();
+ void recordings_save(const char *filename);
+ void parse_recordings(const char *filename);
+-void openpixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo);
+-void closepixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo);
+ 
+ typedef struct dispatch {
+   char *command;
+@@ -1178,21 +1170,7 @@ void cmd_warp(char *args) {
+   x = wininfo.x + wininfo.w / 2;
+   y = wininfo.y + wininfo.h / 2;
+ 
+-  if (mouseinfo.x != -1 && mouseinfo.y != -1) {
+-    closepixel(dpy, zone, &mouseinfo);
+-  }
+-
+-  /* Open pixels hould be relative to the window coordinates,
+-   * not screen coordinates. */
+-  mouseinfo.x = x - wininfo.x;
+-  mouseinfo.y = y - wininfo.y;
+-  openpixel(dpy, zone, &mouseinfo);
+-
+   xdo_move_mouse(xdo, x, y, viewports[wininfo.curviewport].screen_num);
+-  xdo_wait_for_mouse_move_to(xdo, x, y);
+-
+-  /* TODO(sissel): do we need to open again? */
+-  openpixel(dpy, zone, &mouseinfo);
+ }
+ 
+ void cmd_click(char *args) {
+@@ -1981,36 +1959,6 @@ void parse_recordings(const char *filename) {
+   fclose(fp);
+ }
+ 
+-void openpixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo) {
+-  XRectangle rect;
+-  if (mouseinfo->x == -1 && mouseinfo->y == -1) {
+-    return;
+-  }
+-
+-  rect.x = mouseinfo->x;
+-  rect.y = mouseinfo->y;
+-  rect.width = 1;
+-  rect.height = 1;
+-
+-  XShapeCombineRectangles(dpy, zone, ShapeBounding, 0, 0, &rect, 1,
+-                          ShapeSubtract, 0);
+-} /* void openpixel */
+-
+-void closepixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo) {
+-  XRectangle rect;
+-  if (mouseinfo->x == -1 && mouseinfo->y == -1) {
+-    return;
+-  }
+-
+-  rect.x = mouseinfo->x;
+-  rect.y = mouseinfo->y;
+-  rect.width = 1;
+-  rect.height = 1;
+-
+-  XShapeCombineRectangles(dpy, zone, ShapeBounding, 0, 0, &rect, 1,
+-                          ShapeUnion, 0);
+-} /* void closepixel */
+-
+ int main(int argc, char **argv) {
+   char *pcDisplay;
+   int ret;
+@@ -2099,17 +2047,6 @@ int main(int argc, char **argv) {
+         }
+         break;
+ 
+-      case MotionNotify:
+-        if (zone) {
+-        if (mouseinfo.x != -1 && mouseinfo.y != -1) {
+-          closepixel(dpy, zone, &mouseinfo);
+-        }
+-        mouseinfo.x = e.xmotion.x;
+-        mouseinfo.y = e.xmotion.y;
+-        openpixel(dpy, zone, &mouseinfo);
+-        }
+-        break;
+-
+       // Ignorable events.
+       case GraphicsExpose:
+       case NoExpose:
+@@ -2118,6 +2055,7 @@ int main(int argc, char **argv) {
+       case DestroyNotify: // window was destroyed
+       case UnmapNotify:   // window was unmapped (hidden)
+       case MappingNotify: // when keyboard mapping changes
++      case MotionNotify:  // when mouse movement is detected
+         break;
+       default:
+         if (e.type == xrandr_event_base + RRScreenChangeNotify) {
diff --git a/srcpkgs/keynav/patches/fix-overlapping-screens.patch b/srcpkgs/keynav/patches/fix-overlapping-screens.patch
new file mode 100644
index 000000000000..ea9385b9f7a5
--- /dev/null
+++ b/srcpkgs/keynav/patches/fix-overlapping-screens.patch
@@ -0,0 +1,57 @@
+From b3d7a0966c94ea9b6dd0265c512cb7a14293f71e Mon Sep 17 00:00:00 2001
+From: Yutao Yuan <infmagic2047reg@outlook.com>
+Date: Mon, 4 Oct 2021 22:33:32 +0800
+Subject: [PATCH] Treat overlapping screens (like xrandr --same-as) as one
+ screen
+
+---
+ keynav.c | 33 ++++++++++++++++++++++-----------
+ 1 file changed, 22 insertions(+), 11 deletions(-)
+
+diff --git a/keynav.c b/keynav.c
+index 65abe7c..b4e5103 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -1811,20 +1811,31 @@ void query_screens() {
+ }
+ 
+ void query_screen_xinerama() {
+-  int i;
++  int i, j, num_screens;
+   XineramaScreenInfo *screeninfo;
+ 
+-  screeninfo = XineramaQueryScreens(dpy, &nviewports);
++  screeninfo = XineramaQueryScreens(dpy, &num_screens);
+   free(viewports);
+-  viewports = calloc(nviewports, sizeof(viewport_t));
+-  for (i = 0; i < nviewports; i++) {
+-    viewports[i].x = screeninfo[i].x_org;
+-    viewports[i].y = screeninfo[i].y_org;
+-    viewports[i].w = screeninfo[i].width;
+-    viewports[i].h = screeninfo[i].height;
+-    viewports[i].screen_num = 0;
+-    viewports[i].screen = ScreenOfDisplay(dpy, 0);
+-    viewports[i].root = DefaultRootWindow(dpy);
++  viewports = calloc(num_screens, sizeof(viewport_t));
++  nviewports = 0;
++  for (i = 0; i < num_screens; i++) {
++    int overlapping = 0;
++    for (j = 0; j < nviewports; j++) {
++      if (viewports[j].x == screeninfo[i].x_org && viewports[j].y == screeninfo[i].y_org) {
++        overlapping = 1;
++        break;
++      }
++    }
++    if (!overlapping) {
++      viewports[nviewports].x = screeninfo[i].x_org;
++      viewports[nviewports].y = screeninfo[i].y_org;
++      viewports[nviewports].w = screeninfo[i].width;
++      viewports[nviewports].h = screeninfo[i].height;
++      viewports[nviewports].screen_num = 0;
++      viewports[nviewports].screen = ScreenOfDisplay(dpy, 0);
++      viewports[nviewports].root = DefaultRootWindow(dpy);
++      nviewports++;
++    }
+   }
+   XFree(screeninfo);
+ }
diff --git a/srcpkgs/keynav/template b/srcpkgs/keynav/template
new file mode 100644
index 000000000000..f5f2b5f67452
--- /dev/null
+++ b/srcpkgs/keynav/template
@@ -0,0 +1,27 @@
+# Template file for 'keynav'
+pkgname=keynav
+version=0.0.20180821
+revision=1
+_githash=78f9e076a5618aba43b030fbb9344c415c30c1e5
+wrksrc="${pkgname}-${_githash}"
+build_style=gnu-makefile
+make_use_env=yes
+hostmakedepends="pkg-config perl"
+makedepends="cairo-devel libXinerama-devel xdotool-devel libglib-devel libXrandr-devel"
+checkdepends="xorg-server-xvfb"
+short_desc="Quick way to use cursor via the keyboard"
+maintainer="hazen2215 <haz@disroot.org>"
+license="BSD-3-Clause"
+homepage="https://www.semicomplete.com/projects/keynav/"
+distfiles="https://github.com/jordansissel/keynav/archive/${_githash}.tar.gz"
+checksum=def79c32ea8aec57ec65310ede962f4d5d54ef26c5adccb351a19fb5683b678f
+
+do_check() {
+	./test.sh
+}
+
+do_install() {
+	make PREFIX=${DESTDIR}/usr install
+	vsconf keynavrc
+	vlicense COPYRIGHT
+}

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PR PATCH] [Updated] New package: keynav-20180821
  2022-01-28  9:47 [PR PATCH] New package: keynav-20180821 hazen2215
                   ` (5 preceding siblings ...)
  2022-02-21  7:39 ` [PR PATCH] [Updated] " hazen2215
@ 2022-02-21  7:42 ` hazen2215
  2022-02-21  7:45 ` New package: keynav-0.0.20180821 hazen2215
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: hazen2215 @ 2022-02-21  7:42 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1059 bytes --]

There is an updated pull request by hazen2215 against master on the void-packages repository

https://github.com/hazen2215/void-packages keynav
https://github.com/void-linux/void-packages/pull/35271

New package: keynav-20180821
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements): **YES**

<!-- Note: If the build is likely to take more than 2 hours, please [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration)
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, (x86_64-musl)

A patch file from https://github.com/void-linux/void-packages/pull/35271.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-keynav-35271.patch --]
[-- Type: text/x-diff, Size: 9340 bytes --]

From de0043b926ba6affdc6348bbed51b7b13bbe0583 Mon Sep 17 00:00:00 2001
From: hazen2215 <haz@disroot.org>
Date: Fri, 28 Jan 2022 18:06:24 +0900
Subject: [PATCH] New package: keynav-0.0.20180821

---
 .../patches/fix-cursor-passthrough.patch      | 161 ++++++++++++++++++
 .../patches/fix-overlapping-screens.patch     |  57 +++++++
 srcpkgs/keynav/template                       |  27 +++
 3 files changed, 245 insertions(+)
 create mode 100644 srcpkgs/keynav/patches/fix-cursor-passthrough.patch
 create mode 100644 srcpkgs/keynav/patches/fix-overlapping-screens.patch
 create mode 100644 srcpkgs/keynav/template

diff --git a/srcpkgs/keynav/patches/fix-cursor-passthrough.patch b/srcpkgs/keynav/patches/fix-cursor-passthrough.patch
new file mode 100644
index 000000000000..85fcce7ebb6c
--- /dev/null
+++ b/srcpkgs/keynav/patches/fix-cursor-passthrough.patch
@@ -0,0 +1,161 @@
+From 024fc8fe47454f460faa14cbb1727e04596886c0 Mon Sep 17 00:00:00 2001
+From: jabashque <jabashque@gmail.com>
+Date: Sun, 23 Feb 2020 01:50:36 -0800
+Subject: [PATCH 1/2] Set input shape to 0x0 to passthrough mouse
+
+Define the input shape to be empty so that one cannot click on the grid.
+This resolves all issues where the cursor ends up pointing to the grid
+itself instead of the window under the grid due to openpixel() not being
+called.
+---
+ keynav.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/keynav.c b/keynav.c
+index 65abe7c..4453fc8 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -983,6 +983,9 @@ void cmd_start(char *args) {
+     /* Tell the window manager not to manage us */
+     winattr.override_redirect = 1;
+     XChangeWindowAttributes(dpy, zone, CWOverrideRedirect, &winattr);
++    /* Set the input shape to be nothing so that the mouse can still
++     * click/scroll if on the grid */
++    XShapeCombineRectangles(dpy, zone, ShapeInput, 0, 0, NULL, 0, ShapeSet, 0);
+ 
+     XSelectInput(dpy, zone, StructureNotifyMask | ExposureMask
+                  | PointerMotionMask | LeaveWindowMask );
+
+From 88aba2415bd20e70be91a24e2eb2409cb44b4076 Mon Sep 17 00:00:00 2001
+From: jabashque <jabashque@gmail.com>
+Date: Sun, 23 Feb 2020 04:35:37 -0800
+Subject: [PATCH 2/2] Remove {open,close}pixel(), var mouseinfo, type
+ mouseinfo_t
+
+Input shape is now set to 0x0, which takes care of the functionality
+that {open,close}pixel() previously provided. As such, completely remove
+{open,close}pixel() since they're no longer needed. In addition, remove
+the mouseinfo var and the mouseinfo_t type since those were used only by
+{open,close}pixel().
+---
+ keynav.c | 64 +-------------------------------------------------------
+ 1 file changed, 1 insertion(+), 63 deletions(-)
+
+diff --git a/keynav.c b/keynav.c
+index 4453fc8..fae5a76 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -80,11 +80,6 @@ typedef struct wininfo {
+   int curviewport;
+ } wininfo_t;
+ 
+-typedef struct mouseinfo {
+-  int x;
+-  int y;
+-} mouseinfo_t;
+-
+ typedef struct viewport {
+   int x;
+   int y;
+@@ -96,7 +91,6 @@ typedef struct viewport {
+ } viewport_t;
+ 
+ static wininfo_t wininfo;
+-static mouseinfo_t mouseinfo;
+ static viewport_t *viewports;
+ static int nviewports = 0;
+ static int xinerama = 0;
+@@ -191,8 +185,6 @@ void sighup(int sig);
+ void restart();
+ void recordings_save(const char *filename);
+ void parse_recordings(const char *filename);
+-void openpixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo);
+-void closepixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo);
+ 
+ typedef struct dispatch {
+   char *command;
+@@ -1178,21 +1170,7 @@ void cmd_warp(char *args) {
+   x = wininfo.x + wininfo.w / 2;
+   y = wininfo.y + wininfo.h / 2;
+ 
+-  if (mouseinfo.x != -1 && mouseinfo.y != -1) {
+-    closepixel(dpy, zone, &mouseinfo);
+-  }
+-
+-  /* Open pixels hould be relative to the window coordinates,
+-   * not screen coordinates. */
+-  mouseinfo.x = x - wininfo.x;
+-  mouseinfo.y = y - wininfo.y;
+-  openpixel(dpy, zone, &mouseinfo);
+-
+   xdo_move_mouse(xdo, x, y, viewports[wininfo.curviewport].screen_num);
+-  xdo_wait_for_mouse_move_to(xdo, x, y);
+-
+-  /* TODO(sissel): do we need to open again? */
+-  openpixel(dpy, zone, &mouseinfo);
+ }
+ 
+ void cmd_click(char *args) {
+@@ -1981,36 +1959,6 @@ void parse_recordings(const char *filename) {
+   fclose(fp);
+ }
+ 
+-void openpixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo) {
+-  XRectangle rect;
+-  if (mouseinfo->x == -1 && mouseinfo->y == -1) {
+-    return;
+-  }
+-
+-  rect.x = mouseinfo->x;
+-  rect.y = mouseinfo->y;
+-  rect.width = 1;
+-  rect.height = 1;
+-
+-  XShapeCombineRectangles(dpy, zone, ShapeBounding, 0, 0, &rect, 1,
+-                          ShapeSubtract, 0);
+-} /* void openpixel */
+-
+-void closepixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo) {
+-  XRectangle rect;
+-  if (mouseinfo->x == -1 && mouseinfo->y == -1) {
+-    return;
+-  }
+-
+-  rect.x = mouseinfo->x;
+-  rect.y = mouseinfo->y;
+-  rect.width = 1;
+-  rect.height = 1;
+-
+-  XShapeCombineRectangles(dpy, zone, ShapeBounding, 0, 0, &rect, 1,
+-                          ShapeUnion, 0);
+-} /* void closepixel */
+-
+ int main(int argc, char **argv) {
+   char *pcDisplay;
+   int ret;
+@@ -2099,17 +2047,6 @@ int main(int argc, char **argv) {
+         }
+         break;
+ 
+-      case MotionNotify:
+-        if (zone) {
+-        if (mouseinfo.x != -1 && mouseinfo.y != -1) {
+-          closepixel(dpy, zone, &mouseinfo);
+-        }
+-        mouseinfo.x = e.xmotion.x;
+-        mouseinfo.y = e.xmotion.y;
+-        openpixel(dpy, zone, &mouseinfo);
+-        }
+-        break;
+-
+       // Ignorable events.
+       case GraphicsExpose:
+       case NoExpose:
+@@ -2118,6 +2055,7 @@ int main(int argc, char **argv) {
+       case DestroyNotify: // window was destroyed
+       case UnmapNotify:   // window was unmapped (hidden)
+       case MappingNotify: // when keyboard mapping changes
++      case MotionNotify:  // when mouse movement is detected
+         break;
+       default:
+         if (e.type == xrandr_event_base + RRScreenChangeNotify) {
diff --git a/srcpkgs/keynav/patches/fix-overlapping-screens.patch b/srcpkgs/keynav/patches/fix-overlapping-screens.patch
new file mode 100644
index 000000000000..ea9385b9f7a5
--- /dev/null
+++ b/srcpkgs/keynav/patches/fix-overlapping-screens.patch
@@ -0,0 +1,57 @@
+From b3d7a0966c94ea9b6dd0265c512cb7a14293f71e Mon Sep 17 00:00:00 2001
+From: Yutao Yuan <infmagic2047reg@outlook.com>
+Date: Mon, 4 Oct 2021 22:33:32 +0800
+Subject: [PATCH] Treat overlapping screens (like xrandr --same-as) as one
+ screen
+
+---
+ keynav.c | 33 ++++++++++++++++++++++-----------
+ 1 file changed, 22 insertions(+), 11 deletions(-)
+
+diff --git a/keynav.c b/keynav.c
+index 65abe7c..b4e5103 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -1811,20 +1811,31 @@ void query_screens() {
+ }
+ 
+ void query_screen_xinerama() {
+-  int i;
++  int i, j, num_screens;
+   XineramaScreenInfo *screeninfo;
+ 
+-  screeninfo = XineramaQueryScreens(dpy, &nviewports);
++  screeninfo = XineramaQueryScreens(dpy, &num_screens);
+   free(viewports);
+-  viewports = calloc(nviewports, sizeof(viewport_t));
+-  for (i = 0; i < nviewports; i++) {
+-    viewports[i].x = screeninfo[i].x_org;
+-    viewports[i].y = screeninfo[i].y_org;
+-    viewports[i].w = screeninfo[i].width;
+-    viewports[i].h = screeninfo[i].height;
+-    viewports[i].screen_num = 0;
+-    viewports[i].screen = ScreenOfDisplay(dpy, 0);
+-    viewports[i].root = DefaultRootWindow(dpy);
++  viewports = calloc(num_screens, sizeof(viewport_t));
++  nviewports = 0;
++  for (i = 0; i < num_screens; i++) {
++    int overlapping = 0;
++    for (j = 0; j < nviewports; j++) {
++      if (viewports[j].x == screeninfo[i].x_org && viewports[j].y == screeninfo[i].y_org) {
++        overlapping = 1;
++        break;
++      }
++    }
++    if (!overlapping) {
++      viewports[nviewports].x = screeninfo[i].x_org;
++      viewports[nviewports].y = screeninfo[i].y_org;
++      viewports[nviewports].w = screeninfo[i].width;
++      viewports[nviewports].h = screeninfo[i].height;
++      viewports[nviewports].screen_num = 0;
++      viewports[nviewports].screen = ScreenOfDisplay(dpy, 0);
++      viewports[nviewports].root = DefaultRootWindow(dpy);
++      nviewports++;
++    }
+   }
+   XFree(screeninfo);
+ }
diff --git a/srcpkgs/keynav/template b/srcpkgs/keynav/template
new file mode 100644
index 000000000000..f5f2b5f67452
--- /dev/null
+++ b/srcpkgs/keynav/template
@@ -0,0 +1,27 @@
+# Template file for 'keynav'
+pkgname=keynav
+version=0.0.20180821
+revision=1
+_githash=78f9e076a5618aba43b030fbb9344c415c30c1e5
+wrksrc="${pkgname}-${_githash}"
+build_style=gnu-makefile
+make_use_env=yes
+hostmakedepends="pkg-config perl"
+makedepends="cairo-devel libXinerama-devel xdotool-devel libglib-devel libXrandr-devel"
+checkdepends="xorg-server-xvfb"
+short_desc="Quick way to use cursor via the keyboard"
+maintainer="hazen2215 <haz@disroot.org>"
+license="BSD-3-Clause"
+homepage="https://www.semicomplete.com/projects/keynav/"
+distfiles="https://github.com/jordansissel/keynav/archive/${_githash}.tar.gz"
+checksum=def79c32ea8aec57ec65310ede962f4d5d54ef26c5adccb351a19fb5683b678f
+
+do_check() {
+	./test.sh
+}
+
+do_install() {
+	make PREFIX=${DESTDIR}/usr install
+	vsconf keynavrc
+	vlicense COPYRIGHT
+}

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: New package: keynav-0.0.20180821
  2022-01-28  9:47 [PR PATCH] New package: keynav-20180821 hazen2215
                   ` (6 preceding siblings ...)
  2022-02-21  7:42 ` hazen2215
@ 2022-02-21  7:45 ` hazen2215
  2022-03-01 13:25 ` [PR PATCH] [Updated] " hazen2215
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: hazen2215 @ 2022-02-21  7:45 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 175 bytes --]

New comment by hazen2215 on void-packages repository

https://github.com/void-linux/void-packages/pull/35271#issuecomment-1046562486

Comment:
fixed commit & PR title, thanks

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PR PATCH] [Updated] New package: keynav-0.0.20180821
  2022-01-28  9:47 [PR PATCH] New package: keynav-20180821 hazen2215
                   ` (7 preceding siblings ...)
  2022-02-21  7:45 ` New package: keynav-0.0.20180821 hazen2215
@ 2022-03-01 13:25 ` hazen2215
  2022-03-15 10:58 ` hazen2215
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: hazen2215 @ 2022-03-01 13:25 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1063 bytes --]

There is an updated pull request by hazen2215 against master on the void-packages repository

https://github.com/hazen2215/void-packages keynav
https://github.com/void-linux/void-packages/pull/35271

New package: keynav-0.0.20180821
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements): **YES**

<!-- Note: If the build is likely to take more than 2 hours, please [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration)
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, (x86_64-musl)

A patch file from https://github.com/void-linux/void-packages/pull/35271.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-keynav-35271.patch --]
[-- Type: text/x-diff, Size: 9340 bytes --]

From 0ff2a93dcad9e988f5d480ca8a9940cd529ea88f Mon Sep 17 00:00:00 2001
From: hazen2215 <haz@disroot.org>
Date: Fri, 28 Jan 2022 18:06:24 +0900
Subject: [PATCH] New package: keynav-0.0.20180821

---
 .../patches/fix-cursor-passthrough.patch      | 161 ++++++++++++++++++
 .../patches/fix-overlapping-screens.patch     |  57 +++++++
 srcpkgs/keynav/template                       |  27 +++
 3 files changed, 245 insertions(+)
 create mode 100644 srcpkgs/keynav/patches/fix-cursor-passthrough.patch
 create mode 100644 srcpkgs/keynav/patches/fix-overlapping-screens.patch
 create mode 100644 srcpkgs/keynav/template

diff --git a/srcpkgs/keynav/patches/fix-cursor-passthrough.patch b/srcpkgs/keynav/patches/fix-cursor-passthrough.patch
new file mode 100644
index 000000000000..85fcce7ebb6c
--- /dev/null
+++ b/srcpkgs/keynav/patches/fix-cursor-passthrough.patch
@@ -0,0 +1,161 @@
+From 024fc8fe47454f460faa14cbb1727e04596886c0 Mon Sep 17 00:00:00 2001
+From: jabashque <jabashque@gmail.com>
+Date: Sun, 23 Feb 2020 01:50:36 -0800
+Subject: [PATCH 1/2] Set input shape to 0x0 to passthrough mouse
+
+Define the input shape to be empty so that one cannot click on the grid.
+This resolves all issues where the cursor ends up pointing to the grid
+itself instead of the window under the grid due to openpixel() not being
+called.
+---
+ keynav.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/keynav.c b/keynav.c
+index 65abe7c..4453fc8 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -983,6 +983,9 @@ void cmd_start(char *args) {
+     /* Tell the window manager not to manage us */
+     winattr.override_redirect = 1;
+     XChangeWindowAttributes(dpy, zone, CWOverrideRedirect, &winattr);
++    /* Set the input shape to be nothing so that the mouse can still
++     * click/scroll if on the grid */
++    XShapeCombineRectangles(dpy, zone, ShapeInput, 0, 0, NULL, 0, ShapeSet, 0);
+ 
+     XSelectInput(dpy, zone, StructureNotifyMask | ExposureMask
+                  | PointerMotionMask | LeaveWindowMask );
+
+From 88aba2415bd20e70be91a24e2eb2409cb44b4076 Mon Sep 17 00:00:00 2001
+From: jabashque <jabashque@gmail.com>
+Date: Sun, 23 Feb 2020 04:35:37 -0800
+Subject: [PATCH 2/2] Remove {open,close}pixel(), var mouseinfo, type
+ mouseinfo_t
+
+Input shape is now set to 0x0, which takes care of the functionality
+that {open,close}pixel() previously provided. As such, completely remove
+{open,close}pixel() since they're no longer needed. In addition, remove
+the mouseinfo var and the mouseinfo_t type since those were used only by
+{open,close}pixel().
+---
+ keynav.c | 64 +-------------------------------------------------------
+ 1 file changed, 1 insertion(+), 63 deletions(-)
+
+diff --git a/keynav.c b/keynav.c
+index 4453fc8..fae5a76 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -80,11 +80,6 @@ typedef struct wininfo {
+   int curviewport;
+ } wininfo_t;
+ 
+-typedef struct mouseinfo {
+-  int x;
+-  int y;
+-} mouseinfo_t;
+-
+ typedef struct viewport {
+   int x;
+   int y;
+@@ -96,7 +91,6 @@ typedef struct viewport {
+ } viewport_t;
+ 
+ static wininfo_t wininfo;
+-static mouseinfo_t mouseinfo;
+ static viewport_t *viewports;
+ static int nviewports = 0;
+ static int xinerama = 0;
+@@ -191,8 +185,6 @@ void sighup(int sig);
+ void restart();
+ void recordings_save(const char *filename);
+ void parse_recordings(const char *filename);
+-void openpixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo);
+-void closepixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo);
+ 
+ typedef struct dispatch {
+   char *command;
+@@ -1178,21 +1170,7 @@ void cmd_warp(char *args) {
+   x = wininfo.x + wininfo.w / 2;
+   y = wininfo.y + wininfo.h / 2;
+ 
+-  if (mouseinfo.x != -1 && mouseinfo.y != -1) {
+-    closepixel(dpy, zone, &mouseinfo);
+-  }
+-
+-  /* Open pixels hould be relative to the window coordinates,
+-   * not screen coordinates. */
+-  mouseinfo.x = x - wininfo.x;
+-  mouseinfo.y = y - wininfo.y;
+-  openpixel(dpy, zone, &mouseinfo);
+-
+   xdo_move_mouse(xdo, x, y, viewports[wininfo.curviewport].screen_num);
+-  xdo_wait_for_mouse_move_to(xdo, x, y);
+-
+-  /* TODO(sissel): do we need to open again? */
+-  openpixel(dpy, zone, &mouseinfo);
+ }
+ 
+ void cmd_click(char *args) {
+@@ -1981,36 +1959,6 @@ void parse_recordings(const char *filename) {
+   fclose(fp);
+ }
+ 
+-void openpixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo) {
+-  XRectangle rect;
+-  if (mouseinfo->x == -1 && mouseinfo->y == -1) {
+-    return;
+-  }
+-
+-  rect.x = mouseinfo->x;
+-  rect.y = mouseinfo->y;
+-  rect.width = 1;
+-  rect.height = 1;
+-
+-  XShapeCombineRectangles(dpy, zone, ShapeBounding, 0, 0, &rect, 1,
+-                          ShapeSubtract, 0);
+-} /* void openpixel */
+-
+-void closepixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo) {
+-  XRectangle rect;
+-  if (mouseinfo->x == -1 && mouseinfo->y == -1) {
+-    return;
+-  }
+-
+-  rect.x = mouseinfo->x;
+-  rect.y = mouseinfo->y;
+-  rect.width = 1;
+-  rect.height = 1;
+-
+-  XShapeCombineRectangles(dpy, zone, ShapeBounding, 0, 0, &rect, 1,
+-                          ShapeUnion, 0);
+-} /* void closepixel */
+-
+ int main(int argc, char **argv) {
+   char *pcDisplay;
+   int ret;
+@@ -2099,17 +2047,6 @@ int main(int argc, char **argv) {
+         }
+         break;
+ 
+-      case MotionNotify:
+-        if (zone) {
+-        if (mouseinfo.x != -1 && mouseinfo.y != -1) {
+-          closepixel(dpy, zone, &mouseinfo);
+-        }
+-        mouseinfo.x = e.xmotion.x;
+-        mouseinfo.y = e.xmotion.y;
+-        openpixel(dpy, zone, &mouseinfo);
+-        }
+-        break;
+-
+       // Ignorable events.
+       case GraphicsExpose:
+       case NoExpose:
+@@ -2118,6 +2055,7 @@ int main(int argc, char **argv) {
+       case DestroyNotify: // window was destroyed
+       case UnmapNotify:   // window was unmapped (hidden)
+       case MappingNotify: // when keyboard mapping changes
++      case MotionNotify:  // when mouse movement is detected
+         break;
+       default:
+         if (e.type == xrandr_event_base + RRScreenChangeNotify) {
diff --git a/srcpkgs/keynav/patches/fix-overlapping-screens.patch b/srcpkgs/keynav/patches/fix-overlapping-screens.patch
new file mode 100644
index 000000000000..ea9385b9f7a5
--- /dev/null
+++ b/srcpkgs/keynav/patches/fix-overlapping-screens.patch
@@ -0,0 +1,57 @@
+From b3d7a0966c94ea9b6dd0265c512cb7a14293f71e Mon Sep 17 00:00:00 2001
+From: Yutao Yuan <infmagic2047reg@outlook.com>
+Date: Mon, 4 Oct 2021 22:33:32 +0800
+Subject: [PATCH] Treat overlapping screens (like xrandr --same-as) as one
+ screen
+
+---
+ keynav.c | 33 ++++++++++++++++++++++-----------
+ 1 file changed, 22 insertions(+), 11 deletions(-)
+
+diff --git a/keynav.c b/keynav.c
+index 65abe7c..b4e5103 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -1811,20 +1811,31 @@ void query_screens() {
+ }
+ 
+ void query_screen_xinerama() {
+-  int i;
++  int i, j, num_screens;
+   XineramaScreenInfo *screeninfo;
+ 
+-  screeninfo = XineramaQueryScreens(dpy, &nviewports);
++  screeninfo = XineramaQueryScreens(dpy, &num_screens);
+   free(viewports);
+-  viewports = calloc(nviewports, sizeof(viewport_t));
+-  for (i = 0; i < nviewports; i++) {
+-    viewports[i].x = screeninfo[i].x_org;
+-    viewports[i].y = screeninfo[i].y_org;
+-    viewports[i].w = screeninfo[i].width;
+-    viewports[i].h = screeninfo[i].height;
+-    viewports[i].screen_num = 0;
+-    viewports[i].screen = ScreenOfDisplay(dpy, 0);
+-    viewports[i].root = DefaultRootWindow(dpy);
++  viewports = calloc(num_screens, sizeof(viewport_t));
++  nviewports = 0;
++  for (i = 0; i < num_screens; i++) {
++    int overlapping = 0;
++    for (j = 0; j < nviewports; j++) {
++      if (viewports[j].x == screeninfo[i].x_org && viewports[j].y == screeninfo[i].y_org) {
++        overlapping = 1;
++        break;
++      }
++    }
++    if (!overlapping) {
++      viewports[nviewports].x = screeninfo[i].x_org;
++      viewports[nviewports].y = screeninfo[i].y_org;
++      viewports[nviewports].w = screeninfo[i].width;
++      viewports[nviewports].h = screeninfo[i].height;
++      viewports[nviewports].screen_num = 0;
++      viewports[nviewports].screen = ScreenOfDisplay(dpy, 0);
++      viewports[nviewports].root = DefaultRootWindow(dpy);
++      nviewports++;
++    }
+   }
+   XFree(screeninfo);
+ }
diff --git a/srcpkgs/keynav/template b/srcpkgs/keynav/template
new file mode 100644
index 000000000000..f5f2b5f67452
--- /dev/null
+++ b/srcpkgs/keynav/template
@@ -0,0 +1,27 @@
+# Template file for 'keynav'
+pkgname=keynav
+version=0.0.20180821
+revision=1
+_githash=78f9e076a5618aba43b030fbb9344c415c30c1e5
+wrksrc="${pkgname}-${_githash}"
+build_style=gnu-makefile
+make_use_env=yes
+hostmakedepends="pkg-config perl"
+makedepends="cairo-devel libXinerama-devel xdotool-devel libglib-devel libXrandr-devel"
+checkdepends="xorg-server-xvfb"
+short_desc="Quick way to use cursor via the keyboard"
+maintainer="hazen2215 <haz@disroot.org>"
+license="BSD-3-Clause"
+homepage="https://www.semicomplete.com/projects/keynav/"
+distfiles="https://github.com/jordansissel/keynav/archive/${_githash}.tar.gz"
+checksum=def79c32ea8aec57ec65310ede962f4d5d54ef26c5adccb351a19fb5683b678f
+
+do_check() {
+	./test.sh
+}
+
+do_install() {
+	make PREFIX=${DESTDIR}/usr install
+	vsconf keynavrc
+	vlicense COPYRIGHT
+}

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PR PATCH] [Updated] New package: keynav-0.0.20180821
  2022-01-28  9:47 [PR PATCH] New package: keynav-20180821 hazen2215
                   ` (8 preceding siblings ...)
  2022-03-01 13:25 ` [PR PATCH] [Updated] " hazen2215
@ 2022-03-15 10:58 ` hazen2215
  2022-03-30 21:08 ` hazen2215
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: hazen2215 @ 2022-03-15 10:58 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1063 bytes --]

There is an updated pull request by hazen2215 against master on the void-packages repository

https://github.com/hazen2215/void-packages keynav
https://github.com/void-linux/void-packages/pull/35271

New package: keynav-0.0.20180821
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements): **YES**

<!-- Note: If the build is likely to take more than 2 hours, please [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration)
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, (x86_64-musl)

A patch file from https://github.com/void-linux/void-packages/pull/35271.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-keynav-35271.patch --]
[-- Type: text/x-diff, Size: 9340 bytes --]

From 239789a224bd62168e9e1945be5f802101b51862 Mon Sep 17 00:00:00 2001
From: hazen2215 <haz@disroot.org>
Date: Fri, 28 Jan 2022 18:06:24 +0900
Subject: [PATCH] New package: keynav-0.0.20180821

---
 .../patches/fix-cursor-passthrough.patch      | 161 ++++++++++++++++++
 .../patches/fix-overlapping-screens.patch     |  57 +++++++
 srcpkgs/keynav/template                       |  27 +++
 3 files changed, 245 insertions(+)
 create mode 100644 srcpkgs/keynav/patches/fix-cursor-passthrough.patch
 create mode 100644 srcpkgs/keynav/patches/fix-overlapping-screens.patch
 create mode 100644 srcpkgs/keynav/template

diff --git a/srcpkgs/keynav/patches/fix-cursor-passthrough.patch b/srcpkgs/keynav/patches/fix-cursor-passthrough.patch
new file mode 100644
index 000000000000..85fcce7ebb6c
--- /dev/null
+++ b/srcpkgs/keynav/patches/fix-cursor-passthrough.patch
@@ -0,0 +1,161 @@
+From 024fc8fe47454f460faa14cbb1727e04596886c0 Mon Sep 17 00:00:00 2001
+From: jabashque <jabashque@gmail.com>
+Date: Sun, 23 Feb 2020 01:50:36 -0800
+Subject: [PATCH 1/2] Set input shape to 0x0 to passthrough mouse
+
+Define the input shape to be empty so that one cannot click on the grid.
+This resolves all issues where the cursor ends up pointing to the grid
+itself instead of the window under the grid due to openpixel() not being
+called.
+---
+ keynav.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/keynav.c b/keynav.c
+index 65abe7c..4453fc8 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -983,6 +983,9 @@ void cmd_start(char *args) {
+     /* Tell the window manager not to manage us */
+     winattr.override_redirect = 1;
+     XChangeWindowAttributes(dpy, zone, CWOverrideRedirect, &winattr);
++    /* Set the input shape to be nothing so that the mouse can still
++     * click/scroll if on the grid */
++    XShapeCombineRectangles(dpy, zone, ShapeInput, 0, 0, NULL, 0, ShapeSet, 0);
+ 
+     XSelectInput(dpy, zone, StructureNotifyMask | ExposureMask
+                  | PointerMotionMask | LeaveWindowMask );
+
+From 88aba2415bd20e70be91a24e2eb2409cb44b4076 Mon Sep 17 00:00:00 2001
+From: jabashque <jabashque@gmail.com>
+Date: Sun, 23 Feb 2020 04:35:37 -0800
+Subject: [PATCH 2/2] Remove {open,close}pixel(), var mouseinfo, type
+ mouseinfo_t
+
+Input shape is now set to 0x0, which takes care of the functionality
+that {open,close}pixel() previously provided. As such, completely remove
+{open,close}pixel() since they're no longer needed. In addition, remove
+the mouseinfo var and the mouseinfo_t type since those were used only by
+{open,close}pixel().
+---
+ keynav.c | 64 +-------------------------------------------------------
+ 1 file changed, 1 insertion(+), 63 deletions(-)
+
+diff --git a/keynav.c b/keynav.c
+index 4453fc8..fae5a76 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -80,11 +80,6 @@ typedef struct wininfo {
+   int curviewport;
+ } wininfo_t;
+ 
+-typedef struct mouseinfo {
+-  int x;
+-  int y;
+-} mouseinfo_t;
+-
+ typedef struct viewport {
+   int x;
+   int y;
+@@ -96,7 +91,6 @@ typedef struct viewport {
+ } viewport_t;
+ 
+ static wininfo_t wininfo;
+-static mouseinfo_t mouseinfo;
+ static viewport_t *viewports;
+ static int nviewports = 0;
+ static int xinerama = 0;
+@@ -191,8 +185,6 @@ void sighup(int sig);
+ void restart();
+ void recordings_save(const char *filename);
+ void parse_recordings(const char *filename);
+-void openpixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo);
+-void closepixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo);
+ 
+ typedef struct dispatch {
+   char *command;
+@@ -1178,21 +1170,7 @@ void cmd_warp(char *args) {
+   x = wininfo.x + wininfo.w / 2;
+   y = wininfo.y + wininfo.h / 2;
+ 
+-  if (mouseinfo.x != -1 && mouseinfo.y != -1) {
+-    closepixel(dpy, zone, &mouseinfo);
+-  }
+-
+-  /* Open pixels hould be relative to the window coordinates,
+-   * not screen coordinates. */
+-  mouseinfo.x = x - wininfo.x;
+-  mouseinfo.y = y - wininfo.y;
+-  openpixel(dpy, zone, &mouseinfo);
+-
+   xdo_move_mouse(xdo, x, y, viewports[wininfo.curviewport].screen_num);
+-  xdo_wait_for_mouse_move_to(xdo, x, y);
+-
+-  /* TODO(sissel): do we need to open again? */
+-  openpixel(dpy, zone, &mouseinfo);
+ }
+ 
+ void cmd_click(char *args) {
+@@ -1981,36 +1959,6 @@ void parse_recordings(const char *filename) {
+   fclose(fp);
+ }
+ 
+-void openpixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo) {
+-  XRectangle rect;
+-  if (mouseinfo->x == -1 && mouseinfo->y == -1) {
+-    return;
+-  }
+-
+-  rect.x = mouseinfo->x;
+-  rect.y = mouseinfo->y;
+-  rect.width = 1;
+-  rect.height = 1;
+-
+-  XShapeCombineRectangles(dpy, zone, ShapeBounding, 0, 0, &rect, 1,
+-                          ShapeSubtract, 0);
+-} /* void openpixel */
+-
+-void closepixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo) {
+-  XRectangle rect;
+-  if (mouseinfo->x == -1 && mouseinfo->y == -1) {
+-    return;
+-  }
+-
+-  rect.x = mouseinfo->x;
+-  rect.y = mouseinfo->y;
+-  rect.width = 1;
+-  rect.height = 1;
+-
+-  XShapeCombineRectangles(dpy, zone, ShapeBounding, 0, 0, &rect, 1,
+-                          ShapeUnion, 0);
+-} /* void closepixel */
+-
+ int main(int argc, char **argv) {
+   char *pcDisplay;
+   int ret;
+@@ -2099,17 +2047,6 @@ int main(int argc, char **argv) {
+         }
+         break;
+ 
+-      case MotionNotify:
+-        if (zone) {
+-        if (mouseinfo.x != -1 && mouseinfo.y != -1) {
+-          closepixel(dpy, zone, &mouseinfo);
+-        }
+-        mouseinfo.x = e.xmotion.x;
+-        mouseinfo.y = e.xmotion.y;
+-        openpixel(dpy, zone, &mouseinfo);
+-        }
+-        break;
+-
+       // Ignorable events.
+       case GraphicsExpose:
+       case NoExpose:
+@@ -2118,6 +2055,7 @@ int main(int argc, char **argv) {
+       case DestroyNotify: // window was destroyed
+       case UnmapNotify:   // window was unmapped (hidden)
+       case MappingNotify: // when keyboard mapping changes
++      case MotionNotify:  // when mouse movement is detected
+         break;
+       default:
+         if (e.type == xrandr_event_base + RRScreenChangeNotify) {
diff --git a/srcpkgs/keynav/patches/fix-overlapping-screens.patch b/srcpkgs/keynav/patches/fix-overlapping-screens.patch
new file mode 100644
index 000000000000..ea9385b9f7a5
--- /dev/null
+++ b/srcpkgs/keynav/patches/fix-overlapping-screens.patch
@@ -0,0 +1,57 @@
+From b3d7a0966c94ea9b6dd0265c512cb7a14293f71e Mon Sep 17 00:00:00 2001
+From: Yutao Yuan <infmagic2047reg@outlook.com>
+Date: Mon, 4 Oct 2021 22:33:32 +0800
+Subject: [PATCH] Treat overlapping screens (like xrandr --same-as) as one
+ screen
+
+---
+ keynav.c | 33 ++++++++++++++++++++++-----------
+ 1 file changed, 22 insertions(+), 11 deletions(-)
+
+diff --git a/keynav.c b/keynav.c
+index 65abe7c..b4e5103 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -1811,20 +1811,31 @@ void query_screens() {
+ }
+ 
+ void query_screen_xinerama() {
+-  int i;
++  int i, j, num_screens;
+   XineramaScreenInfo *screeninfo;
+ 
+-  screeninfo = XineramaQueryScreens(dpy, &nviewports);
++  screeninfo = XineramaQueryScreens(dpy, &num_screens);
+   free(viewports);
+-  viewports = calloc(nviewports, sizeof(viewport_t));
+-  for (i = 0; i < nviewports; i++) {
+-    viewports[i].x = screeninfo[i].x_org;
+-    viewports[i].y = screeninfo[i].y_org;
+-    viewports[i].w = screeninfo[i].width;
+-    viewports[i].h = screeninfo[i].height;
+-    viewports[i].screen_num = 0;
+-    viewports[i].screen = ScreenOfDisplay(dpy, 0);
+-    viewports[i].root = DefaultRootWindow(dpy);
++  viewports = calloc(num_screens, sizeof(viewport_t));
++  nviewports = 0;
++  for (i = 0; i < num_screens; i++) {
++    int overlapping = 0;
++    for (j = 0; j < nviewports; j++) {
++      if (viewports[j].x == screeninfo[i].x_org && viewports[j].y == screeninfo[i].y_org) {
++        overlapping = 1;
++        break;
++      }
++    }
++    if (!overlapping) {
++      viewports[nviewports].x = screeninfo[i].x_org;
++      viewports[nviewports].y = screeninfo[i].y_org;
++      viewports[nviewports].w = screeninfo[i].width;
++      viewports[nviewports].h = screeninfo[i].height;
++      viewports[nviewports].screen_num = 0;
++      viewports[nviewports].screen = ScreenOfDisplay(dpy, 0);
++      viewports[nviewports].root = DefaultRootWindow(dpy);
++      nviewports++;
++    }
+   }
+   XFree(screeninfo);
+ }
diff --git a/srcpkgs/keynav/template b/srcpkgs/keynav/template
new file mode 100644
index 000000000000..f5f2b5f67452
--- /dev/null
+++ b/srcpkgs/keynav/template
@@ -0,0 +1,27 @@
+# Template file for 'keynav'
+pkgname=keynav
+version=0.0.20180821
+revision=1
+_githash=78f9e076a5618aba43b030fbb9344c415c30c1e5
+wrksrc="${pkgname}-${_githash}"
+build_style=gnu-makefile
+make_use_env=yes
+hostmakedepends="pkg-config perl"
+makedepends="cairo-devel libXinerama-devel xdotool-devel libglib-devel libXrandr-devel"
+checkdepends="xorg-server-xvfb"
+short_desc="Quick way to use cursor via the keyboard"
+maintainer="hazen2215 <haz@disroot.org>"
+license="BSD-3-Clause"
+homepage="https://www.semicomplete.com/projects/keynav/"
+distfiles="https://github.com/jordansissel/keynav/archive/${_githash}.tar.gz"
+checksum=def79c32ea8aec57ec65310ede962f4d5d54ef26c5adccb351a19fb5683b678f
+
+do_check() {
+	./test.sh
+}
+
+do_install() {
+	make PREFIX=${DESTDIR}/usr install
+	vsconf keynavrc
+	vlicense COPYRIGHT
+}

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PR PATCH] [Updated] New package: keynav-0.0.20180821
  2022-01-28  9:47 [PR PATCH] New package: keynav-20180821 hazen2215
                   ` (9 preceding siblings ...)
  2022-03-15 10:58 ` hazen2215
@ 2022-03-30 21:08 ` hazen2215
  2022-04-21 11:52 ` hazen2215
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: hazen2215 @ 2022-03-30 21:08 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1063 bytes --]

There is an updated pull request by hazen2215 against master on the void-packages repository

https://github.com/hazen2215/void-packages keynav
https://github.com/void-linux/void-packages/pull/35271

New package: keynav-0.0.20180821
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements): **YES**

<!-- Note: If the build is likely to take more than 2 hours, please [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration)
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, (x86_64-musl)

A patch file from https://github.com/void-linux/void-packages/pull/35271.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-keynav-35271.patch --]
[-- Type: text/x-diff, Size: 9340 bytes --]

From 0299a87a193691d950823f190f7dc45c858aa657 Mon Sep 17 00:00:00 2001
From: hazen2215 <haz@disroot.org>
Date: Fri, 28 Jan 2022 18:06:24 +0900
Subject: [PATCH] New package: keynav-0.0.20180821

---
 .../patches/fix-cursor-passthrough.patch      | 161 ++++++++++++++++++
 .../patches/fix-overlapping-screens.patch     |  57 +++++++
 srcpkgs/keynav/template                       |  27 +++
 3 files changed, 245 insertions(+)
 create mode 100644 srcpkgs/keynav/patches/fix-cursor-passthrough.patch
 create mode 100644 srcpkgs/keynav/patches/fix-overlapping-screens.patch
 create mode 100644 srcpkgs/keynav/template

diff --git a/srcpkgs/keynav/patches/fix-cursor-passthrough.patch b/srcpkgs/keynav/patches/fix-cursor-passthrough.patch
new file mode 100644
index 000000000000..85fcce7ebb6c
--- /dev/null
+++ b/srcpkgs/keynav/patches/fix-cursor-passthrough.patch
@@ -0,0 +1,161 @@
+From 024fc8fe47454f460faa14cbb1727e04596886c0 Mon Sep 17 00:00:00 2001
+From: jabashque <jabashque@gmail.com>
+Date: Sun, 23 Feb 2020 01:50:36 -0800
+Subject: [PATCH 1/2] Set input shape to 0x0 to passthrough mouse
+
+Define the input shape to be empty so that one cannot click on the grid.
+This resolves all issues where the cursor ends up pointing to the grid
+itself instead of the window under the grid due to openpixel() not being
+called.
+---
+ keynav.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/keynav.c b/keynav.c
+index 65abe7c..4453fc8 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -983,6 +983,9 @@ void cmd_start(char *args) {
+     /* Tell the window manager not to manage us */
+     winattr.override_redirect = 1;
+     XChangeWindowAttributes(dpy, zone, CWOverrideRedirect, &winattr);
++    /* Set the input shape to be nothing so that the mouse can still
++     * click/scroll if on the grid */
++    XShapeCombineRectangles(dpy, zone, ShapeInput, 0, 0, NULL, 0, ShapeSet, 0);
+ 
+     XSelectInput(dpy, zone, StructureNotifyMask | ExposureMask
+                  | PointerMotionMask | LeaveWindowMask );
+
+From 88aba2415bd20e70be91a24e2eb2409cb44b4076 Mon Sep 17 00:00:00 2001
+From: jabashque <jabashque@gmail.com>
+Date: Sun, 23 Feb 2020 04:35:37 -0800
+Subject: [PATCH 2/2] Remove {open,close}pixel(), var mouseinfo, type
+ mouseinfo_t
+
+Input shape is now set to 0x0, which takes care of the functionality
+that {open,close}pixel() previously provided. As such, completely remove
+{open,close}pixel() since they're no longer needed. In addition, remove
+the mouseinfo var and the mouseinfo_t type since those were used only by
+{open,close}pixel().
+---
+ keynav.c | 64 +-------------------------------------------------------
+ 1 file changed, 1 insertion(+), 63 deletions(-)
+
+diff --git a/keynav.c b/keynav.c
+index 4453fc8..fae5a76 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -80,11 +80,6 @@ typedef struct wininfo {
+   int curviewport;
+ } wininfo_t;
+ 
+-typedef struct mouseinfo {
+-  int x;
+-  int y;
+-} mouseinfo_t;
+-
+ typedef struct viewport {
+   int x;
+   int y;
+@@ -96,7 +91,6 @@ typedef struct viewport {
+ } viewport_t;
+ 
+ static wininfo_t wininfo;
+-static mouseinfo_t mouseinfo;
+ static viewport_t *viewports;
+ static int nviewports = 0;
+ static int xinerama = 0;
+@@ -191,8 +185,6 @@ void sighup(int sig);
+ void restart();
+ void recordings_save(const char *filename);
+ void parse_recordings(const char *filename);
+-void openpixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo);
+-void closepixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo);
+ 
+ typedef struct dispatch {
+   char *command;
+@@ -1178,21 +1170,7 @@ void cmd_warp(char *args) {
+   x = wininfo.x + wininfo.w / 2;
+   y = wininfo.y + wininfo.h / 2;
+ 
+-  if (mouseinfo.x != -1 && mouseinfo.y != -1) {
+-    closepixel(dpy, zone, &mouseinfo);
+-  }
+-
+-  /* Open pixels hould be relative to the window coordinates,
+-   * not screen coordinates. */
+-  mouseinfo.x = x - wininfo.x;
+-  mouseinfo.y = y - wininfo.y;
+-  openpixel(dpy, zone, &mouseinfo);
+-
+   xdo_move_mouse(xdo, x, y, viewports[wininfo.curviewport].screen_num);
+-  xdo_wait_for_mouse_move_to(xdo, x, y);
+-
+-  /* TODO(sissel): do we need to open again? */
+-  openpixel(dpy, zone, &mouseinfo);
+ }
+ 
+ void cmd_click(char *args) {
+@@ -1981,36 +1959,6 @@ void parse_recordings(const char *filename) {
+   fclose(fp);
+ }
+ 
+-void openpixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo) {
+-  XRectangle rect;
+-  if (mouseinfo->x == -1 && mouseinfo->y == -1) {
+-    return;
+-  }
+-
+-  rect.x = mouseinfo->x;
+-  rect.y = mouseinfo->y;
+-  rect.width = 1;
+-  rect.height = 1;
+-
+-  XShapeCombineRectangles(dpy, zone, ShapeBounding, 0, 0, &rect, 1,
+-                          ShapeSubtract, 0);
+-} /* void openpixel */
+-
+-void closepixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo) {
+-  XRectangle rect;
+-  if (mouseinfo->x == -1 && mouseinfo->y == -1) {
+-    return;
+-  }
+-
+-  rect.x = mouseinfo->x;
+-  rect.y = mouseinfo->y;
+-  rect.width = 1;
+-  rect.height = 1;
+-
+-  XShapeCombineRectangles(dpy, zone, ShapeBounding, 0, 0, &rect, 1,
+-                          ShapeUnion, 0);
+-} /* void closepixel */
+-
+ int main(int argc, char **argv) {
+   char *pcDisplay;
+   int ret;
+@@ -2099,17 +2047,6 @@ int main(int argc, char **argv) {
+         }
+         break;
+ 
+-      case MotionNotify:
+-        if (zone) {
+-        if (mouseinfo.x != -1 && mouseinfo.y != -1) {
+-          closepixel(dpy, zone, &mouseinfo);
+-        }
+-        mouseinfo.x = e.xmotion.x;
+-        mouseinfo.y = e.xmotion.y;
+-        openpixel(dpy, zone, &mouseinfo);
+-        }
+-        break;
+-
+       // Ignorable events.
+       case GraphicsExpose:
+       case NoExpose:
+@@ -2118,6 +2055,7 @@ int main(int argc, char **argv) {
+       case DestroyNotify: // window was destroyed
+       case UnmapNotify:   // window was unmapped (hidden)
+       case MappingNotify: // when keyboard mapping changes
++      case MotionNotify:  // when mouse movement is detected
+         break;
+       default:
+         if (e.type == xrandr_event_base + RRScreenChangeNotify) {
diff --git a/srcpkgs/keynav/patches/fix-overlapping-screens.patch b/srcpkgs/keynav/patches/fix-overlapping-screens.patch
new file mode 100644
index 000000000000..ea9385b9f7a5
--- /dev/null
+++ b/srcpkgs/keynav/patches/fix-overlapping-screens.patch
@@ -0,0 +1,57 @@
+From b3d7a0966c94ea9b6dd0265c512cb7a14293f71e Mon Sep 17 00:00:00 2001
+From: Yutao Yuan <infmagic2047reg@outlook.com>
+Date: Mon, 4 Oct 2021 22:33:32 +0800
+Subject: [PATCH] Treat overlapping screens (like xrandr --same-as) as one
+ screen
+
+---
+ keynav.c | 33 ++++++++++++++++++++++-----------
+ 1 file changed, 22 insertions(+), 11 deletions(-)
+
+diff --git a/keynav.c b/keynav.c
+index 65abe7c..b4e5103 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -1811,20 +1811,31 @@ void query_screens() {
+ }
+ 
+ void query_screen_xinerama() {
+-  int i;
++  int i, j, num_screens;
+   XineramaScreenInfo *screeninfo;
+ 
+-  screeninfo = XineramaQueryScreens(dpy, &nviewports);
++  screeninfo = XineramaQueryScreens(dpy, &num_screens);
+   free(viewports);
+-  viewports = calloc(nviewports, sizeof(viewport_t));
+-  for (i = 0; i < nviewports; i++) {
+-    viewports[i].x = screeninfo[i].x_org;
+-    viewports[i].y = screeninfo[i].y_org;
+-    viewports[i].w = screeninfo[i].width;
+-    viewports[i].h = screeninfo[i].height;
+-    viewports[i].screen_num = 0;
+-    viewports[i].screen = ScreenOfDisplay(dpy, 0);
+-    viewports[i].root = DefaultRootWindow(dpy);
++  viewports = calloc(num_screens, sizeof(viewport_t));
++  nviewports = 0;
++  for (i = 0; i < num_screens; i++) {
++    int overlapping = 0;
++    for (j = 0; j < nviewports; j++) {
++      if (viewports[j].x == screeninfo[i].x_org && viewports[j].y == screeninfo[i].y_org) {
++        overlapping = 1;
++        break;
++      }
++    }
++    if (!overlapping) {
++      viewports[nviewports].x = screeninfo[i].x_org;
++      viewports[nviewports].y = screeninfo[i].y_org;
++      viewports[nviewports].w = screeninfo[i].width;
++      viewports[nviewports].h = screeninfo[i].height;
++      viewports[nviewports].screen_num = 0;
++      viewports[nviewports].screen = ScreenOfDisplay(dpy, 0);
++      viewports[nviewports].root = DefaultRootWindow(dpy);
++      nviewports++;
++    }
+   }
+   XFree(screeninfo);
+ }
diff --git a/srcpkgs/keynav/template b/srcpkgs/keynav/template
new file mode 100644
index 000000000000..f5f2b5f67452
--- /dev/null
+++ b/srcpkgs/keynav/template
@@ -0,0 +1,27 @@
+# Template file for 'keynav'
+pkgname=keynav
+version=0.0.20180821
+revision=1
+_githash=78f9e076a5618aba43b030fbb9344c415c30c1e5
+wrksrc="${pkgname}-${_githash}"
+build_style=gnu-makefile
+make_use_env=yes
+hostmakedepends="pkg-config perl"
+makedepends="cairo-devel libXinerama-devel xdotool-devel libglib-devel libXrandr-devel"
+checkdepends="xorg-server-xvfb"
+short_desc="Quick way to use cursor via the keyboard"
+maintainer="hazen2215 <haz@disroot.org>"
+license="BSD-3-Clause"
+homepage="https://www.semicomplete.com/projects/keynav/"
+distfiles="https://github.com/jordansissel/keynav/archive/${_githash}.tar.gz"
+checksum=def79c32ea8aec57ec65310ede962f4d5d54ef26c5adccb351a19fb5683b678f
+
+do_check() {
+	./test.sh
+}
+
+do_install() {
+	make PREFIX=${DESTDIR}/usr install
+	vsconf keynavrc
+	vlicense COPYRIGHT
+}

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PR PATCH] [Updated] New package: keynav-0.0.20180821
  2022-01-28  9:47 [PR PATCH] New package: keynav-20180821 hazen2215
                   ` (10 preceding siblings ...)
  2022-03-30 21:08 ` hazen2215
@ 2022-04-21 11:52 ` hazen2215
  2022-06-26  5:11 ` hazen2215
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: hazen2215 @ 2022-04-21 11:52 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1063 bytes --]

There is an updated pull request by hazen2215 against master on the void-packages repository

https://github.com/hazen2215/void-packages keynav
https://github.com/void-linux/void-packages/pull/35271

New package: keynav-0.0.20180821
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements): **YES**

<!-- Note: If the build is likely to take more than 2 hours, please [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration)
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, (x86_64-musl)

A patch file from https://github.com/void-linux/void-packages/pull/35271.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-keynav-35271.patch --]
[-- Type: text/x-diff, Size: 9340 bytes --]

From 8ff4a25f8312d09f1749e1a4d3a07ed1f411dc9d Mon Sep 17 00:00:00 2001
From: hazen2215 <haz@disroot.org>
Date: Fri, 28 Jan 2022 18:06:24 +0900
Subject: [PATCH] New package: keynav-0.0.20180821

---
 .../patches/fix-cursor-passthrough.patch      | 161 ++++++++++++++++++
 .../patches/fix-overlapping-screens.patch     |  57 +++++++
 srcpkgs/keynav/template                       |  27 +++
 3 files changed, 245 insertions(+)
 create mode 100644 srcpkgs/keynav/patches/fix-cursor-passthrough.patch
 create mode 100644 srcpkgs/keynav/patches/fix-overlapping-screens.patch
 create mode 100644 srcpkgs/keynav/template

diff --git a/srcpkgs/keynav/patches/fix-cursor-passthrough.patch b/srcpkgs/keynav/patches/fix-cursor-passthrough.patch
new file mode 100644
index 000000000000..85fcce7ebb6c
--- /dev/null
+++ b/srcpkgs/keynav/patches/fix-cursor-passthrough.patch
@@ -0,0 +1,161 @@
+From 024fc8fe47454f460faa14cbb1727e04596886c0 Mon Sep 17 00:00:00 2001
+From: jabashque <jabashque@gmail.com>
+Date: Sun, 23 Feb 2020 01:50:36 -0800
+Subject: [PATCH 1/2] Set input shape to 0x0 to passthrough mouse
+
+Define the input shape to be empty so that one cannot click on the grid.
+This resolves all issues where the cursor ends up pointing to the grid
+itself instead of the window under the grid due to openpixel() not being
+called.
+---
+ keynav.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/keynav.c b/keynav.c
+index 65abe7c..4453fc8 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -983,6 +983,9 @@ void cmd_start(char *args) {
+     /* Tell the window manager not to manage us */
+     winattr.override_redirect = 1;
+     XChangeWindowAttributes(dpy, zone, CWOverrideRedirect, &winattr);
++    /* Set the input shape to be nothing so that the mouse can still
++     * click/scroll if on the grid */
++    XShapeCombineRectangles(dpy, zone, ShapeInput, 0, 0, NULL, 0, ShapeSet, 0);
+ 
+     XSelectInput(dpy, zone, StructureNotifyMask | ExposureMask
+                  | PointerMotionMask | LeaveWindowMask );
+
+From 88aba2415bd20e70be91a24e2eb2409cb44b4076 Mon Sep 17 00:00:00 2001
+From: jabashque <jabashque@gmail.com>
+Date: Sun, 23 Feb 2020 04:35:37 -0800
+Subject: [PATCH 2/2] Remove {open,close}pixel(), var mouseinfo, type
+ mouseinfo_t
+
+Input shape is now set to 0x0, which takes care of the functionality
+that {open,close}pixel() previously provided. As such, completely remove
+{open,close}pixel() since they're no longer needed. In addition, remove
+the mouseinfo var and the mouseinfo_t type since those were used only by
+{open,close}pixel().
+---
+ keynav.c | 64 +-------------------------------------------------------
+ 1 file changed, 1 insertion(+), 63 deletions(-)
+
+diff --git a/keynav.c b/keynav.c
+index 4453fc8..fae5a76 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -80,11 +80,6 @@ typedef struct wininfo {
+   int curviewport;
+ } wininfo_t;
+ 
+-typedef struct mouseinfo {
+-  int x;
+-  int y;
+-} mouseinfo_t;
+-
+ typedef struct viewport {
+   int x;
+   int y;
+@@ -96,7 +91,6 @@ typedef struct viewport {
+ } viewport_t;
+ 
+ static wininfo_t wininfo;
+-static mouseinfo_t mouseinfo;
+ static viewport_t *viewports;
+ static int nviewports = 0;
+ static int xinerama = 0;
+@@ -191,8 +185,6 @@ void sighup(int sig);
+ void restart();
+ void recordings_save(const char *filename);
+ void parse_recordings(const char *filename);
+-void openpixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo);
+-void closepixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo);
+ 
+ typedef struct dispatch {
+   char *command;
+@@ -1178,21 +1170,7 @@ void cmd_warp(char *args) {
+   x = wininfo.x + wininfo.w / 2;
+   y = wininfo.y + wininfo.h / 2;
+ 
+-  if (mouseinfo.x != -1 && mouseinfo.y != -1) {
+-    closepixel(dpy, zone, &mouseinfo);
+-  }
+-
+-  /* Open pixels hould be relative to the window coordinates,
+-   * not screen coordinates. */
+-  mouseinfo.x = x - wininfo.x;
+-  mouseinfo.y = y - wininfo.y;
+-  openpixel(dpy, zone, &mouseinfo);
+-
+   xdo_move_mouse(xdo, x, y, viewports[wininfo.curviewport].screen_num);
+-  xdo_wait_for_mouse_move_to(xdo, x, y);
+-
+-  /* TODO(sissel): do we need to open again? */
+-  openpixel(dpy, zone, &mouseinfo);
+ }
+ 
+ void cmd_click(char *args) {
+@@ -1981,36 +1959,6 @@ void parse_recordings(const char *filename) {
+   fclose(fp);
+ }
+ 
+-void openpixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo) {
+-  XRectangle rect;
+-  if (mouseinfo->x == -1 && mouseinfo->y == -1) {
+-    return;
+-  }
+-
+-  rect.x = mouseinfo->x;
+-  rect.y = mouseinfo->y;
+-  rect.width = 1;
+-  rect.height = 1;
+-
+-  XShapeCombineRectangles(dpy, zone, ShapeBounding, 0, 0, &rect, 1,
+-                          ShapeSubtract, 0);
+-} /* void openpixel */
+-
+-void closepixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo) {
+-  XRectangle rect;
+-  if (mouseinfo->x == -1 && mouseinfo->y == -1) {
+-    return;
+-  }
+-
+-  rect.x = mouseinfo->x;
+-  rect.y = mouseinfo->y;
+-  rect.width = 1;
+-  rect.height = 1;
+-
+-  XShapeCombineRectangles(dpy, zone, ShapeBounding, 0, 0, &rect, 1,
+-                          ShapeUnion, 0);
+-} /* void closepixel */
+-
+ int main(int argc, char **argv) {
+   char *pcDisplay;
+   int ret;
+@@ -2099,17 +2047,6 @@ int main(int argc, char **argv) {
+         }
+         break;
+ 
+-      case MotionNotify:
+-        if (zone) {
+-        if (mouseinfo.x != -1 && mouseinfo.y != -1) {
+-          closepixel(dpy, zone, &mouseinfo);
+-        }
+-        mouseinfo.x = e.xmotion.x;
+-        mouseinfo.y = e.xmotion.y;
+-        openpixel(dpy, zone, &mouseinfo);
+-        }
+-        break;
+-
+       // Ignorable events.
+       case GraphicsExpose:
+       case NoExpose:
+@@ -2118,6 +2055,7 @@ int main(int argc, char **argv) {
+       case DestroyNotify: // window was destroyed
+       case UnmapNotify:   // window was unmapped (hidden)
+       case MappingNotify: // when keyboard mapping changes
++      case MotionNotify:  // when mouse movement is detected
+         break;
+       default:
+         if (e.type == xrandr_event_base + RRScreenChangeNotify) {
diff --git a/srcpkgs/keynav/patches/fix-overlapping-screens.patch b/srcpkgs/keynav/patches/fix-overlapping-screens.patch
new file mode 100644
index 000000000000..ea9385b9f7a5
--- /dev/null
+++ b/srcpkgs/keynav/patches/fix-overlapping-screens.patch
@@ -0,0 +1,57 @@
+From b3d7a0966c94ea9b6dd0265c512cb7a14293f71e Mon Sep 17 00:00:00 2001
+From: Yutao Yuan <infmagic2047reg@outlook.com>
+Date: Mon, 4 Oct 2021 22:33:32 +0800
+Subject: [PATCH] Treat overlapping screens (like xrandr --same-as) as one
+ screen
+
+---
+ keynav.c | 33 ++++++++++++++++++++++-----------
+ 1 file changed, 22 insertions(+), 11 deletions(-)
+
+diff --git a/keynav.c b/keynav.c
+index 65abe7c..b4e5103 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -1811,20 +1811,31 @@ void query_screens() {
+ }
+ 
+ void query_screen_xinerama() {
+-  int i;
++  int i, j, num_screens;
+   XineramaScreenInfo *screeninfo;
+ 
+-  screeninfo = XineramaQueryScreens(dpy, &nviewports);
++  screeninfo = XineramaQueryScreens(dpy, &num_screens);
+   free(viewports);
+-  viewports = calloc(nviewports, sizeof(viewport_t));
+-  for (i = 0; i < nviewports; i++) {
+-    viewports[i].x = screeninfo[i].x_org;
+-    viewports[i].y = screeninfo[i].y_org;
+-    viewports[i].w = screeninfo[i].width;
+-    viewports[i].h = screeninfo[i].height;
+-    viewports[i].screen_num = 0;
+-    viewports[i].screen = ScreenOfDisplay(dpy, 0);
+-    viewports[i].root = DefaultRootWindow(dpy);
++  viewports = calloc(num_screens, sizeof(viewport_t));
++  nviewports = 0;
++  for (i = 0; i < num_screens; i++) {
++    int overlapping = 0;
++    for (j = 0; j < nviewports; j++) {
++      if (viewports[j].x == screeninfo[i].x_org && viewports[j].y == screeninfo[i].y_org) {
++        overlapping = 1;
++        break;
++      }
++    }
++    if (!overlapping) {
++      viewports[nviewports].x = screeninfo[i].x_org;
++      viewports[nviewports].y = screeninfo[i].y_org;
++      viewports[nviewports].w = screeninfo[i].width;
++      viewports[nviewports].h = screeninfo[i].height;
++      viewports[nviewports].screen_num = 0;
++      viewports[nviewports].screen = ScreenOfDisplay(dpy, 0);
++      viewports[nviewports].root = DefaultRootWindow(dpy);
++      nviewports++;
++    }
+   }
+   XFree(screeninfo);
+ }
diff --git a/srcpkgs/keynav/template b/srcpkgs/keynav/template
new file mode 100644
index 000000000000..f5f2b5f67452
--- /dev/null
+++ b/srcpkgs/keynav/template
@@ -0,0 +1,27 @@
+# Template file for 'keynav'
+pkgname=keynav
+version=0.0.20180821
+revision=1
+_githash=78f9e076a5618aba43b030fbb9344c415c30c1e5
+wrksrc="${pkgname}-${_githash}"
+build_style=gnu-makefile
+make_use_env=yes
+hostmakedepends="pkg-config perl"
+makedepends="cairo-devel libXinerama-devel xdotool-devel libglib-devel libXrandr-devel"
+checkdepends="xorg-server-xvfb"
+short_desc="Quick way to use cursor via the keyboard"
+maintainer="hazen2215 <haz@disroot.org>"
+license="BSD-3-Clause"
+homepage="https://www.semicomplete.com/projects/keynav/"
+distfiles="https://github.com/jordansissel/keynav/archive/${_githash}.tar.gz"
+checksum=def79c32ea8aec57ec65310ede962f4d5d54ef26c5adccb351a19fb5683b678f
+
+do_check() {
+	./test.sh
+}
+
+do_install() {
+	make PREFIX=${DESTDIR}/usr install
+	vsconf keynavrc
+	vlicense COPYRIGHT
+}

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PR PATCH] [Updated] New package: keynav-0.0.20180821
  2022-01-28  9:47 [PR PATCH] New package: keynav-20180821 hazen2215
                   ` (11 preceding siblings ...)
  2022-04-21 11:52 ` hazen2215
@ 2022-06-26  5:11 ` hazen2215
  2022-07-18 11:52 ` hazen2215
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: hazen2215 @ 2022-06-26  5:11 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1063 bytes --]

There is an updated pull request by hazen2215 against master on the void-packages repository

https://github.com/hazen2215/void-packages keynav
https://github.com/void-linux/void-packages/pull/35271

New package: keynav-0.0.20180821
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements): **YES**

<!-- Note: If the build is likely to take more than 2 hours, please [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration)
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, (x86_64-musl)

A patch file from https://github.com/void-linux/void-packages/pull/35271.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-keynav-35271.patch --]
[-- Type: text/x-diff, Size: 9340 bytes --]

From e2ad5d2a333f0db15bf34d3b3e14cee27c2396a4 Mon Sep 17 00:00:00 2001
From: hazen2215 <haz@disroot.org>
Date: Fri, 28 Jan 2022 18:06:24 +0900
Subject: [PATCH] New package: keynav-0.0.20180821

---
 .../patches/fix-cursor-passthrough.patch      | 161 ++++++++++++++++++
 .../patches/fix-overlapping-screens.patch     |  57 +++++++
 srcpkgs/keynav/template                       |  27 +++
 3 files changed, 245 insertions(+)
 create mode 100644 srcpkgs/keynav/patches/fix-cursor-passthrough.patch
 create mode 100644 srcpkgs/keynav/patches/fix-overlapping-screens.patch
 create mode 100644 srcpkgs/keynav/template

diff --git a/srcpkgs/keynav/patches/fix-cursor-passthrough.patch b/srcpkgs/keynav/patches/fix-cursor-passthrough.patch
new file mode 100644
index 000000000000..85fcce7ebb6c
--- /dev/null
+++ b/srcpkgs/keynav/patches/fix-cursor-passthrough.patch
@@ -0,0 +1,161 @@
+From 024fc8fe47454f460faa14cbb1727e04596886c0 Mon Sep 17 00:00:00 2001
+From: jabashque <jabashque@gmail.com>
+Date: Sun, 23 Feb 2020 01:50:36 -0800
+Subject: [PATCH 1/2] Set input shape to 0x0 to passthrough mouse
+
+Define the input shape to be empty so that one cannot click on the grid.
+This resolves all issues where the cursor ends up pointing to the grid
+itself instead of the window under the grid due to openpixel() not being
+called.
+---
+ keynav.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/keynav.c b/keynav.c
+index 65abe7c..4453fc8 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -983,6 +983,9 @@ void cmd_start(char *args) {
+     /* Tell the window manager not to manage us */
+     winattr.override_redirect = 1;
+     XChangeWindowAttributes(dpy, zone, CWOverrideRedirect, &winattr);
++    /* Set the input shape to be nothing so that the mouse can still
++     * click/scroll if on the grid */
++    XShapeCombineRectangles(dpy, zone, ShapeInput, 0, 0, NULL, 0, ShapeSet, 0);
+ 
+     XSelectInput(dpy, zone, StructureNotifyMask | ExposureMask
+                  | PointerMotionMask | LeaveWindowMask );
+
+From 88aba2415bd20e70be91a24e2eb2409cb44b4076 Mon Sep 17 00:00:00 2001
+From: jabashque <jabashque@gmail.com>
+Date: Sun, 23 Feb 2020 04:35:37 -0800
+Subject: [PATCH 2/2] Remove {open,close}pixel(), var mouseinfo, type
+ mouseinfo_t
+
+Input shape is now set to 0x0, which takes care of the functionality
+that {open,close}pixel() previously provided. As such, completely remove
+{open,close}pixel() since they're no longer needed. In addition, remove
+the mouseinfo var and the mouseinfo_t type since those were used only by
+{open,close}pixel().
+---
+ keynav.c | 64 +-------------------------------------------------------
+ 1 file changed, 1 insertion(+), 63 deletions(-)
+
+diff --git a/keynav.c b/keynav.c
+index 4453fc8..fae5a76 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -80,11 +80,6 @@ typedef struct wininfo {
+   int curviewport;
+ } wininfo_t;
+ 
+-typedef struct mouseinfo {
+-  int x;
+-  int y;
+-} mouseinfo_t;
+-
+ typedef struct viewport {
+   int x;
+   int y;
+@@ -96,7 +91,6 @@ typedef struct viewport {
+ } viewport_t;
+ 
+ static wininfo_t wininfo;
+-static mouseinfo_t mouseinfo;
+ static viewport_t *viewports;
+ static int nviewports = 0;
+ static int xinerama = 0;
+@@ -191,8 +185,6 @@ void sighup(int sig);
+ void restart();
+ void recordings_save(const char *filename);
+ void parse_recordings(const char *filename);
+-void openpixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo);
+-void closepixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo);
+ 
+ typedef struct dispatch {
+   char *command;
+@@ -1178,21 +1170,7 @@ void cmd_warp(char *args) {
+   x = wininfo.x + wininfo.w / 2;
+   y = wininfo.y + wininfo.h / 2;
+ 
+-  if (mouseinfo.x != -1 && mouseinfo.y != -1) {
+-    closepixel(dpy, zone, &mouseinfo);
+-  }
+-
+-  /* Open pixels hould be relative to the window coordinates,
+-   * not screen coordinates. */
+-  mouseinfo.x = x - wininfo.x;
+-  mouseinfo.y = y - wininfo.y;
+-  openpixel(dpy, zone, &mouseinfo);
+-
+   xdo_move_mouse(xdo, x, y, viewports[wininfo.curviewport].screen_num);
+-  xdo_wait_for_mouse_move_to(xdo, x, y);
+-
+-  /* TODO(sissel): do we need to open again? */
+-  openpixel(dpy, zone, &mouseinfo);
+ }
+ 
+ void cmd_click(char *args) {
+@@ -1981,36 +1959,6 @@ void parse_recordings(const char *filename) {
+   fclose(fp);
+ }
+ 
+-void openpixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo) {
+-  XRectangle rect;
+-  if (mouseinfo->x == -1 && mouseinfo->y == -1) {
+-    return;
+-  }
+-
+-  rect.x = mouseinfo->x;
+-  rect.y = mouseinfo->y;
+-  rect.width = 1;
+-  rect.height = 1;
+-
+-  XShapeCombineRectangles(dpy, zone, ShapeBounding, 0, 0, &rect, 1,
+-                          ShapeSubtract, 0);
+-} /* void openpixel */
+-
+-void closepixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo) {
+-  XRectangle rect;
+-  if (mouseinfo->x == -1 && mouseinfo->y == -1) {
+-    return;
+-  }
+-
+-  rect.x = mouseinfo->x;
+-  rect.y = mouseinfo->y;
+-  rect.width = 1;
+-  rect.height = 1;
+-
+-  XShapeCombineRectangles(dpy, zone, ShapeBounding, 0, 0, &rect, 1,
+-                          ShapeUnion, 0);
+-} /* void closepixel */
+-
+ int main(int argc, char **argv) {
+   char *pcDisplay;
+   int ret;
+@@ -2099,17 +2047,6 @@ int main(int argc, char **argv) {
+         }
+         break;
+ 
+-      case MotionNotify:
+-        if (zone) {
+-        if (mouseinfo.x != -1 && mouseinfo.y != -1) {
+-          closepixel(dpy, zone, &mouseinfo);
+-        }
+-        mouseinfo.x = e.xmotion.x;
+-        mouseinfo.y = e.xmotion.y;
+-        openpixel(dpy, zone, &mouseinfo);
+-        }
+-        break;
+-
+       // Ignorable events.
+       case GraphicsExpose:
+       case NoExpose:
+@@ -2118,6 +2055,7 @@ int main(int argc, char **argv) {
+       case DestroyNotify: // window was destroyed
+       case UnmapNotify:   // window was unmapped (hidden)
+       case MappingNotify: // when keyboard mapping changes
++      case MotionNotify:  // when mouse movement is detected
+         break;
+       default:
+         if (e.type == xrandr_event_base + RRScreenChangeNotify) {
diff --git a/srcpkgs/keynav/patches/fix-overlapping-screens.patch b/srcpkgs/keynav/patches/fix-overlapping-screens.patch
new file mode 100644
index 000000000000..ea9385b9f7a5
--- /dev/null
+++ b/srcpkgs/keynav/patches/fix-overlapping-screens.patch
@@ -0,0 +1,57 @@
+From b3d7a0966c94ea9b6dd0265c512cb7a14293f71e Mon Sep 17 00:00:00 2001
+From: Yutao Yuan <infmagic2047reg@outlook.com>
+Date: Mon, 4 Oct 2021 22:33:32 +0800
+Subject: [PATCH] Treat overlapping screens (like xrandr --same-as) as one
+ screen
+
+---
+ keynav.c | 33 ++++++++++++++++++++++-----------
+ 1 file changed, 22 insertions(+), 11 deletions(-)
+
+diff --git a/keynav.c b/keynav.c
+index 65abe7c..b4e5103 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -1811,20 +1811,31 @@ void query_screens() {
+ }
+ 
+ void query_screen_xinerama() {
+-  int i;
++  int i, j, num_screens;
+   XineramaScreenInfo *screeninfo;
+ 
+-  screeninfo = XineramaQueryScreens(dpy, &nviewports);
++  screeninfo = XineramaQueryScreens(dpy, &num_screens);
+   free(viewports);
+-  viewports = calloc(nviewports, sizeof(viewport_t));
+-  for (i = 0; i < nviewports; i++) {
+-    viewports[i].x = screeninfo[i].x_org;
+-    viewports[i].y = screeninfo[i].y_org;
+-    viewports[i].w = screeninfo[i].width;
+-    viewports[i].h = screeninfo[i].height;
+-    viewports[i].screen_num = 0;
+-    viewports[i].screen = ScreenOfDisplay(dpy, 0);
+-    viewports[i].root = DefaultRootWindow(dpy);
++  viewports = calloc(num_screens, sizeof(viewport_t));
++  nviewports = 0;
++  for (i = 0; i < num_screens; i++) {
++    int overlapping = 0;
++    for (j = 0; j < nviewports; j++) {
++      if (viewports[j].x == screeninfo[i].x_org && viewports[j].y == screeninfo[i].y_org) {
++        overlapping = 1;
++        break;
++      }
++    }
++    if (!overlapping) {
++      viewports[nviewports].x = screeninfo[i].x_org;
++      viewports[nviewports].y = screeninfo[i].y_org;
++      viewports[nviewports].w = screeninfo[i].width;
++      viewports[nviewports].h = screeninfo[i].height;
++      viewports[nviewports].screen_num = 0;
++      viewports[nviewports].screen = ScreenOfDisplay(dpy, 0);
++      viewports[nviewports].root = DefaultRootWindow(dpy);
++      nviewports++;
++    }
+   }
+   XFree(screeninfo);
+ }
diff --git a/srcpkgs/keynav/template b/srcpkgs/keynav/template
new file mode 100644
index 000000000000..f5f2b5f67452
--- /dev/null
+++ b/srcpkgs/keynav/template
@@ -0,0 +1,27 @@
+# Template file for 'keynav'
+pkgname=keynav
+version=0.0.20180821
+revision=1
+_githash=78f9e076a5618aba43b030fbb9344c415c30c1e5
+wrksrc="${pkgname}-${_githash}"
+build_style=gnu-makefile
+make_use_env=yes
+hostmakedepends="pkg-config perl"
+makedepends="cairo-devel libXinerama-devel xdotool-devel libglib-devel libXrandr-devel"
+checkdepends="xorg-server-xvfb"
+short_desc="Quick way to use cursor via the keyboard"
+maintainer="hazen2215 <haz@disroot.org>"
+license="BSD-3-Clause"
+homepage="https://www.semicomplete.com/projects/keynav/"
+distfiles="https://github.com/jordansissel/keynav/archive/${_githash}.tar.gz"
+checksum=def79c32ea8aec57ec65310ede962f4d5d54ef26c5adccb351a19fb5683b678f
+
+do_check() {
+	./test.sh
+}
+
+do_install() {
+	make PREFIX=${DESTDIR}/usr install
+	vsconf keynavrc
+	vlicense COPYRIGHT
+}

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PR PATCH] [Updated] New package: keynav-0.0.20180821
  2022-01-28  9:47 [PR PATCH] New package: keynav-20180821 hazen2215
                   ` (12 preceding siblings ...)
  2022-06-26  5:11 ` hazen2215
@ 2022-07-18 11:52 ` hazen2215
  2022-09-20 11:25 ` hazen2215
  2022-09-22 17:51 ` hazen2215
  15 siblings, 0 replies; 17+ messages in thread
From: hazen2215 @ 2022-07-18 11:52 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1063 bytes --]

There is an updated pull request by hazen2215 against master on the void-packages repository

https://github.com/hazen2215/void-packages keynav
https://github.com/void-linux/void-packages/pull/35271

New package: keynav-0.0.20180821
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements): **YES**

<!-- Note: If the build is likely to take more than 2 hours, please [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration)
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, (x86_64-musl)

A patch file from https://github.com/void-linux/void-packages/pull/35271.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-keynav-35271.patch --]
[-- Type: text/x-diff, Size: 9345 bytes --]

From 6b180eadb30c12190761606d001d422c70c741aa Mon Sep 17 00:00:00 2001
From: hazen2215 <haz@disroot.org>
Date: Fri, 28 Jan 2022 18:06:24 +0900
Subject: [PATCH] New package: keynav-0.0.20180821

---
 .../patches/fix-cursor-passthrough.patch      | 161 ++++++++++++++++++
 .../patches/fix-overlapping-screens.patch     |  57 +++++++
 srcpkgs/keynav/template                       |  27 +++
 3 files changed, 245 insertions(+)
 create mode 100644 srcpkgs/keynav/patches/fix-cursor-passthrough.patch
 create mode 100644 srcpkgs/keynav/patches/fix-overlapping-screens.patch
 create mode 100644 srcpkgs/keynav/template

diff --git a/srcpkgs/keynav/patches/fix-cursor-passthrough.patch b/srcpkgs/keynav/patches/fix-cursor-passthrough.patch
new file mode 100644
index 000000000000..85fcce7ebb6c
--- /dev/null
+++ b/srcpkgs/keynav/patches/fix-cursor-passthrough.patch
@@ -0,0 +1,161 @@
+From 024fc8fe47454f460faa14cbb1727e04596886c0 Mon Sep 17 00:00:00 2001
+From: jabashque <jabashque@gmail.com>
+Date: Sun, 23 Feb 2020 01:50:36 -0800
+Subject: [PATCH 1/2] Set input shape to 0x0 to passthrough mouse
+
+Define the input shape to be empty so that one cannot click on the grid.
+This resolves all issues where the cursor ends up pointing to the grid
+itself instead of the window under the grid due to openpixel() not being
+called.
+---
+ keynav.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/keynav.c b/keynav.c
+index 65abe7c..4453fc8 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -983,6 +983,9 @@ void cmd_start(char *args) {
+     /* Tell the window manager not to manage us */
+     winattr.override_redirect = 1;
+     XChangeWindowAttributes(dpy, zone, CWOverrideRedirect, &winattr);
++    /* Set the input shape to be nothing so that the mouse can still
++     * click/scroll if on the grid */
++    XShapeCombineRectangles(dpy, zone, ShapeInput, 0, 0, NULL, 0, ShapeSet, 0);
+ 
+     XSelectInput(dpy, zone, StructureNotifyMask | ExposureMask
+                  | PointerMotionMask | LeaveWindowMask );
+
+From 88aba2415bd20e70be91a24e2eb2409cb44b4076 Mon Sep 17 00:00:00 2001
+From: jabashque <jabashque@gmail.com>
+Date: Sun, 23 Feb 2020 04:35:37 -0800
+Subject: [PATCH 2/2] Remove {open,close}pixel(), var mouseinfo, type
+ mouseinfo_t
+
+Input shape is now set to 0x0, which takes care of the functionality
+that {open,close}pixel() previously provided. As such, completely remove
+{open,close}pixel() since they're no longer needed. In addition, remove
+the mouseinfo var and the mouseinfo_t type since those were used only by
+{open,close}pixel().
+---
+ keynav.c | 64 +-------------------------------------------------------
+ 1 file changed, 1 insertion(+), 63 deletions(-)
+
+diff --git a/keynav.c b/keynav.c
+index 4453fc8..fae5a76 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -80,11 +80,6 @@ typedef struct wininfo {
+   int curviewport;
+ } wininfo_t;
+ 
+-typedef struct mouseinfo {
+-  int x;
+-  int y;
+-} mouseinfo_t;
+-
+ typedef struct viewport {
+   int x;
+   int y;
+@@ -96,7 +91,6 @@ typedef struct viewport {
+ } viewport_t;
+ 
+ static wininfo_t wininfo;
+-static mouseinfo_t mouseinfo;
+ static viewport_t *viewports;
+ static int nviewports = 0;
+ static int xinerama = 0;
+@@ -191,8 +185,6 @@ void sighup(int sig);
+ void restart();
+ void recordings_save(const char *filename);
+ void parse_recordings(const char *filename);
+-void openpixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo);
+-void closepixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo);
+ 
+ typedef struct dispatch {
+   char *command;
+@@ -1178,21 +1170,7 @@ void cmd_warp(char *args) {
+   x = wininfo.x + wininfo.w / 2;
+   y = wininfo.y + wininfo.h / 2;
+ 
+-  if (mouseinfo.x != -1 && mouseinfo.y != -1) {
+-    closepixel(dpy, zone, &mouseinfo);
+-  }
+-
+-  /* Open pixels hould be relative to the window coordinates,
+-   * not screen coordinates. */
+-  mouseinfo.x = x - wininfo.x;
+-  mouseinfo.y = y - wininfo.y;
+-  openpixel(dpy, zone, &mouseinfo);
+-
+   xdo_move_mouse(xdo, x, y, viewports[wininfo.curviewport].screen_num);
+-  xdo_wait_for_mouse_move_to(xdo, x, y);
+-
+-  /* TODO(sissel): do we need to open again? */
+-  openpixel(dpy, zone, &mouseinfo);
+ }
+ 
+ void cmd_click(char *args) {
+@@ -1981,36 +1959,6 @@ void parse_recordings(const char *filename) {
+   fclose(fp);
+ }
+ 
+-void openpixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo) {
+-  XRectangle rect;
+-  if (mouseinfo->x == -1 && mouseinfo->y == -1) {
+-    return;
+-  }
+-
+-  rect.x = mouseinfo->x;
+-  rect.y = mouseinfo->y;
+-  rect.width = 1;
+-  rect.height = 1;
+-
+-  XShapeCombineRectangles(dpy, zone, ShapeBounding, 0, 0, &rect, 1,
+-                          ShapeSubtract, 0);
+-} /* void openpixel */
+-
+-void closepixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo) {
+-  XRectangle rect;
+-  if (mouseinfo->x == -1 && mouseinfo->y == -1) {
+-    return;
+-  }
+-
+-  rect.x = mouseinfo->x;
+-  rect.y = mouseinfo->y;
+-  rect.width = 1;
+-  rect.height = 1;
+-
+-  XShapeCombineRectangles(dpy, zone, ShapeBounding, 0, 0, &rect, 1,
+-                          ShapeUnion, 0);
+-} /* void closepixel */
+-
+ int main(int argc, char **argv) {
+   char *pcDisplay;
+   int ret;
+@@ -2099,17 +2047,6 @@ int main(int argc, char **argv) {
+         }
+         break;
+ 
+-      case MotionNotify:
+-        if (zone) {
+-        if (mouseinfo.x != -1 && mouseinfo.y != -1) {
+-          closepixel(dpy, zone, &mouseinfo);
+-        }
+-        mouseinfo.x = e.xmotion.x;
+-        mouseinfo.y = e.xmotion.y;
+-        openpixel(dpy, zone, &mouseinfo);
+-        }
+-        break;
+-
+       // Ignorable events.
+       case GraphicsExpose:
+       case NoExpose:
+@@ -2118,6 +2055,7 @@ int main(int argc, char **argv) {
+       case DestroyNotify: // window was destroyed
+       case UnmapNotify:   // window was unmapped (hidden)
+       case MappingNotify: // when keyboard mapping changes
++      case MotionNotify:  // when mouse movement is detected
+         break;
+       default:
+         if (e.type == xrandr_event_base + RRScreenChangeNotify) {
diff --git a/srcpkgs/keynav/patches/fix-overlapping-screens.patch b/srcpkgs/keynav/patches/fix-overlapping-screens.patch
new file mode 100644
index 000000000000..ea9385b9f7a5
--- /dev/null
+++ b/srcpkgs/keynav/patches/fix-overlapping-screens.patch
@@ -0,0 +1,57 @@
+From b3d7a0966c94ea9b6dd0265c512cb7a14293f71e Mon Sep 17 00:00:00 2001
+From: Yutao Yuan <infmagic2047reg@outlook.com>
+Date: Mon, 4 Oct 2021 22:33:32 +0800
+Subject: [PATCH] Treat overlapping screens (like xrandr --same-as) as one
+ screen
+
+---
+ keynav.c | 33 ++++++++++++++++++++++-----------
+ 1 file changed, 22 insertions(+), 11 deletions(-)
+
+diff --git a/keynav.c b/keynav.c
+index 65abe7c..b4e5103 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -1811,20 +1811,31 @@ void query_screens() {
+ }
+ 
+ void query_screen_xinerama() {
+-  int i;
++  int i, j, num_screens;
+   XineramaScreenInfo *screeninfo;
+ 
+-  screeninfo = XineramaQueryScreens(dpy, &nviewports);
++  screeninfo = XineramaQueryScreens(dpy, &num_screens);
+   free(viewports);
+-  viewports = calloc(nviewports, sizeof(viewport_t));
+-  for (i = 0; i < nviewports; i++) {
+-    viewports[i].x = screeninfo[i].x_org;
+-    viewports[i].y = screeninfo[i].y_org;
+-    viewports[i].w = screeninfo[i].width;
+-    viewports[i].h = screeninfo[i].height;
+-    viewports[i].screen_num = 0;
+-    viewports[i].screen = ScreenOfDisplay(dpy, 0);
+-    viewports[i].root = DefaultRootWindow(dpy);
++  viewports = calloc(num_screens, sizeof(viewport_t));
++  nviewports = 0;
++  for (i = 0; i < num_screens; i++) {
++    int overlapping = 0;
++    for (j = 0; j < nviewports; j++) {
++      if (viewports[j].x == screeninfo[i].x_org && viewports[j].y == screeninfo[i].y_org) {
++        overlapping = 1;
++        break;
++      }
++    }
++    if (!overlapping) {
++      viewports[nviewports].x = screeninfo[i].x_org;
++      viewports[nviewports].y = screeninfo[i].y_org;
++      viewports[nviewports].w = screeninfo[i].width;
++      viewports[nviewports].h = screeninfo[i].height;
++      viewports[nviewports].screen_num = 0;
++      viewports[nviewports].screen = ScreenOfDisplay(dpy, 0);
++      viewports[nviewports].root = DefaultRootWindow(dpy);
++      nviewports++;
++    }
+   }
+   XFree(screeninfo);
+ }
diff --git a/srcpkgs/keynav/template b/srcpkgs/keynav/template
new file mode 100644
index 000000000000..91007d5469f9
--- /dev/null
+++ b/srcpkgs/keynav/template
@@ -0,0 +1,27 @@
+# Template file for 'keynav'
+pkgname=keynav
+version=0.0.20180821
+revision=1
+_githash=78f9e076a5618aba43b030fbb9344c415c30c1e5
+wrksrc="keynav-${_githash}"
+build_style=gnu-makefile
+make_use_env=yes
+make_install_args="PREFIX=\${DESTDIR}/usr"
+hostmakedepends="pkg-config perl"
+makedepends="cairo-devel libXinerama-devel xdotool-devel libglib-devel libXrandr-devel"
+checkdepends="xorg-server-xvfb"
+short_desc="Quick way to use cursor via the keyboard"
+maintainer="hazen2215 <haz@disroot.org>"
+license="BSD-3-Clause"
+homepage="https://www.semicomplete.com/projects/keynav/"
+distfiles="https://github.com/jordansissel/keynav/archive/${_githash}.tar.gz"
+checksum=def79c32ea8aec57ec65310ede962f4d5d54ef26c5adccb351a19fb5683b678f
+
+do_check() {
+	./test.sh
+}
+
+post_install() {
+	vsconf keynavrc
+	vlicense COPYRIGHT
+}

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PR PATCH] [Updated] New package: keynav-0.0.20180821
  2022-01-28  9:47 [PR PATCH] New package: keynav-20180821 hazen2215
                   ` (13 preceding siblings ...)
  2022-07-18 11:52 ` hazen2215
@ 2022-09-20 11:25 ` hazen2215
  2022-09-22 17:51 ` hazen2215
  15 siblings, 0 replies; 17+ messages in thread
From: hazen2215 @ 2022-09-20 11:25 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1063 bytes --]

There is an updated pull request by hazen2215 against master on the void-packages repository

https://github.com/hazen2215/void-packages keynav
https://github.com/void-linux/void-packages/pull/35271

New package: keynav-0.0.20180821
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements): **YES**

<!-- Note: If the build is likely to take more than 2 hours, please [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration)
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, (x86_64-musl)

A patch file from https://github.com/void-linux/void-packages/pull/35271.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-keynav-35271.patch --]
[-- Type: text/x-diff, Size: 9345 bytes --]

From c924723c6dfc6c5bf2fb14235cc9cd36122ec146 Mon Sep 17 00:00:00 2001
From: hazen2215 <haz@disroot.org>
Date: Fri, 28 Jan 2022 18:06:24 +0900
Subject: [PATCH] New package: keynav-0.0.20180821

---
 .../patches/fix-cursor-passthrough.patch      | 161 ++++++++++++++++++
 .../patches/fix-overlapping-screens.patch     |  57 +++++++
 srcpkgs/keynav/template                       |  27 +++
 3 files changed, 245 insertions(+)
 create mode 100644 srcpkgs/keynav/patches/fix-cursor-passthrough.patch
 create mode 100644 srcpkgs/keynav/patches/fix-overlapping-screens.patch
 create mode 100644 srcpkgs/keynav/template

diff --git a/srcpkgs/keynav/patches/fix-cursor-passthrough.patch b/srcpkgs/keynav/patches/fix-cursor-passthrough.patch
new file mode 100644
index 000000000000..85fcce7ebb6c
--- /dev/null
+++ b/srcpkgs/keynav/patches/fix-cursor-passthrough.patch
@@ -0,0 +1,161 @@
+From 024fc8fe47454f460faa14cbb1727e04596886c0 Mon Sep 17 00:00:00 2001
+From: jabashque <jabashque@gmail.com>
+Date: Sun, 23 Feb 2020 01:50:36 -0800
+Subject: [PATCH 1/2] Set input shape to 0x0 to passthrough mouse
+
+Define the input shape to be empty so that one cannot click on the grid.
+This resolves all issues where the cursor ends up pointing to the grid
+itself instead of the window under the grid due to openpixel() not being
+called.
+---
+ keynav.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/keynav.c b/keynav.c
+index 65abe7c..4453fc8 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -983,6 +983,9 @@ void cmd_start(char *args) {
+     /* Tell the window manager not to manage us */
+     winattr.override_redirect = 1;
+     XChangeWindowAttributes(dpy, zone, CWOverrideRedirect, &winattr);
++    /* Set the input shape to be nothing so that the mouse can still
++     * click/scroll if on the grid */
++    XShapeCombineRectangles(dpy, zone, ShapeInput, 0, 0, NULL, 0, ShapeSet, 0);
+ 
+     XSelectInput(dpy, zone, StructureNotifyMask | ExposureMask
+                  | PointerMotionMask | LeaveWindowMask );
+
+From 88aba2415bd20e70be91a24e2eb2409cb44b4076 Mon Sep 17 00:00:00 2001
+From: jabashque <jabashque@gmail.com>
+Date: Sun, 23 Feb 2020 04:35:37 -0800
+Subject: [PATCH 2/2] Remove {open,close}pixel(), var mouseinfo, type
+ mouseinfo_t
+
+Input shape is now set to 0x0, which takes care of the functionality
+that {open,close}pixel() previously provided. As such, completely remove
+{open,close}pixel() since they're no longer needed. In addition, remove
+the mouseinfo var and the mouseinfo_t type since those were used only by
+{open,close}pixel().
+---
+ keynav.c | 64 +-------------------------------------------------------
+ 1 file changed, 1 insertion(+), 63 deletions(-)
+
+diff --git a/keynav.c b/keynav.c
+index 4453fc8..fae5a76 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -80,11 +80,6 @@ typedef struct wininfo {
+   int curviewport;
+ } wininfo_t;
+ 
+-typedef struct mouseinfo {
+-  int x;
+-  int y;
+-} mouseinfo_t;
+-
+ typedef struct viewport {
+   int x;
+   int y;
+@@ -96,7 +91,6 @@ typedef struct viewport {
+ } viewport_t;
+ 
+ static wininfo_t wininfo;
+-static mouseinfo_t mouseinfo;
+ static viewport_t *viewports;
+ static int nviewports = 0;
+ static int xinerama = 0;
+@@ -191,8 +185,6 @@ void sighup(int sig);
+ void restart();
+ void recordings_save(const char *filename);
+ void parse_recordings(const char *filename);
+-void openpixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo);
+-void closepixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo);
+ 
+ typedef struct dispatch {
+   char *command;
+@@ -1178,21 +1170,7 @@ void cmd_warp(char *args) {
+   x = wininfo.x + wininfo.w / 2;
+   y = wininfo.y + wininfo.h / 2;
+ 
+-  if (mouseinfo.x != -1 && mouseinfo.y != -1) {
+-    closepixel(dpy, zone, &mouseinfo);
+-  }
+-
+-  /* Open pixels hould be relative to the window coordinates,
+-   * not screen coordinates. */
+-  mouseinfo.x = x - wininfo.x;
+-  mouseinfo.y = y - wininfo.y;
+-  openpixel(dpy, zone, &mouseinfo);
+-
+   xdo_move_mouse(xdo, x, y, viewports[wininfo.curviewport].screen_num);
+-  xdo_wait_for_mouse_move_to(xdo, x, y);
+-
+-  /* TODO(sissel): do we need to open again? */
+-  openpixel(dpy, zone, &mouseinfo);
+ }
+ 
+ void cmd_click(char *args) {
+@@ -1981,36 +1959,6 @@ void parse_recordings(const char *filename) {
+   fclose(fp);
+ }
+ 
+-void openpixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo) {
+-  XRectangle rect;
+-  if (mouseinfo->x == -1 && mouseinfo->y == -1) {
+-    return;
+-  }
+-
+-  rect.x = mouseinfo->x;
+-  rect.y = mouseinfo->y;
+-  rect.width = 1;
+-  rect.height = 1;
+-
+-  XShapeCombineRectangles(dpy, zone, ShapeBounding, 0, 0, &rect, 1,
+-                          ShapeSubtract, 0);
+-} /* void openpixel */
+-
+-void closepixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo) {
+-  XRectangle rect;
+-  if (mouseinfo->x == -1 && mouseinfo->y == -1) {
+-    return;
+-  }
+-
+-  rect.x = mouseinfo->x;
+-  rect.y = mouseinfo->y;
+-  rect.width = 1;
+-  rect.height = 1;
+-
+-  XShapeCombineRectangles(dpy, zone, ShapeBounding, 0, 0, &rect, 1,
+-                          ShapeUnion, 0);
+-} /* void closepixel */
+-
+ int main(int argc, char **argv) {
+   char *pcDisplay;
+   int ret;
+@@ -2099,17 +2047,6 @@ int main(int argc, char **argv) {
+         }
+         break;
+ 
+-      case MotionNotify:
+-        if (zone) {
+-        if (mouseinfo.x != -1 && mouseinfo.y != -1) {
+-          closepixel(dpy, zone, &mouseinfo);
+-        }
+-        mouseinfo.x = e.xmotion.x;
+-        mouseinfo.y = e.xmotion.y;
+-        openpixel(dpy, zone, &mouseinfo);
+-        }
+-        break;
+-
+       // Ignorable events.
+       case GraphicsExpose:
+       case NoExpose:
+@@ -2118,6 +2055,7 @@ int main(int argc, char **argv) {
+       case DestroyNotify: // window was destroyed
+       case UnmapNotify:   // window was unmapped (hidden)
+       case MappingNotify: // when keyboard mapping changes
++      case MotionNotify:  // when mouse movement is detected
+         break;
+       default:
+         if (e.type == xrandr_event_base + RRScreenChangeNotify) {
diff --git a/srcpkgs/keynav/patches/fix-overlapping-screens.patch b/srcpkgs/keynav/patches/fix-overlapping-screens.patch
new file mode 100644
index 000000000000..ea9385b9f7a5
--- /dev/null
+++ b/srcpkgs/keynav/patches/fix-overlapping-screens.patch
@@ -0,0 +1,57 @@
+From b3d7a0966c94ea9b6dd0265c512cb7a14293f71e Mon Sep 17 00:00:00 2001
+From: Yutao Yuan <infmagic2047reg@outlook.com>
+Date: Mon, 4 Oct 2021 22:33:32 +0800
+Subject: [PATCH] Treat overlapping screens (like xrandr --same-as) as one
+ screen
+
+---
+ keynav.c | 33 ++++++++++++++++++++++-----------
+ 1 file changed, 22 insertions(+), 11 deletions(-)
+
+diff --git a/keynav.c b/keynav.c
+index 65abe7c..b4e5103 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -1811,20 +1811,31 @@ void query_screens() {
+ }
+ 
+ void query_screen_xinerama() {
+-  int i;
++  int i, j, num_screens;
+   XineramaScreenInfo *screeninfo;
+ 
+-  screeninfo = XineramaQueryScreens(dpy, &nviewports);
++  screeninfo = XineramaQueryScreens(dpy, &num_screens);
+   free(viewports);
+-  viewports = calloc(nviewports, sizeof(viewport_t));
+-  for (i = 0; i < nviewports; i++) {
+-    viewports[i].x = screeninfo[i].x_org;
+-    viewports[i].y = screeninfo[i].y_org;
+-    viewports[i].w = screeninfo[i].width;
+-    viewports[i].h = screeninfo[i].height;
+-    viewports[i].screen_num = 0;
+-    viewports[i].screen = ScreenOfDisplay(dpy, 0);
+-    viewports[i].root = DefaultRootWindow(dpy);
++  viewports = calloc(num_screens, sizeof(viewport_t));
++  nviewports = 0;
++  for (i = 0; i < num_screens; i++) {
++    int overlapping = 0;
++    for (j = 0; j < nviewports; j++) {
++      if (viewports[j].x == screeninfo[i].x_org && viewports[j].y == screeninfo[i].y_org) {
++        overlapping = 1;
++        break;
++      }
++    }
++    if (!overlapping) {
++      viewports[nviewports].x = screeninfo[i].x_org;
++      viewports[nviewports].y = screeninfo[i].y_org;
++      viewports[nviewports].w = screeninfo[i].width;
++      viewports[nviewports].h = screeninfo[i].height;
++      viewports[nviewports].screen_num = 0;
++      viewports[nviewports].screen = ScreenOfDisplay(dpy, 0);
++      viewports[nviewports].root = DefaultRootWindow(dpy);
++      nviewports++;
++    }
+   }
+   XFree(screeninfo);
+ }
diff --git a/srcpkgs/keynav/template b/srcpkgs/keynav/template
new file mode 100644
index 000000000000..91007d5469f9
--- /dev/null
+++ b/srcpkgs/keynav/template
@@ -0,0 +1,27 @@
+# Template file for 'keynav'
+pkgname=keynav
+version=0.0.20180821
+revision=1
+_githash=78f9e076a5618aba43b030fbb9344c415c30c1e5
+wrksrc="keynav-${_githash}"
+build_style=gnu-makefile
+make_use_env=yes
+make_install_args="PREFIX=\${DESTDIR}/usr"
+hostmakedepends="pkg-config perl"
+makedepends="cairo-devel libXinerama-devel xdotool-devel libglib-devel libXrandr-devel"
+checkdepends="xorg-server-xvfb"
+short_desc="Quick way to use cursor via the keyboard"
+maintainer="hazen2215 <haz@disroot.org>"
+license="BSD-3-Clause"
+homepage="https://www.semicomplete.com/projects/keynav/"
+distfiles="https://github.com/jordansissel/keynav/archive/${_githash}.tar.gz"
+checksum=def79c32ea8aec57ec65310ede962f4d5d54ef26c5adccb351a19fb5683b678f
+
+do_check() {
+	./test.sh
+}
+
+post_install() {
+	vsconf keynavrc
+	vlicense COPYRIGHT
+}

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PR PATCH] [Updated] New package: keynav-0.0.20180821
  2022-01-28  9:47 [PR PATCH] New package: keynav-20180821 hazen2215
                   ` (14 preceding siblings ...)
  2022-09-20 11:25 ` hazen2215
@ 2022-09-22 17:51 ` hazen2215
  15 siblings, 0 replies; 17+ messages in thread
From: hazen2215 @ 2022-09-22 17:51 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1063 bytes --]

There is an updated pull request by hazen2215 against master on the void-packages repository

https://github.com/hazen2215/void-packages keynav
https://github.com/void-linux/void-packages/pull/35271

New package: keynav-0.0.20180821
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements): **YES**

<!-- Note: If the build is likely to take more than 2 hours, please [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration)
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, (x86_64-musl)

A patch file from https://github.com/void-linux/void-packages/pull/35271.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-keynav-35271.patch --]
[-- Type: text/x-diff, Size: 9345 bytes --]

From 5dfe81d9491973de39d38655214715cacaf14749 Mon Sep 17 00:00:00 2001
From: hazen2215 <haz@disroot.org>
Date: Fri, 28 Jan 2022 18:06:24 +0900
Subject: [PATCH] New package: keynav-0.0.20180821

---
 .../patches/fix-cursor-passthrough.patch      | 161 ++++++++++++++++++
 .../patches/fix-overlapping-screens.patch     |  57 +++++++
 srcpkgs/keynav/template                       |  27 +++
 3 files changed, 245 insertions(+)
 create mode 100644 srcpkgs/keynav/patches/fix-cursor-passthrough.patch
 create mode 100644 srcpkgs/keynav/patches/fix-overlapping-screens.patch
 create mode 100644 srcpkgs/keynav/template

diff --git a/srcpkgs/keynav/patches/fix-cursor-passthrough.patch b/srcpkgs/keynav/patches/fix-cursor-passthrough.patch
new file mode 100644
index 000000000000..85fcce7ebb6c
--- /dev/null
+++ b/srcpkgs/keynav/patches/fix-cursor-passthrough.patch
@@ -0,0 +1,161 @@
+From 024fc8fe47454f460faa14cbb1727e04596886c0 Mon Sep 17 00:00:00 2001
+From: jabashque <jabashque@gmail.com>
+Date: Sun, 23 Feb 2020 01:50:36 -0800
+Subject: [PATCH 1/2] Set input shape to 0x0 to passthrough mouse
+
+Define the input shape to be empty so that one cannot click on the grid.
+This resolves all issues where the cursor ends up pointing to the grid
+itself instead of the window under the grid due to openpixel() not being
+called.
+---
+ keynav.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/keynav.c b/keynav.c
+index 65abe7c..4453fc8 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -983,6 +983,9 @@ void cmd_start(char *args) {
+     /* Tell the window manager not to manage us */
+     winattr.override_redirect = 1;
+     XChangeWindowAttributes(dpy, zone, CWOverrideRedirect, &winattr);
++    /* Set the input shape to be nothing so that the mouse can still
++     * click/scroll if on the grid */
++    XShapeCombineRectangles(dpy, zone, ShapeInput, 0, 0, NULL, 0, ShapeSet, 0);
+ 
+     XSelectInput(dpy, zone, StructureNotifyMask | ExposureMask
+                  | PointerMotionMask | LeaveWindowMask );
+
+From 88aba2415bd20e70be91a24e2eb2409cb44b4076 Mon Sep 17 00:00:00 2001
+From: jabashque <jabashque@gmail.com>
+Date: Sun, 23 Feb 2020 04:35:37 -0800
+Subject: [PATCH 2/2] Remove {open,close}pixel(), var mouseinfo, type
+ mouseinfo_t
+
+Input shape is now set to 0x0, which takes care of the functionality
+that {open,close}pixel() previously provided. As such, completely remove
+{open,close}pixel() since they're no longer needed. In addition, remove
+the mouseinfo var and the mouseinfo_t type since those were used only by
+{open,close}pixel().
+---
+ keynav.c | 64 +-------------------------------------------------------
+ 1 file changed, 1 insertion(+), 63 deletions(-)
+
+diff --git a/keynav.c b/keynav.c
+index 4453fc8..fae5a76 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -80,11 +80,6 @@ typedef struct wininfo {
+   int curviewport;
+ } wininfo_t;
+ 
+-typedef struct mouseinfo {
+-  int x;
+-  int y;
+-} mouseinfo_t;
+-
+ typedef struct viewport {
+   int x;
+   int y;
+@@ -96,7 +91,6 @@ typedef struct viewport {
+ } viewport_t;
+ 
+ static wininfo_t wininfo;
+-static mouseinfo_t mouseinfo;
+ static viewport_t *viewports;
+ static int nviewports = 0;
+ static int xinerama = 0;
+@@ -191,8 +185,6 @@ void sighup(int sig);
+ void restart();
+ void recordings_save(const char *filename);
+ void parse_recordings(const char *filename);
+-void openpixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo);
+-void closepixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo);
+ 
+ typedef struct dispatch {
+   char *command;
+@@ -1178,21 +1170,7 @@ void cmd_warp(char *args) {
+   x = wininfo.x + wininfo.w / 2;
+   y = wininfo.y + wininfo.h / 2;
+ 
+-  if (mouseinfo.x != -1 && mouseinfo.y != -1) {
+-    closepixel(dpy, zone, &mouseinfo);
+-  }
+-
+-  /* Open pixels hould be relative to the window coordinates,
+-   * not screen coordinates. */
+-  mouseinfo.x = x - wininfo.x;
+-  mouseinfo.y = y - wininfo.y;
+-  openpixel(dpy, zone, &mouseinfo);
+-
+   xdo_move_mouse(xdo, x, y, viewports[wininfo.curviewport].screen_num);
+-  xdo_wait_for_mouse_move_to(xdo, x, y);
+-
+-  /* TODO(sissel): do we need to open again? */
+-  openpixel(dpy, zone, &mouseinfo);
+ }
+ 
+ void cmd_click(char *args) {
+@@ -1981,36 +1959,6 @@ void parse_recordings(const char *filename) {
+   fclose(fp);
+ }
+ 
+-void openpixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo) {
+-  XRectangle rect;
+-  if (mouseinfo->x == -1 && mouseinfo->y == -1) {
+-    return;
+-  }
+-
+-  rect.x = mouseinfo->x;
+-  rect.y = mouseinfo->y;
+-  rect.width = 1;
+-  rect.height = 1;
+-
+-  XShapeCombineRectangles(dpy, zone, ShapeBounding, 0, 0, &rect, 1,
+-                          ShapeSubtract, 0);
+-} /* void openpixel */
+-
+-void closepixel(Display *dpy, Window zone, mouseinfo_t *mouseinfo) {
+-  XRectangle rect;
+-  if (mouseinfo->x == -1 && mouseinfo->y == -1) {
+-    return;
+-  }
+-
+-  rect.x = mouseinfo->x;
+-  rect.y = mouseinfo->y;
+-  rect.width = 1;
+-  rect.height = 1;
+-
+-  XShapeCombineRectangles(dpy, zone, ShapeBounding, 0, 0, &rect, 1,
+-                          ShapeUnion, 0);
+-} /* void closepixel */
+-
+ int main(int argc, char **argv) {
+   char *pcDisplay;
+   int ret;
+@@ -2099,17 +2047,6 @@ int main(int argc, char **argv) {
+         }
+         break;
+ 
+-      case MotionNotify:
+-        if (zone) {
+-        if (mouseinfo.x != -1 && mouseinfo.y != -1) {
+-          closepixel(dpy, zone, &mouseinfo);
+-        }
+-        mouseinfo.x = e.xmotion.x;
+-        mouseinfo.y = e.xmotion.y;
+-        openpixel(dpy, zone, &mouseinfo);
+-        }
+-        break;
+-
+       // Ignorable events.
+       case GraphicsExpose:
+       case NoExpose:
+@@ -2118,6 +2055,7 @@ int main(int argc, char **argv) {
+       case DestroyNotify: // window was destroyed
+       case UnmapNotify:   // window was unmapped (hidden)
+       case MappingNotify: // when keyboard mapping changes
++      case MotionNotify:  // when mouse movement is detected
+         break;
+       default:
+         if (e.type == xrandr_event_base + RRScreenChangeNotify) {
diff --git a/srcpkgs/keynav/patches/fix-overlapping-screens.patch b/srcpkgs/keynav/patches/fix-overlapping-screens.patch
new file mode 100644
index 000000000000..ea9385b9f7a5
--- /dev/null
+++ b/srcpkgs/keynav/patches/fix-overlapping-screens.patch
@@ -0,0 +1,57 @@
+From b3d7a0966c94ea9b6dd0265c512cb7a14293f71e Mon Sep 17 00:00:00 2001
+From: Yutao Yuan <infmagic2047reg@outlook.com>
+Date: Mon, 4 Oct 2021 22:33:32 +0800
+Subject: [PATCH] Treat overlapping screens (like xrandr --same-as) as one
+ screen
+
+---
+ keynav.c | 33 ++++++++++++++++++++++-----------
+ 1 file changed, 22 insertions(+), 11 deletions(-)
+
+diff --git a/keynav.c b/keynav.c
+index 65abe7c..b4e5103 100644
+--- a/keynav.c
++++ b/keynav.c
+@@ -1811,20 +1811,31 @@ void query_screens() {
+ }
+ 
+ void query_screen_xinerama() {
+-  int i;
++  int i, j, num_screens;
+   XineramaScreenInfo *screeninfo;
+ 
+-  screeninfo = XineramaQueryScreens(dpy, &nviewports);
++  screeninfo = XineramaQueryScreens(dpy, &num_screens);
+   free(viewports);
+-  viewports = calloc(nviewports, sizeof(viewport_t));
+-  for (i = 0; i < nviewports; i++) {
+-    viewports[i].x = screeninfo[i].x_org;
+-    viewports[i].y = screeninfo[i].y_org;
+-    viewports[i].w = screeninfo[i].width;
+-    viewports[i].h = screeninfo[i].height;
+-    viewports[i].screen_num = 0;
+-    viewports[i].screen = ScreenOfDisplay(dpy, 0);
+-    viewports[i].root = DefaultRootWindow(dpy);
++  viewports = calloc(num_screens, sizeof(viewport_t));
++  nviewports = 0;
++  for (i = 0; i < num_screens; i++) {
++    int overlapping = 0;
++    for (j = 0; j < nviewports; j++) {
++      if (viewports[j].x == screeninfo[i].x_org && viewports[j].y == screeninfo[i].y_org) {
++        overlapping = 1;
++        break;
++      }
++    }
++    if (!overlapping) {
++      viewports[nviewports].x = screeninfo[i].x_org;
++      viewports[nviewports].y = screeninfo[i].y_org;
++      viewports[nviewports].w = screeninfo[i].width;
++      viewports[nviewports].h = screeninfo[i].height;
++      viewports[nviewports].screen_num = 0;
++      viewports[nviewports].screen = ScreenOfDisplay(dpy, 0);
++      viewports[nviewports].root = DefaultRootWindow(dpy);
++      nviewports++;
++    }
+   }
+   XFree(screeninfo);
+ }
diff --git a/srcpkgs/keynav/template b/srcpkgs/keynav/template
new file mode 100644
index 000000000000..91007d5469f9
--- /dev/null
+++ b/srcpkgs/keynav/template
@@ -0,0 +1,27 @@
+# Template file for 'keynav'
+pkgname=keynav
+version=0.0.20180821
+revision=1
+_githash=78f9e076a5618aba43b030fbb9344c415c30c1e5
+wrksrc="keynav-${_githash}"
+build_style=gnu-makefile
+make_use_env=yes
+make_install_args="PREFIX=\${DESTDIR}/usr"
+hostmakedepends="pkg-config perl"
+makedepends="cairo-devel libXinerama-devel xdotool-devel libglib-devel libXrandr-devel"
+checkdepends="xorg-server-xvfb"
+short_desc="Quick way to use cursor via the keyboard"
+maintainer="hazen2215 <haz@disroot.org>"
+license="BSD-3-Clause"
+homepage="https://www.semicomplete.com/projects/keynav/"
+distfiles="https://github.com/jordansissel/keynav/archive/${_githash}.tar.gz"
+checksum=def79c32ea8aec57ec65310ede962f4d5d54ef26c5adccb351a19fb5683b678f
+
+do_check() {
+	./test.sh
+}
+
+post_install() {
+	vsconf keynavrc
+	vlicense COPYRIGHT
+}

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2022-09-22 17:51 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-28  9:47 [PR PATCH] New package: keynav-20180821 hazen2215
2022-01-28 10:31 ` [PR PATCH] [Updated] " hazen2215
2022-01-28 17:42 ` hazen2215
2022-02-06  4:28 ` hazen2215
2022-02-20  7:58 ` hazen2215
2022-02-20 21:03 ` [PR REVIEW] " Duncaen
2022-02-21  7:39 ` [PR PATCH] [Updated] " hazen2215
2022-02-21  7:42 ` hazen2215
2022-02-21  7:45 ` New package: keynav-0.0.20180821 hazen2215
2022-03-01 13:25 ` [PR PATCH] [Updated] " hazen2215
2022-03-15 10:58 ` hazen2215
2022-03-30 21:08 ` hazen2215
2022-04-21 11:52 ` hazen2215
2022-06-26  5:11 ` hazen2215
2022-07-18 11:52 ` hazen2215
2022-09-20 11:25 ` hazen2215
2022-09-22 17:51 ` hazen2215

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).