X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fgltrackball.c;h=ee54cf91d2432f4a541774a742621d77286a54c4;hb=3f1091236d800c43a3124c44c7da54e53f205b13;hp=c0ccaa133d54f246f8e53a170b63733a8c40333b;hpb=f8cf5ac7b2f53510f80a0eaf286a25298be17bfe;p=xscreensaver diff --git a/hacks/glx/gltrackball.c b/hacks/glx/gltrackball.c index c0ccaa13..ee54cf91 100644 --- a/hacks/glx/gltrackball.c +++ b/hacks/glx/gltrackball.c @@ -29,6 +29,8 @@ #include "trackball.h" #include "gltrackball.h" +extern double current_device_rotation (void); /* Bah, it's in fps.h */ + struct trackball_state { int x, y; GLfloat q[4]; @@ -55,6 +57,7 @@ gltrackball_reset (trackball_state *ts) trackball (ts->q, 0, 0, 0, 0); } + /* Begin tracking the mouse: Call this when the mouse button goes down. x and y are the mouse position relative to the window. w and h are the size of the window. @@ -113,8 +116,8 @@ gltrackball_mousewheel (trackball_state *ts, int button, int percent, int flip_p) { int up_p; - double move; int horizontal_p; + int mx, my, move, scale; #ifdef HAVE_COCOA flip_p = 0; /* MacOS has already handled this. */ @@ -134,15 +137,14 @@ gltrackball_mousewheel (trackball_state *ts, up_p = !up_p; } + scale = mx = my = 1000; move = (up_p - ? 1.0 - (percent / 100.0) - : 1.0 + (percent / 100.0)); - - gltrackball_start (ts, 50, 50, 100, 100); - if (horizontal_p) - gltrackball_track (ts, 50*move, 50, 100, 100); - else - gltrackball_track (ts, 50, 50*move, 100, 100); + ? floor (scale * (1.0 - (percent / 100.0))) + : ceil (scale * (1.0 + (percent / 100.0)))); + if (horizontal_p) mx = move; + else my = move; + gltrackball_start (ts, scale, scale, scale*2, scale*2); + gltrackball_track (ts, mx, my, scale*2, scale*2); } void