Today I noticed that applications like oclock confuse cwm(1) when
the pointer gets over the transparent area.

One of many ways to reproduce the bug is to open two xterms and oclock,
and perform all the following actions from keyboard.  Cycle to oclock
(window-cycle), move oclock (window-move-*), or move the pointer
(pointer-move-*) till the pointer is over oclock but not in the center
or the border but in a transparent area, then try to cycle windows back
to the first xterm and you'll see that the pointer get stacked in
oclock.

I came to an unhappy solution, to remove a nice functionality, that's to
remember and restore the position of the cursor when cycling windows.
By other hand, I consider that keeping the cursor in the center of the
window while moving the window is an improvement compared to the current
behaviour.


Index: client.c
===================================================================
RCS file: /cvs/xenocara/app/cwm/client.c,v
retrieving revision 1.266
diff -u -p -r1.266 client.c
--- client.c    26 Feb 2022 15:19:18 -0000      1.266
+++ client.c    6 Sep 2022 16:03:39 -0000
@@ -505,18 +505,8 @@ client_config(struct client_ctx *cc)
 void
 client_ptr_inbound(struct client_ctx *cc, int getpos)
 {
-       if (getpos)
-               xu_ptr_get(cc->win, &cc->ptr.x, &cc->ptr.y);
-
-       if (cc->ptr.x < 0)
-               cc->ptr.x = 0;
-       else if (cc->ptr.x > cc->geom.w - 1)
-               cc->ptr.x = cc->geom.w - 1;
-       if (cc->ptr.y < 0)
-               cc->ptr.y = 0;
-       else if (cc->ptr.y > cc->geom.h - 1)
-               cc->ptr.y = cc->geom.h - 1;
-
+       cc->ptr.x = cc->geom.w / 2;
+       cc->ptr.y = cc->geom.h / 2;
        client_ptr_warp(cc);
 }
 
@@ -532,13 +522,8 @@ client_ptr_save(struct client_ctx *cc)
        int      x, y;
 
        xu_ptr_get(cc->win, &x, &y);
-       if (client_inbound(cc, x, y)) {
-               cc->ptr.x = x;
-               cc->ptr.y = y;
-       } else {
-               cc->ptr.x = cc->geom.w / 2;
-               cc->ptr.y = cc->geom.h / 2;
-       }
+       cc->ptr.x = cc->geom.w / 2;
+       cc->ptr.y = cc->geom.h / 2;
 }
 
 void




Reply via email to