diff --git a/mozilla/widget/src/mac/nsMacEventHandler.cpp b/mozilla/widget/src/mac/nsMacEventHandler.cpp index 0102930e29a..a75582afd82 100644 --- a/mozilla/widget/src/mac/nsMacEventHandler.cpp +++ b/mozilla/widget/src/mac/nsMacEventHandler.cpp @@ -111,6 +111,27 @@ void nsMacEventDispatchHandler::DispatchGuiEvent(nsWindow *aWidget, PRUint32 aEv aWidget->DispatchWindowEvent(guiEvent); } +//------------------------------------------------------------------------- +// +//------------------------------------------------------------------------- +void nsMacEventDispatchHandler::DispatchSizeModeEvent(nsWindow *aWidget, nsSizeMode aMode) +{ + NS_ASSERTION(aWidget,"attempted to dispatch gui event to null widget"); + if (!aWidget) + return; + + nsSizeModeEvent event; + event.eventStructType = NS_SIZEMODE_EVENT; + event.point.x = 0; + event.point.y = 0; + event.time = PR_IntervalNow(); + event.nativeMsg = nsnull; + event.message = NS_SIZEMODE; + event.widget = aWidget; + event.mSizeMode = aMode; + aWidget->DispatchWindowEvent(event); +} + //------------------------------------------------------------------------- // //------------------------------------------------------------------------- @@ -393,7 +414,7 @@ PRBool nsMacEventHandler::HandleMenuCommand( menuEvent.nativeMsg = (void*)&aOSEvent; // nsMenuEvent - menuEvent.mMenuItem = nsnull; //€TODO: initialize mMenuItem + menuEvent.mMenuItem = nsnull; //ÄTODO: initialize mMenuItem menuEvent.mCommand = aMenuResult; // dispatch the menu event @@ -442,7 +463,7 @@ PRBool nsMacEventHandler::HandleMenuCommand( // for processing. Create a Gecko event (using the appropriate message type) and pass // it along. // -// €€€THIS REALLY NEEDS TO BE CLEANED UP! TOO MUCH CODE COPIED FROM ConvertOSEventToMouseEvent +// ÄÄÄTHIS REALLY NEEDS TO BE CLEANED UP! TOO MUCH CODE COPIED FROM ConvertOSEventToMouseEvent // PRBool nsMacEventHandler::DragEvent ( unsigned int aMessage, Point aMouseGlobal, UInt16 aKeyModifiers ) { @@ -1013,7 +1034,7 @@ PRBool nsMacEventHandler::HandleActivateEvent(EventRecord& aOSEvent) } else { - //€TODO: if the focusedWidget doesn't have a menubar, + //ÄTODO: if the focusedWidget doesn't have a menubar, // look all the way up to the window // until one of the parents has a menubar } @@ -1153,6 +1174,9 @@ PRBool nsMacEventHandler::HandleMouseDownEvent( case inZoomIn: case inZoomOut: { + gEventDispatchHandler.DispatchSizeModeEvent(mTopLevelWidget, + partCode == inZoomIn ? nsSizeMode_Normal : nsSizeMode_Maximized); + // Now that we have found the partcode it is ok to actually zoom the window ZoomWindow(whichWindow, partCode, (whichWindow == FrontWindow())); diff --git a/mozilla/widget/src/mac/nsMacEventHandler.h b/mozilla/widget/src/mac/nsMacEventHandler.h index 8de1dae089a..ce88f497615 100644 --- a/mozilla/widget/src/mac/nsMacEventHandler.h +++ b/mozilla/widget/src/mac/nsMacEventHandler.h @@ -46,6 +46,7 @@ public: virtual ~nsMacEventDispatchHandler(); void DispatchGuiEvent(nsWindow *aWidget, PRUint32 aEventType); + void DispatchSizeModeEvent(nsWindow *aWidget, nsSizeMode aMode); void SetFocus(nsWindow *aFocusedWidget); diff --git a/mozilla/widget/src/windows/nsWindow.cpp b/mozilla/widget/src/windows/nsWindow.cpp index c9926bcbeeb..89f99718998 100644 --- a/mozilla/widget/src/windows/nsWindow.cpp +++ b/mozilla/widget/src/windows/nsWindow.cpp @@ -2054,6 +2054,23 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT } break; + case WM_SYSCOMMAND: + // all we care about right now are the minimize and maximize buttons + if (wParam == SC_MINIMIZE || wParam == SC_MAXIMIZE || wParam == SC_RESTORE) { + nsSizeModeEvent event; + event.eventStructType = NS_SIZEMODE_EVENT; + event.mSizeMode = nsSizeMode_Normal; + if (wParam == SC_MINIMIZE) + event.mSizeMode = nsSizeMode_Minimized; + if (wParam == SC_MAXIMIZE) + event.mSizeMode = nsSizeMode_Maximized; + InitEvent(event, NS_SIZEMODE); + + result = DispatchWindowEvent(&event); + NS_RELEASE(event.widget); + } + break; + case WM_DISPLAYCHANGE: DispatchStandardEvent(NS_DISPLAYCHANGED); break;