summaryrefslogtreecommitdiffstats
path: root/commands.c
diff options
context:
space:
mode:
authorBert Münnich <ber.t@posteo.de>2017-10-05 13:47:02 +0200
committerBert Münnich <ber.t@posteo.de>2017-10-05 13:47:02 +0200
commitd81442f55dd1414fd23617044ea157de8d9f1baa (patch)
treebe17830e36bd19f2c78e2e73db9cface055cc827 /commands.c
parentb8fd923e740bcbaebe523c48ca67c3725c1b3863 (diff)
downloadnsxiv-d81442f55dd1414fd23617044ea157de8d9f1baa.tar.zst
Own win method for mouse cursor location
Diffstat (limited to 'commands.c')
-rw-r--r--commands.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/commands.c b/commands.c
index 2e1d66c..01e7878 100644
--- a/commands.c
+++ b/commands.c
@@ -322,19 +322,17 @@ bool ci_scroll_to_edge(arg_t dir)
bool ci_drag(arg_t _)
{
- int i, x, y;
+ int x, y;
float px, py;
- unsigned int ui;
XEvent e;
- Window w;
- if ((int)(img.w * img.zoom) < win.w && (int)(img.h * img.zoom) < win.h)
- return false;
- if (!XQueryPointer(win.env.dpy, win.xwin, &w, &w, &i, &i, &x, &y, &ui))
+ if ((int)(img.w * img.zoom) <= win.w && (int)(img.h * img.zoom) <= win.h)
return false;
win_set_cursor(&win, CURSOR_DRAG);
+ win_cursor_pos(&win, &x, &y);
+
for (;;) {
px = MIN(MAX(0.0, x - win.w*0.1), win.w*0.8) / (win.w*0.8)
* (win.w - img.w * img.zoom);