Fix for bug #1487
authorTon Roosendaal <ton@blender.org>
Sat, 6 Nov 2004 14:59:28 +0000 (14:59 +0000)
committerTon Roosendaal <ton@blender.org>
Sat, 6 Nov 2004 14:59:28 +0000 (14:59 +0000)
On OSX, the SHIFT key release event got lost after a 'mouse pointer warp'.
Replaced the warp call in ghost, and updated the fly mode code to read
events better.

Nice positive side effect; using arrow keys to move while transform (e.g.
grab/rotate/scale) goes much much nicer now!

source/blender/src/editview.c
source/blender/src/ghostwinlay.c

index 9024589f497a4244d5725f5dc7d6d45d3b601453..838ddde1771ac0ec25f224952079d4fd1cb91e61 100644 (file)
@@ -1613,20 +1613,22 @@ void fly(void)
        
        warp_pointer(cent[0], cent[1]);
        
-       cent[0]=  (curarea->winx)/2;
-       cent[1]=  (curarea->winy)/2;
+       /* we have to rely on events to give proper mousecoords after a warp_pointer */
+       mval[0]= cent[0]=  (curarea->winx)/2;
+       mval[1]= cent[1]=  (curarea->winy)/2;
        
        headerprint("Fly");
        
        while(loop) {
-               getmouseco_areawin(mval);
+               
 
                while(qtest()) {
                        
                        toets= extern_qread(&val);
                        
                        if(val) {
-                               if(toets==ESCKEY) {
+                               if(toets==MOUSEY) getmouseco_areawin(mval);
+                               else if(toets==ESCKEY) {
                                        VECCOPY(G.vd->camera->loc, oldvec);
                                        VECCOPY(G.vd->camera->rot, oldrot);
                                        loop= 0;
index 762769e91ed2dd782731248a89b72e5d7a23bf91..ac80513e882e466e1b2cb0a8791d7bbc7e413b72 100644 (file)
@@ -672,8 +672,15 @@ void window_set_title(Window *win, char *title) {
        GHOST_SetTitle(win->ghostwin, title);
 }
 
-short window_get_qual(Window *win) {
-       return win->lqual;
+short window_get_qual(Window *win) 
+{
+       int qual= 0;
+       
+       if( query_qual('s')) qual |= LR_SHIFTKEY;
+       if( query_qual('a')) qual |= LR_ALTKEY;
+       if( query_qual('c')) qual |= LR_CTRLKEY;
+       return qual;
+//     return win->lqual;
 }
 
 short window_get_mbut(Window *win) {
@@ -721,9 +728,15 @@ void window_toggle_fullscreen(Window *win, int fullscreen) {
 #endif
 
 void window_warp_pointer(Window *win, int x, int y) {
+       int oldx=x, oldy=y;
+       
        y= win->size[1] - y - 1;
        GHOST_ClientToScreen(win->ghostwin, x, y, &x, &y);
        GHOST_SetCursorPosition(g_system, x, y);
+       
+       /* on OSX (for example) the setcursor doesnt create event */
+       win->lmouse[0]= oldx;
+       win->lmouse[1]= oldy;
 }
 
 void window_queue_redraw(Window *win) {