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
path: root/intern
diff options
context:
space:
mode:
authorDamien Plisson <damien.plisson@yahoo.fr>2010-02-10 17:16:02 +0300
committerDamien Plisson <damien.plisson@yahoo.fr>2010-02-10 17:16:02 +0300
commit586acf21a74e836e8585c230beb56c11bd23c27e (patch)
tree46e1a6973e18eda82fbabc6362d6e88cf07ffb2e /intern
parentbed4c49a794c1d030c502e80b3253739b981727e (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 'intern')
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.mm36
1 files changed, 12 insertions, 24 deletions
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index 4371d4d19c8..30cc672a7cc 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -1322,16 +1322,12 @@ bool GHOST_SystemCocoa::handleOpenDocumentRequest(void *filepathStr)
GHOST_TSuccess GHOST_SystemCocoa::handleTabletEvent(void *eventPtr, short eventType)
{
NSEvent *event = (NSEvent *)eventPtr;
- GHOST_IWindow* window = m_windowManager->getActiveWindow();
+ GHOST_IWindow* window;
+ window = m_windowManager->getWindowAssociatedWithOSWindow((void*)[event window]);
if (!window) {
- /* If no active window found, still tries to find the window associated with the event
- This may happen when Cocoa continues to send some events after the window deactivate one */
- window = m_windowManager->getWindowAssociatedWithOSWindow((void*)[event window]);
- if (!window) {
- //printf("\nW failure for event 0x%x",[event type]);
- return GHOST_kFailure;
- }
+ //printf("\nW failure for event 0x%x",[event type]);
+ return GHOST_kFailure;
}
GHOST_TabletData& ct=((GHOST_WindowCocoa*)window)->GetCocoaTabletData();
@@ -1381,16 +1377,12 @@ GHOST_TSuccess GHOST_SystemCocoa::handleTabletEvent(void *eventPtr, short eventT
GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
{
NSEvent *event = (NSEvent *)eventPtr;
- GHOST_Window* window = (GHOST_Window*)m_windowManager->getActiveWindow();
+ GHOST_Window* window;
+ window = (GHOST_Window*)m_windowManager->getWindowAssociatedWithOSWindow((void*)[event window]);
if (!window) {
- /* If no active window found, still tries to find the window associated with the event
- This may happen when Cocoa continues to send some events after the window deactivate one */
- window = (GHOST_Window*)m_windowManager->getWindowAssociatedWithOSWindow((void*)[event window]);
- if (!window) {
- //printf("\nW failure for event 0x%x",[event type]);
- return GHOST_kFailure;
- }
+ //printf("\nW failure for event 0x%x",[event type]);
+ return GHOST_kFailure;
}
switch ([event type])
@@ -1586,7 +1578,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr)
{
NSEvent *event = (NSEvent *)eventPtr;
- GHOST_IWindow* window = m_windowManager->getActiveWindow();
+ GHOST_IWindow* window;
unsigned int modifiers;
NSString *characters;
NSData *convertedCharacters;
@@ -1594,14 +1586,10 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr)
unsigned char ascii;
NSString* charsIgnoringModifiers;
+ window = m_windowManager->getWindowAssociatedWithOSWindow((void*)[event window]);
if (!window) {
- /* If no active window found, still tries to find the window associated with the event
- This may happen when Cocoa continues to send some events after the window deactivate one */
- window = m_windowManager->getWindowAssociatedWithOSWindow((void*)[event window]);
- if (!window) {
- //printf("\nW failure for event 0x%x",[event type]);
- return GHOST_kFailure;
- }
+ //printf("\nW failure for event 0x%x",[event type]);
+ return GHOST_kFailure;
}
switch ([event type]) {