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); ::SetWindowActivationScope(mWindowPtr, kWindowActivationScopeNone);
} }
else if ( mWindowType == eWindowType_toplevel ) { else if ( mWindowType == eWindowType_toplevel ) {
EventTypeSpec scrollEventList[] = { {kEventClassMouse, kEventMouseWheelMoved} }; const EventTypeSpec scrollEventList[] = {
err = ::InstallWindowEventHandler ( mWindowPtr, NewEventHandlerUPP(ScrollEventHandler), 1, scrollEventList, this, NULL ); { kEventClassMouse, kEventMouseWheelMoved }
// 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. // 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"); NS_ASSERTION(err == noErr,
"Couldn't install Carbon Scroll Event handlers");
} }
if (mIsSheet) // 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
// Mac OS X sheet support // handle here.
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[] = { const EventTypeSpec windEventList[] = {
{kEventClassWindow, kEventWindowBoundsChanged}, // to enable live resizing // to enable live resizing
{kEventClassWindow, kEventWindowCollapse}, // to roll up popups when we're minimized { kEventClassWindow, kEventWindowBoundsChanged },
{kEventClassWindow, kEventWindowConstrain} // to keep invisible windows off the screen // to roll up popups when we're minimized
}; { kEventClassWindow, kEventWindowCollapse },
err = ::InstallWindowEventHandler ( mWindowPtr, NewEventHandlerUPP(WindowEventHandler), // to keep invisible windows off the screen
GetEventTypeCount(windEventList), windEventList, this, NULL ); { kEventClassWindow, kEventWindowConstrain },
NS_ASSERTION(err == noErr, "Couldn't install Carbon window event handler");
// 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 // register tracking and receive handlers with the native Drag Manager
if ( mDragTrackingHandlerUPP ) { if ( mDragTrackingHandlerUPP ) {