Fixes the freeze on Mac OSX when a Quicktime Settings window for Compression was brought up. Blender swallowed every event, not giving Quicktime a change to receive update events and mouse clicks.

This commit is contained in:
Maarten Gribnau 2003-12-31 15:47:09 +00:00
parent 84780ae764
commit f351708967

@ -608,14 +608,19 @@ GHOST_TSuccess GHOST_SystemCarbon::exit()
OSStatus GHOST_SystemCarbon::handleWindowEvent(EventRef event) OSStatus GHOST_SystemCarbon::handleWindowEvent(EventRef event)
{ {
WindowRef windowRef;
GHOST_WindowCarbon *window; GHOST_WindowCarbon *window;
OSStatus err = eventNotHandledErr;
// Check if the event was send to a GHOST window
::GetEventParameter(event, kEventParamDirectObject, typeWindowRef, NULL, sizeof(WindowRef), NULL, &windowRef);
window = (GHOST_WindowCarbon*) ::GetWRefCon(windowRef);
if (!validWindow(window)) {
return err;
}
if (!getFullScreen()) { if (!getFullScreen()) {
WindowRef windowref; err = noErr;
::GetEventParameter(event, kEventParamDirectObject, typeWindowRef, NULL, sizeof(WindowRef), NULL, &windowref);
window = (GHOST_WindowCarbon*) ::GetWRefCon(windowref);
if (validWindow(window)) {
switch(::GetEventKind(event)) switch(::GetEventKind(event))
{ {
case kEventWindowClose: case kEventWindowClose:
@ -641,7 +646,9 @@ OSStatus GHOST_SystemCarbon::handleWindowEvent(EventRef event)
pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window) ); pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window) );
} }
break; break;
} default:
err = eventNotHandledErr;
break;
} }
} }
//else { //else {
@ -650,11 +657,12 @@ OSStatus GHOST_SystemCarbon::handleWindowEvent(EventRef event)
//::RemoveEventFromQueue(::GetMainEventQueue(), event); //::RemoveEventFromQueue(::GetMainEventQueue(), event);
//} //}
return noErr; return err;
} }
OSStatus GHOST_SystemCarbon::handleMouseEvent(EventRef event) OSStatus GHOST_SystemCarbon::handleMouseEvent(EventRef event)
{ {
OSStatus err = eventNotHandledErr;
GHOST_IWindow* window = m_windowManager->getActiveWindow(); GHOST_IWindow* window = m_windowManager->getActiveWindow();
UInt32 kind = ::GetEventKind(event); UInt32 kind = ::GetEventKind(event);
@ -664,15 +672,17 @@ OSStatus GHOST_SystemCarbon::handleMouseEvent(EventRef event)
case kEventMouseUp: case kEventMouseUp:
// Handle Mac application responsibilities // Handle Mac application responsibilities
if ((kind == kEventMouseDown) && handleMouseDown(event)) { if ((kind == kEventMouseDown) && handleMouseDown(event)) {
; err = noErr;
} else { }
else {
GHOST_TEventType type = (kind == kEventMouseDown) ? GHOST_kEventButtonDown : GHOST_kEventButtonUp; GHOST_TEventType type = (kind == kEventMouseDown) ? GHOST_kEventButtonDown : GHOST_kEventButtonUp;
EventMouseButton button; EventMouseButton button;
/* Window still gets mouse up after command-H */ /* Window still gets mouse up after command-H */
if (window) { if (m_windowManager->getActiveWindow()) {
::GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(button), NULL, &button); ::GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(button), NULL, &button);
pushEvent(new GHOST_EventButton(getMilliSeconds(), type, window, convertButton(button))); pushEvent(new GHOST_EventButton(getMilliSeconds(), type, window, convertButton(button)));
err = noErr;
} }
} }
break; break;
@ -683,6 +693,7 @@ OSStatus GHOST_SystemCarbon::handleMouseEvent(EventRef event)
if (window) { if (window) {
::GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &mousePos); ::GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &mousePos);
pushEvent(new GHOST_EventCursor(getMilliSeconds(), GHOST_kEventCursorMove, window, mousePos.h, mousePos.v)); pushEvent(new GHOST_EventCursor(getMilliSeconds(), GHOST_kEventCursorMove, window, mousePos.h, mousePos.v));
err = noErr;
} }
break; break;
@ -705,17 +716,19 @@ OSStatus GHOST_SystemCarbon::handleMouseEvent(EventRef event)
*/ */
delta = delta > 0 ? 1 : -1; delta = delta > 0 ? 1 : -1;
pushEvent(new GHOST_EventWheel(getMilliSeconds(), window, delta)); pushEvent(new GHOST_EventWheel(getMilliSeconds(), window, delta));
err = noErr;
} }
} }
break; break;
} }
return noErr; return err;
} }
OSStatus GHOST_SystemCarbon::handleKeyEvent(EventRef event) OSStatus GHOST_SystemCarbon::handleKeyEvent(EventRef event)
{ {
OSStatus err = eventNotHandledErr;
GHOST_IWindow* window = m_windowManager->getActiveWindow(); GHOST_IWindow* window = m_windowManager->getActiveWindow();
UInt32 kind = ::GetEventKind(event); UInt32 kind = ::GetEventKind(event);
UInt32 modifiers; UInt32 modifiers;
@ -727,11 +740,12 @@ OSStatus GHOST_SystemCarbon::handleKeyEvent(EventRef event)
* the window go away and we still get an HKey up. * the window go away and we still get an HKey up.
*/ */
if (!window) { if (!window) {
::GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &rawCode); //::GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &rawCode);
key = convertKey(rawCode); //key = convertKey(rawCode);
return noErr; return err;
} }
err = noErr;
switch (kind) { switch (kind) {
case kEventRawKeyDown: case kEventRawKeyDown:
case kEventRawKeyRepeat: case kEventRawKeyRepeat:
@ -773,9 +787,13 @@ OSStatus GHOST_SystemCarbon::handleKeyEvent(EventRef event)
m_modifierMask = modifiers; m_modifierMask = modifiers;
break; break;
default:
err = eventNotHandledErr;
break;
} }
return noErr; return err;
} }