Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/windowmanager/intern/wm_event_system.c')
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index c2df53c9e91..26d72906ece 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -2387,18 +2387,11 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
if(win->active) {
GHOST_TEventCursorData *cd= customdata;
wmEvent *lastevent= win->queue.last;
-
-#if defined(__APPLE__) && defined(GHOST_COCOA)
- //Cocoa already uses coordinates with y=0 at bottom, and returns inwindow coordinates on mouse moved event
- evt->x= cd->x;
- evt->y= cd->y;
-#else
int cx, cy;
GHOST_ScreenToClient(win->ghostwin, cd->x, cd->y, &cx, &cy);
evt->x= cx;
evt->y= (win->sizey-1) - cy;
-#endif
event.x= evt->x;
event.y= evt->y;
@@ -2445,21 +2438,17 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
event.type= MOUSEPAN;
break;
}
-#if defined(__APPLE__) && defined(GHOST_COCOA)
- //Cocoa already uses coordinates with y=0 at bottom, and returns inwindow coordinates on mouse moved event
- event.x= evt->x = pd->x;
- event.y = evt->y = pd->y;
-#else
+
{
- int cx, cy;
- GHOST_ScreenToClient(win->ghostwin, pd->x, pd->y, &cx, &cy);
- event.x= evt->x= cx;
- event.y= evt->y= (win->sizey-1) - cy;
+ int cx, cy;
+ GHOST_ScreenToClient(win->ghostwin, pd->x, pd->y, &cx, &cy);
+ event.x= evt->x= cx;
+ event.y= evt->y= (win->sizey-1) - cy;
}
-#endif
+
// Use prevx/prevy so we can calculate the delta later
event.prevx= event.x - pd->deltaX;
- event.prevy= event.y - pd->deltaY;
+ event.prevy= event.y - (-pd->deltaY);
update_tablet_data(win, &event);
wm_event_add(win, &event);
@@ -2482,6 +2471,16 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
else
event.type= MIDDLEMOUSE;
+ if(win->active==0) {
+ int cx, cy;
+
+ /* entering window, update mouse pos. (ghost sends win-activate *after* the mouseclick in window!) */
+ wm_get_cursor_position(win, &cx, &cy);
+
+ event.x= evt->x= cx;
+ event.y= evt->y= cy;
+ }
+
/* add to other window if event is there (not to both!) */
owin= wm_event_cursor_other_windows(wm, win, &event);
if(owin) {