void wxMDIParentFrame::OnIconized(wxIconizeEvent& event) { event.Skip(); if ( !event.IsIconized() ) UpdateClientSize(); }
void wxMDIParentFrame::OnSize(wxSizeEvent& WXUNUSED(event)) { UpdateClientSize(); // do not call event.Skip() here, it somehow messes up MDI client window }
// Process messages from the frame MRESULT nsFrameWindow::FrameMessage( ULONG msg, MPARAM mp1, MPARAM mp2) { MRESULT mresult = 0; BOOL bDone = FALSE; switch (msg) { case WM_WINDOWPOSCHANGED: { PSWP pSwp = (PSWP) mp1; // Note that client windows never get 'move' messages (well, they won't here anyway) if( pSwp->fl & SWP_MOVE && !(pSwp->fl & SWP_MINIMIZE)) { // These commented-out `-1's cancel each other out. POINTL ptl = { pSwp->x, pSwp->y + pSwp->cy /* - 1 */ }; ptl.y = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN) - ptl.y /* - 1*/ ; mBounds.x = ptl.x; mBounds.y = ptl.y; OnMove( ptl.x, ptl.y); } // When the frame is sized, do stuff to recalculate client size. if( pSwp->fl & SWP_SIZE && !(pSwp->fl & SWP_MINIMIZE)) { mresult = (*fnwpDefFrame)( mFrameWnd, msg, mp1, mp2); bDone = TRUE; mBounds.width = pSwp->cx; mBounds.height = pSwp->cy; UpdateClientSize(); DispatchResizeEvent( mSizeClient.width, mSizeClient.height); } if (pSwp->fl & (SWP_MAXIMIZE | SWP_MINIMIZE | SWP_RESTORE)) { nsSizeModeEvent event(PR_TRUE, NS_SIZEMODE, this); if (pSwp->fl & SWP_MAXIMIZE) event.mSizeMode = nsSizeMode_Maximized; else if (pSwp->fl & SWP_MINIMIZE) event.mSizeMode = nsSizeMode_Minimized; else event.mSizeMode = nsSizeMode_Normal; InitEvent(event); DispatchWindowEvent(&event); } break; } // a frame window in kiosk/fullscreen mode must have its frame // controls reattached before it's minimized & detached after it's // restored; if this doesn't happen at the correct times, clicking // on the icon won't restore it, the sysmenu will have the wrong // items, and/or the minmax button will have the wrong buttons case WM_ADJUSTWINDOWPOS: { if (mChromeHidden && ((PSWP)mp1)->fl & SWP_MINIMIZE) { HWND hwndTemp = (HWND)WinQueryProperty(mFrameWnd, "hwndMinMax"); if (hwndTemp) WinSetParent(hwndTemp, mFrameWnd, TRUE); hwndTemp = (HWND)WinQueryProperty(mFrameWnd, "hwndTitleBar"); if (hwndTemp) WinSetParent(hwndTemp, mFrameWnd, TRUE); hwndTemp = (HWND)WinQueryProperty(mFrameWnd, "hwndSysMenu"); if (hwndTemp) WinSetParent(hwndTemp, mFrameWnd, TRUE); } break; } case WM_ADJUSTFRAMEPOS: { if (mChromeHidden && ((PSWP)mp1)->fl & SWP_RESTORE) { HWND hwndTemp = (HWND)WinQueryProperty(mFrameWnd, "hwndSysMenu"); if (hwndTemp) WinSetParent(hwndTemp, HWND_OBJECT, TRUE); hwndTemp = (HWND)WinQueryProperty(mFrameWnd, "hwndTitleBar"); if (hwndTemp) WinSetParent(hwndTemp, HWND_OBJECT, TRUE); hwndTemp = (HWND)WinQueryProperty(mFrameWnd, "hwndMinMax"); if (hwndTemp) WinSetParent(hwndTemp, HWND_OBJECT, TRUE); } break; } case WM_DESTROY: DEBUGFOCUS(frame WM_DESTROY); WinSubclassWindow( mFrameWnd, fnwpDefFrame); WinSetWindowPtr( mFrameWnd, QWL_USER, 0); WinRemoveProperty(mFrameWnd, "hwndTitleBar"); WinRemoveProperty(mFrameWnd, "hwndSysMenu"); WinRemoveProperty(mFrameWnd, "hwndMinMax"); WinRemoveProperty(mFrameWnd, "ulStyle"); break; case WM_INITMENU: /* If we are in fullscreen/kiosk mode, disable maximize menu item */ if (mChromeHidden) { if (WinQueryWindowULong(mFrameWnd, QWL_STYLE) & WS_MINIMIZED) { if (SHORT1FROMMP(mp1) == SC_SYSMENU) { MENUITEM menuitem; WinSendMsg(WinWindowFromID(mFrameWnd, FID_SYSMENU), MM_QUERYITEM, MPFROM2SHORT(SC_SYSMENU, FALSE), MPARAM(&menuitem)); mresult = (*fnwpDefFrame)( mFrameWnd, msg, mp1, mp2); WinEnableMenuItem(menuitem.hwndSubMenu, SC_MAXIMIZE, FALSE); bDone = TRUE; } } } break; case WM_SYSCOMMAND: /* If we are in fullscreen/kiosk mode, don't honor maximize requests */ if (mChromeHidden) { if (WinQueryWindowULong(mFrameWnd, QWL_STYLE) & WS_MINIMIZED) { if ((SHORT1FROMMP(mp1) == SC_MAXIMIZE)) { bDone = TRUE; } } } break; // When the frame is activated, set a flag to be acted on after // PM has finished changing focus. When deactivated, dispatch // the event immediately because it doesn't affect the focus. case WM_ACTIVATE: DEBUGFOCUS(WM_ACTIVATE); if (mp1) { mNeedActivation = PR_TRUE; } else { mNeedActivation = PR_FALSE; DEBUGFOCUS(NS_DEACTIVATE); DispatchFocus(NS_DEACTIVATE); // Prevent the frame from automatically focusing any window // when it's reactivated. Let moz set the focus to avoid // having non-widget children of plugins focused in error. WinSetWindowULong(mFrameWnd, QWL_HWNDFOCUSSAVE, 0); } break; } if( !bDone) mresult = (*fnwpDefFrame)( mFrameWnd, msg, mp1, mp2); return mresult; }