Fix for bug 277845 (live sheet resizing is broken (regression from bug 223545)). r=pedemonte, sr=smfr.

This commit is contained in:
peterv%propagandism.org 2005-01-25 14:06:59 +00:00
Родитель 516f51c581
Коммит e02251330d
1 изменённых файлов: 35 добавлений и 25 удалений

Просмотреть файл

@ -538,35 +538,45 @@ nsresult nsMacWindow::StandardCreate(nsIWidget *aParent,
::SetWindowActivationScope(mWindowPtr, kWindowActivationScopeNone);
}
else if ( mWindowType == eWindowType_toplevel ) {
EventTypeSpec scrollEventList[] = { {kEventClassMouse, kEventMouseWheelMoved} };
err = ::InstallWindowEventHandler ( mWindowPtr, NewEventHandlerUPP(ScrollEventHandler), 1, scrollEventList, this, NULL );
// 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.
NS_ASSERTION(err == noErr, "Couldn't install Carbon Scroll Event handlers");
}
if (mIsSheet)
{
// Mac OS X sheet support
EventTypeSpec windEventList[] = { {kEventClassWindow, kEventWindowUpdate},
{kEventClassWindow, kEventWindowDrawContent} };
err = ::InstallWindowEventHandler ( mWindowPtr,
NewEventHandlerUPP(WindowEventHandler), 2, windEventList, this, NULL );
NS_ASSERTION(err == noErr, "Couldn't install sheet Event handlers");
}
// Since we can only call IWEH() once for each event class such as kEventClassWindow, we register all the event types that
// we are going to handle here
const EventTypeSpec windEventList[] = {
{kEventClassWindow, kEventWindowBoundsChanged}, // to enable live resizing
{kEventClassWindow, kEventWindowCollapse}, // to roll up popups when we're minimized
{kEventClassWindow, kEventWindowConstrain} // to keep invisible windows off the screen
const EventTypeSpec scrollEventList[] = {
{ kEventClassMouse, kEventMouseWheelMoved }
};
err = ::InstallWindowEventHandler ( mWindowPtr, NewEventHandlerUPP(WindowEventHandler),
GetEventTypeCount(windEventList), windEventList, this, NULL );
NS_ASSERTION(err == noErr, "Couldn't install Carbon window event handler");
// 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.
err = ::InstallWindowEventHandler(mWindowPtr,
NewEventHandlerUPP(ScrollEventHandler),
GetEventTypeCount(scrollEventList),
scrollEventList, this, NULL);
NS_ASSERTION(err == noErr,
"Couldn't install Carbon Scroll Event handlers");
}
// Since we can only call IWEH() once for each event class such as
// kEventClassWindow, we register all the event types that we are going to
// handle here.
const EventTypeSpec windEventList[] = {
// to enable live resizing
{ kEventClassWindow, kEventWindowBoundsChanged },
// to roll up popups when we're minimized
{ kEventClassWindow, kEventWindowCollapse },
// to keep invisible windows off the screen
{ kEventClassWindow, kEventWindowConstrain },
// Last two are only for sheets.
{ kEventClassWindow, kEventWindowUpdate },
{ kEventClassWindow, kEventWindowDrawContent }
};
// kEventWindowUpdate and kEventWindowDrawContent are only for sheets.
PRUint32 typeCount = mIsSheet ? GetEventTypeCount(windEventList) :
GetEventTypeCount(windEventList) - 2;
err = ::InstallWindowEventHandler(mWindowPtr,
NewEventHandlerUPP(WindowEventHandler),
typeCount, windEventList, this, NULL);
NS_ASSERTION(err == noErr, "Couldn't install sheet Event handlers");
// register tracking and receive handlers with the native Drag Manager
if ( mDragTrackingHandlerUPP ) {