Revision: 23917
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23917
Author:   campbellbarton
Date:     2009-10-18 11:55:39 +0200 (Sun, 18 Oct 2009)

Log Message:
-----------
minor changes to x11 cursor grab wrapping
- when wrapping 2 mouse events were added.
- on release blender still had the last event (possibly outside the screen), 
where menus would fail to show. Add a mouse event by calling XWarpPointer with 
no movement when leaving grab.

Modified Paths:
--------------
    trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp
    trunk/blender/intern/ghost/intern/GHOST_WindowX11.cpp
    trunk/blender/source/blender/windowmanager/intern/wm_cursors.c

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp       2009-10-18 
05:19:46 UTC (rev 23916)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp       2009-10-18 
09:55:39 UTC (rev 23917)
@@ -405,19 +405,21 @@
                                window->getCursorGrabAccum(x_accum, y_accum);
 
                                if(x_new != xme.x_root || y_new != xme.y_root) {
+                                       /* when wrapping we don't need to add 
an event because the
+                                        * setCursorPosition call will cause a 
new event after */
                                        setCursorPosition(x_new, y_new); /* 
wrap */
                                        window->setCursorGrabAccum(x_accum + 
(xme.x_root - x_new), y_accum + (xme.y_root - y_new));
                                }
-
-                               g_event = new
-                               GHOST_EventCursor(
-                                       getMilliSeconds(),
-                                       GHOST_kEventCursorMove,
-                                       window,
-                                       xme.x_root + x_accum,
-                                       xme.y_root + y_accum
-                               );
-
+                               else {
+                                       g_event = new
+                                       GHOST_EventCursor(
+                                               getMilliSeconds(),
+                                               GHOST_kEventCursorMove,
+                                               window,
+                                               xme.x_root + x_accum,
+                                               xme.y_root + y_accum
+                                       );
+                               }
                        }
                        else {
                                g_event = new

Modified: trunk/blender/intern/ghost/intern/GHOST_WindowX11.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_WindowX11.cpp       2009-10-18 
05:19:46 UTC (rev 23916)
+++ trunk/blender/intern/ghost/intern/GHOST_WindowX11.cpp       2009-10-18 
09:55:39 UTC (rev 23917)
@@ -1419,6 +1419,13 @@
                        setWindowCursorVisibility(true);
                }
 
+               if(m_cursorGrab != GHOST_kGrabNormal) {
+                       /* use to generate a mouse move event, otherwise the 
last event
+                        * blender gets can be outside the screen causing menus 
not to show
+                        * properly unless the user moves the mouse */
+                       XWarpPointer(m_display,None,None,0,0,0,0,0,0);
+               }
+
                /* Almost works without but important otherwise the mouse GHOST 
location can be incorrect on exit */
                setCursorGrabAccum(0, 0);
                m_cursorGrabBounds.m_l= m_cursorGrabBounds.m_r= -1; /* disable 
*/

Modified: trunk/blender/source/blender/windowmanager/intern/wm_cursors.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_cursors.c      
2009-10-18 05:19:46 UTC (rev 23916)
+++ trunk/blender/source/blender/windowmanager/intern/wm_cursors.c      
2009-10-18 09:55:39 UTC (rev 23917)
@@ -169,7 +169,6 @@
         * It helps not to get a stuck WM when hitting a breakpoint  
         * */
        GHOST_TGrabCursorMode mode = GHOST_kGrabNormal;
-       int bounds_arr[4] = {-1, -1, -1, -1}; /* l/t/r/b */
 
        if(hide)                mode = GHOST_kGrabHide;
        else if(wrap)   mode = GHOST_kGrabWrap;


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to