Quellcode durchsuchen

Wrap the pointer when the edge of the window is reached

master
Rob Pilling vor 12 Jahren
Ursprung
Commit
c8fcc3d354
1 geänderte Dateien mit 22 neuen und 3 gelöschten Zeilen
  1. +22
    -3
      commands.c

+ 22
- 3
commands.c Datei anzeigen

@@ -289,10 +289,29 @@ bool i_drag(arg_t a)
case MotionNotify: case MotionNotify:
x = e.xmotion.x; x = e.xmotion.x;
y = e.xmotion.y; y = e.xmotion.y;
if (x >= 0 && x <= win.w && y >= 0 && y <= win.h) { #define WARP(x, y) \
dx += x - ox; XWarpPointer(win.env.dpy, \
dy += y - oy; None, win.xwin, \
0, 0, 0, 0, \
x, y); \
ox = x, oy = y; \
break

/* wrap the mouse around */
if(x < 0){
WARP(win.w, y);
}else if(x > win.w){
WARP(0, y);
}else if(y < 0){
WARP(x, win.h);
}else if(y > win.h){
WARP(x, 0);
} }

dx += x - ox;
dy += y - oy;

ox = x; ox = x;
oy = y; oy = y;
break; break;


||||||
x
 
000:0
Laden…
Abbrechen
Speichern