зеркало из https://github.com/mozilla/gecko-dev.git
create a new window type for the hidden window so that we can recognize it from Widget. On MacOSX, override the carbon event that repositions windows on-screen for the hidden window only. Let normal windows pass-through. r=danm/sr=sfraser/a=asa. bug 84023.
This commit is contained in:
Родитель
cf700c7c6b
Коммит
48991000e0
|
@ -94,7 +94,9 @@ enum nsWindowType {
|
||||||
// used for combo boxes, etc
|
// used for combo boxes, etc
|
||||||
eWindowType_popup,
|
eWindowType_popup,
|
||||||
// child windows (contained inside a window on the desktop (has no border))
|
// child windows (contained inside a window on the desktop (has no border))
|
||||||
eWindowType_child
|
eWindowType_child,
|
||||||
|
// windows that are invisible or offscreen
|
||||||
|
eWindowType_invisible
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,12 @@
|
||||||
|
|
||||||
#include <Quickdraw.h>
|
#include <Quickdraw.h>
|
||||||
|
|
||||||
|
#ifdef TARGET_CARBON
|
||||||
|
enum {
|
||||||
|
kEventWindowConstrain = 83 // BAD!!! our CarbonEvents.h don't yet support this
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
// Define Class IDs -- i hate having to do this
|
// Define Class IDs -- i hate having to do this
|
||||||
static NS_DEFINE_CID(kCDragServiceCID, NS_DRAGSERVICE_CID);
|
static NS_DEFINE_CID(kCDragServiceCID, NS_DRAGSERVICE_CID);
|
||||||
static const char *sScreenManagerContractID = "@mozilla.org/gfx/screenmanager;1";
|
static const char *sScreenManagerContractID = "@mozilla.org/gfx/screenmanager;1";
|
||||||
|
@ -451,14 +457,10 @@ nsresult nsMacWindow::StandardCreate(nsIWidget *aParent,
|
||||||
hOffset = kWindowMarginWidth;
|
hOffset = kWindowMarginWidth;
|
||||||
vOffset = kWindowTitleBarHeight;
|
vOffset = kWindowTitleBarHeight;
|
||||||
break;
|
break;
|
||||||
/*
|
|
||||||
case eBorderStyle_3DChildWindow:
|
case eWindowType_invisible:
|
||||||
wDefProcID = altDBoxProc;
|
// don't do anything
|
||||||
goAwayFlag = false;
|
break;
|
||||||
hOffset = 0;
|
|
||||||
vOffset = 0;
|
|
||||||
break;
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// now turn off some default features if requested by aInitData
|
// now turn off some default features if requested by aInitData
|
||||||
|
@ -544,10 +546,12 @@ nsresult nsMacWindow::StandardCreate(nsIWidget *aParent,
|
||||||
// Setup the live window resizing
|
// Setup the live window resizing
|
||||||
if ( mWindowType == eWindowType_toplevel ) {
|
if ( mWindowType == eWindowType_toplevel ) {
|
||||||
const UInt32 kWindowLiveResizeAttribute = (1L << 28); // BAD!!! our headers don't yet support this
|
const UInt32 kWindowLiveResizeAttribute = (1L << 28); // BAD!!! our headers don't yet support this
|
||||||
|
|
||||||
::ChangeWindowAttributes ( mWindowPtr, kWindowLiveResizeAttribute, kWindowNoAttributes );
|
::ChangeWindowAttributes ( mWindowPtr, kWindowLiveResizeAttribute, kWindowNoAttributes );
|
||||||
|
|
||||||
EventTypeSpec windEventList[] = { {kEventClassWindow, kEventWindowBoundsChanged} };
|
EventTypeSpec windEventList[] = { {kEventClassWindow, kEventWindowBoundsChanged},
|
||||||
OSStatus err = ::InstallWindowEventHandler ( mWindowPtr, NewEventHandlerUPP(WindowEventHandler), 1, windEventList, this, NULL );
|
{kEventClassWindow, kEventWindowConstrain} };
|
||||||
|
OSStatus err = ::InstallWindowEventHandler ( mWindowPtr, NewEventHandlerUPP(WindowEventHandler), 2, windEventList, this, NULL );
|
||||||
// note, passing NULL as the final param to IWEH() causes the UPP to be disposed automatically
|
// note, passing NULL as the final param to IWEH() causes the UPP to be disposed automatically
|
||||||
// when the event target (the window) goes away. See CarbonEvents.h for info.
|
// when the event target (the window) goes away. See CarbonEvents.h for info.
|
||||||
NS_ASSERTION(err == noErr, "Couldn't install Carbon Event handler");
|
NS_ASSERTION(err == noErr, "Couldn't install Carbon Event handler");
|
||||||
|
@ -596,6 +600,8 @@ nsresult nsMacWindow::StandardCreate(nsIWidget *aParent,
|
||||||
pascal OSStatus
|
pascal OSStatus
|
||||||
nsMacWindow :: WindowEventHandler ( EventHandlerCallRef inHandlerChain, EventRef inEvent, void* userData )
|
nsMacWindow :: WindowEventHandler ( EventHandlerCallRef inHandlerChain, EventRef inEvent, void* userData )
|
||||||
{
|
{
|
||||||
|
OSStatus retVal = noErr;
|
||||||
|
|
||||||
WindowRef myWind = NULL;
|
WindowRef myWind = NULL;
|
||||||
::GetEventParameter ( inEvent, kEventParamDirectObject, typeWindowRef, NULL, sizeof(myWind), NULL, &myWind );
|
::GetEventParameter ( inEvent, kEventParamDirectObject, typeWindowRef, NULL, sizeof(myWind), NULL, &myWind );
|
||||||
if ( myWind ) {
|
if ( myWind ) {
|
||||||
|
@ -603,6 +609,7 @@ nsMacWindow :: WindowEventHandler ( EventHandlerCallRef inHandlerChain, EventRef
|
||||||
switch ( what ) {
|
switch ( what ) {
|
||||||
|
|
||||||
case kEventWindowBoundsChanged:
|
case kEventWindowBoundsChanged:
|
||||||
|
{
|
||||||
Rect bounds;
|
Rect bounds;
|
||||||
::InvalWindowRect(myWind, ::GetWindowPortBounds(myWind, &bounds));
|
::InvalWindowRect(myWind, ::GetWindowPortBounds(myWind, &bounds));
|
||||||
|
|
||||||
|
@ -613,7 +620,20 @@ nsMacWindow :: WindowEventHandler ( EventHandlerCallRef inHandlerChain, EventRef
|
||||||
self->mMacEventHandler->UpdateEvent();
|
self->mMacEventHandler->UpdateEvent();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case kEventWindowConstrain:
|
||||||
|
{
|
||||||
|
// Ignore this event if we're an invisible window, otherwise pass along the
|
||||||
|
// chain to ensure it's onscreen.
|
||||||
|
nsMacWindow* self = NS_REINTERPRET_CAST(nsMacWindow*, userData);
|
||||||
|
if ( self ) {
|
||||||
|
if ( self->mWindowType != eWindowType_invisible )
|
||||||
|
retVal = ::CallNextEventHandler( inHandlerChain, inEvent );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// do nothing...
|
// do nothing...
|
||||||
break;
|
break;
|
||||||
|
@ -621,7 +641,7 @@ nsMacWindow :: WindowEventHandler ( EventHandlerCallRef inHandlerChain, EventRef
|
||||||
} // case of which event?
|
} // case of which event?
|
||||||
}
|
}
|
||||||
|
|
||||||
return noErr;
|
return retVal;
|
||||||
|
|
||||||
} // WindowEventHandler
|
} // WindowEventHandler
|
||||||
|
|
||||||
|
|
|
@ -594,8 +594,13 @@ nsAppShellService::JustCreateTopWindow(nsIXULWindow *aParent,
|
||||||
else {
|
else {
|
||||||
nsWidgetInitData widgetInitData;
|
nsWidgetInitData widgetInitData;
|
||||||
|
|
||||||
widgetInitData.mWindowType = aChromeMask & nsIWebBrowserChrome::CHROME_OPENAS_DIALOG ?
|
#if TARGET_CARBON
|
||||||
eWindowType_dialog : eWindowType_toplevel;
|
if (aIsHiddenWindow)
|
||||||
|
widgetInitData.mWindowType = eWindowType_invisible;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
widgetInitData.mWindowType = aChromeMask & nsIWebBrowserChrome::CHROME_OPENAS_DIALOG ?
|
||||||
|
eWindowType_dialog : eWindowType_toplevel;
|
||||||
|
|
||||||
// note default chrome overrides other OS chrome settings, but
|
// note default chrome overrides other OS chrome settings, but
|
||||||
// not internal chrome
|
// not internal chrome
|
||||||
|
|
Загрузка…
Ссылка в новой задаче