mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
changed activate event handling, special casing plainDBox window variant when showing a window, to keep swing menus from unhiliting the parent frame.
This commit is contained in:
parent
dce6117b2e
commit
a6847586ec
@ -421,7 +421,7 @@ private:
|
||||
RegisteredWindow* mNext;
|
||||
nsIEventHandler* mHandler;
|
||||
nsPluginPlatformWindowRef mWindow;
|
||||
|
||||
|
||||
RegisteredWindow(RegisteredWindow* next, nsIEventHandler* handler, nsPluginPlatformWindowRef window)
|
||||
: mNext(next), mHandler(handler), mWindow(window)
|
||||
{
|
||||
@ -1530,6 +1530,7 @@ CPluginManager::RegisteredWindow* CPluginManager::FindRegisteredWindow(nsPluginP
|
||||
return (link != NULL ? *link : NULL);
|
||||
}
|
||||
|
||||
|
||||
NS_METHOD
|
||||
CPluginManager::RegisterWindow(nsIEventHandler* handler, nsPluginPlatformWindowRef window)
|
||||
{
|
||||
@ -1542,9 +1543,16 @@ CPluginManager::RegisterWindow(nsIEventHandler* handler, nsPluginPlatformWindowR
|
||||
mEventFiltersInstalled = true;
|
||||
}
|
||||
|
||||
// plugin expect the window to be shown and selected at this point.
|
||||
::ShowWindow(window);
|
||||
::SelectWindow(window);
|
||||
// plugin expects the window to be shown and selected at this point.
|
||||
|
||||
SInt16 variant = ::GetWVariant(window);
|
||||
if (variant == plainDBox) {
|
||||
::ShowHide(window, true);
|
||||
::BringToFront(window);
|
||||
} else {
|
||||
::ShowWindow(window);
|
||||
::SelectWindow(window);
|
||||
}
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
@ -1577,16 +1585,21 @@ CPluginManager::UnregisterWindow(nsIEventHandler* handler, nsPluginPlatformWindo
|
||||
|
||||
#ifdef XP_MAC
|
||||
|
||||
static EventRecord* makeActivateEvent(EventRecord* event, WindowRef window, Boolean active)
|
||||
static void sendActivateEvent(nsIEventHandler* handler, WindowRef window, Boolean active)
|
||||
{
|
||||
::OSEventAvail(0, event);
|
||||
event->what = activateEvt;
|
||||
event->message = UInt32(window);
|
||||
EventRecord event;
|
||||
::OSEventAvail(0, &event);
|
||||
event.what = activateEvt;
|
||||
event.message = UInt32(window);
|
||||
if (active)
|
||||
event->modifiers |= activeFlag;
|
||||
event.modifiers |= activeFlag;
|
||||
else
|
||||
event->modifiers &= ~activeFlag;
|
||||
return event;
|
||||
event.modifiers &= ~activeFlag;
|
||||
|
||||
nsPluginEvent pluginEvent = { &event, window };
|
||||
PRBool handled = PR_FALSE;
|
||||
|
||||
handler->HandleEvent(&pluginEvent, &handled);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1609,6 +1622,19 @@ Boolean CPluginManager::EventFilter(EventRecord* event)
|
||||
|
||||
// see if this event is for one of our registered windows.
|
||||
switch (event->what) {
|
||||
case nullEvent:
|
||||
// See if the frontmost window is one of our registered windows.
|
||||
// we want to somehow deliver mouse enter/leave events.
|
||||
window = ::FrontWindow();
|
||||
registeredWindow = FindRegisteredWindow(window);
|
||||
if (registeredWindow != NULL) {
|
||||
simulatedEvent = *event;
|
||||
simulatedEvent.what = nsPluginEventType_AdjustCursorEvent;
|
||||
pluginEvent.event = &simulatedEvent;
|
||||
pluginEvent.window = registeredWindow->mWindow;
|
||||
registeredWindow->mHandler->HandleEvent(&pluginEvent, &handled);
|
||||
}
|
||||
break;
|
||||
case keyDown:
|
||||
case keyUp:
|
||||
case autoKey:
|
||||
@ -1635,6 +1661,11 @@ Boolean CPluginManager::EventFilter(EventRecord* event)
|
||||
case inProxyIcon:
|
||||
registeredWindow = FindRegisteredWindow(window);
|
||||
if (registeredWindow != NULL) {
|
||||
// make sure this window has been activated before passing it the click.
|
||||
if (theActiveWindow == NULL) {
|
||||
sendActivateEvent(registeredWindow->mHandler, window, true);
|
||||
theActiveWindow = registeredWindow;
|
||||
}
|
||||
pluginEvent.window = window;
|
||||
registeredWindow->mHandler->HandleEvent(&pluginEvent, &handled);
|
||||
filteredEvent = true;
|
||||
@ -1643,10 +1674,8 @@ Boolean CPluginManager::EventFilter(EventRecord* event)
|
||||
// the browser doesn't seem to be generating a deactivate event.
|
||||
// I think this is because PowerPlant is managing the windows, dang it.
|
||||
window = theActiveWindow->mWindow;
|
||||
pluginEvent.event = makeActivateEvent(&simulatedEvent, window, false);
|
||||
pluginEvent.window = window;
|
||||
sendActivateEvent(theActiveWindow->mHandler, window, false);
|
||||
::HiliteWindow(window, false);
|
||||
theActiveWindow->mHandler->HandleEvent(&pluginEvent, &handled);
|
||||
theActiveWindow = NULL;
|
||||
}
|
||||
break;
|
||||
@ -1675,7 +1704,7 @@ Boolean CPluginManager::EventFilter(EventRecord* event)
|
||||
if (registeredWindow != NULL) {
|
||||
window = registeredWindow->mWindow;
|
||||
Boolean active = (event->message & resumeFlag) != 0;
|
||||
pluginEvent.event = makeActivateEvent(&simulatedEvent, window, active);
|
||||
sendActivateEvent(registeredWindow->mHandler, window, active);
|
||||
pluginEvent.window = window;
|
||||
registeredWindow->mHandler->HandleEvent(&pluginEvent, &handled);
|
||||
::HiliteWindow(window, active);
|
||||
|
Loading…
Reference in New Issue
Block a user