forked from bartvdbraak/blender
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:
parent
84780ae764
commit
f351708967
@ -608,40 +608,47 @@ 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);
|
switch(::GetEventKind(event))
|
||||||
window = (GHOST_WindowCarbon*) ::GetWRefCon(windowref);
|
{
|
||||||
|
case kEventWindowClose:
|
||||||
if (validWindow(window)) {
|
pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowClose, window) );
|
||||||
switch(::GetEventKind(event))
|
break;
|
||||||
{
|
case kEventWindowActivated:
|
||||||
case kEventWindowClose:
|
m_windowManager->setActiveWindow(window);
|
||||||
pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowClose, window) );
|
window->loadCursor(window->getCursorVisibility(), window->getCursorShape());
|
||||||
break;
|
pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowActivate, window) );
|
||||||
case kEventWindowActivated:
|
break;
|
||||||
m_windowManager->setActiveWindow(window);
|
case kEventWindowDeactivated:
|
||||||
window->loadCursor(window->getCursorVisibility(), window->getCursorShape());
|
m_windowManager->setWindowInactive(window);
|
||||||
pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowActivate, window) );
|
pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowDeactivate, window) );
|
||||||
break;
|
break;
|
||||||
case kEventWindowDeactivated:
|
case kEventWindowUpdate:
|
||||||
m_windowManager->setWindowInactive(window);
|
//if (getFullScreen()) GHOST_PRINT("GHOST_SystemCarbon::handleWindowEvent(): full-screen update event\n");
|
||||||
pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowDeactivate, window) );
|
pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowUpdate, window) );
|
||||||
break;
|
break;
|
||||||
case kEventWindowUpdate:
|
case kEventWindowBoundsChanged:
|
||||||
//if (getFullScreen()) GHOST_PRINT("GHOST_SystemCarbon::handleWindowEvent(): full-screen update event\n");
|
if (!m_ignoreWindowSizedMessages)
|
||||||
pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowUpdate, window) );
|
{
|
||||||
break;
|
window->updateDrawingContext();
|
||||||
case kEventWindowBoundsChanged:
|
pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window) );
|
||||||
if (!m_ignoreWindowSizedMessages)
|
}
|
||||||
{
|
break;
|
||||||
window->updateDrawingContext();
|
default:
|
||||||
pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window) );
|
err = eventNotHandledErr;
|
||||||
}
|
break;
|
||||||
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);
|
||||||
|
|
||||||
@ -662,17 +670,19 @@ OSStatus GHOST_SystemCarbon::handleMouseEvent(EventRef event)
|
|||||||
{
|
{
|
||||||
case kEventMouseDown:
|
case kEventMouseDown:
|
||||||
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;
|
||||||
@ -723,59 +736,64 @@ OSStatus GHOST_SystemCarbon::handleKeyEvent(EventRef event)
|
|||||||
GHOST_TKey key;
|
GHOST_TKey key;
|
||||||
unsigned char ascii;
|
unsigned char ascii;
|
||||||
|
|
||||||
/* Can happen, very rarely - seems to only be when command-H makes
|
/* Can happen, very rarely - seems to only be when command-H makes
|
||||||
* 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:
|
||||||
case kEventRawKeyUp:
|
case kEventRawKeyUp:
|
||||||
::GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &rawCode);
|
::GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &rawCode);
|
||||||
::GetEventParameter(event, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &ascii);
|
::GetEventParameter(event, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &ascii);
|
||||||
|
|
||||||
key = convertKey(rawCode);
|
key = convertKey(rawCode);
|
||||||
ascii= convertRomanToLatin(ascii);
|
ascii= convertRomanToLatin(ascii);
|
||||||
|
|
||||||
if (key!=GHOST_kKeyUnknown) {
|
if (key!=GHOST_kKeyUnknown) {
|
||||||
GHOST_TEventType type;
|
GHOST_TEventType type;
|
||||||
if (kind == kEventRawKeyDown) {
|
if (kind == kEventRawKeyDown) {
|
||||||
type = GHOST_kEventKeyDown;
|
type = GHOST_kEventKeyDown;
|
||||||
} else if (kind == kEventRawKeyRepeat) {
|
} else if (kind == kEventRawKeyRepeat) {
|
||||||
type = GHOST_kEventKeyDown; /* XXX, fixme */
|
type = GHOST_kEventKeyDown; /* XXX, fixme */
|
||||||
} else {
|
} else {
|
||||||
type = GHOST_kEventKeyUp;
|
type = GHOST_kEventKeyUp;
|
||||||
|
}
|
||||||
|
pushEvent( new GHOST_EventKey( getMilliSeconds(), type, window, key, ascii) );
|
||||||
}
|
}
|
||||||
pushEvent( new GHOST_EventKey( getMilliSeconds(), type, window, key, ascii) );
|
break;
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case kEventRawKeyModifiersChanged:
|
case kEventRawKeyModifiersChanged:
|
||||||
/* ugh */
|
/* ugh */
|
||||||
::GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
|
::GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
|
||||||
if ((modifiers & shiftKey) != (m_modifierMask & shiftKey)) {
|
if ((modifiers & shiftKey) != (m_modifierMask & shiftKey)) {
|
||||||
pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & shiftKey)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyLeftShift) );
|
pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & shiftKey)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyLeftShift) );
|
||||||
}
|
}
|
||||||
if ((modifiers & controlKey) != (m_modifierMask & controlKey)) {
|
if ((modifiers & controlKey) != (m_modifierMask & controlKey)) {
|
||||||
pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & controlKey)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyLeftControl) );
|
pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & controlKey)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyLeftControl) );
|
||||||
}
|
}
|
||||||
if ((modifiers & optionKey) != (m_modifierMask & optionKey)) {
|
if ((modifiers & optionKey) != (m_modifierMask & optionKey)) {
|
||||||
pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & optionKey)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyLeftAlt) );
|
pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & optionKey)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyLeftAlt) );
|
||||||
}
|
}
|
||||||
if ((modifiers & cmdKey) != (m_modifierMask & cmdKey)) {
|
if ((modifiers & cmdKey) != (m_modifierMask & cmdKey)) {
|
||||||
pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & cmdKey)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyCommand) );
|
pushEvent( new GHOST_EventKey(getMilliSeconds(), (modifiers & cmdKey)?GHOST_kEventKeyDown:GHOST_kEventKeyUp, window, GHOST_kKeyCommand) );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_modifierMask = modifiers;
|
m_modifierMask = modifiers;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
err = eventNotHandledErr;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return noErr;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user