diff options
author | Damien Plisson <damien.plisson@yahoo.fr> | 2010-02-10 17:16:02 +0300 |
---|---|---|
committer | Damien Plisson <damien.plisson@yahoo.fr> | 2010-02-10 17:16:02 +0300 |
commit | 586acf21a74e836e8585c230beb56c11bd23c27e (patch) | |
tree | 46e1a6973e18eda82fbabc6362d6e88cf07ffb2e /source | |
parent | bed4c49a794c1d030c502e80b3253739b981727e (diff) |
Cocoa : use Cocoa NSWindow tag for identifying the window where a mouse/tablet/key event happened => enables some actions in inactive windows as per OSX standard
Previous code was assuming an event can only be sent from the active window.
On OSX, Right, Middle mouse buttons, mouse wheel and trackpad events are sent to inactive windows too.
For example, this allows to zoom, pan the view without changing the window order.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 58 |
1 files changed, 28 insertions, 30 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 685e671c31a..4dfba0e3c6e 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -2090,39 +2090,37 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int t break; } case GHOST_kEventTrackpad: { - if (win->active) { - GHOST_TEventTrackpadData * pd = customdata; - switch (pd->subtype) { - case GHOST_kTrackpadEventMagnify: - event.type = MOUSEZOOM; - break; - case GHOST_kTrackpadEventRotate: - event.type = MOUSEROTATE; - break; - case GHOST_kTrackpadEventScroll: - default: - event.type= MOUSEPAN; - break; - } + GHOST_TEventTrackpadData * pd = customdata; + switch (pd->subtype) { + case GHOST_kTrackpadEventMagnify: + event.type = MOUSEZOOM; + break; + case GHOST_kTrackpadEventRotate: + event.type = MOUSEROTATE; + break; + case GHOST_kTrackpadEventScroll: + default: + 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; + //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; - - update_tablet_data(win, &event); - wm_event_add(win, &event); - } + // Use prevx/prevy so we can calculate the delta later + event.prevx= event.x - pd->deltaX; + event.prevy= event.y - pd->deltaY; + + update_tablet_data(win, &event); + wm_event_add(win, &event); break; } /* mouse button */ |