X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bceb01f728c7f3ca872cee1864f3fad29ecd4cfb..92a98ecc5369edfebf13151dc9e9d4acaf326342:/src/msw/toplevel.cpp?ds=sidebyside diff --git a/src/msw/toplevel.cpp b/src/msw/toplevel.cpp index 93f05893b2..37b3a3d0a7 100644 --- a/src/msw/toplevel.cpp +++ b/src/msw/toplevel.cpp @@ -4,7 +4,6 @@ // Author: Vadim Zeitlin // Modified by: // Created: 24.09.01 -// RCS-ID: $Id$ // Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -159,6 +158,7 @@ void wxTopLevelWindowMSW::Init() #endif m_menuSystem = NULL; + m_menuDepth = 0; } WXDWORD wxTopLevelWindowMSW::MSWGetStyle(long style, WXDWORD *exflags) const @@ -1100,6 +1100,12 @@ bool wxTopLevelWindowMSW::ShowFullScreen(bool show, long style) newStyle &= ~offFlags; + // Full screen windows should logically be popups as they don't have + // decorations (and are definitely not children) and while not using + // this style doesn't seem to make any difference for most windows, it + // breaks wxGLCanvas in some cases, see #15434, so just always use it. + newStyle |= WS_POPUP; + // change our window style to be compatible with full-screen mode ::SetWindowLong(GetHwnd(), GWL_STYLE, newStyle); @@ -1478,8 +1484,26 @@ void wxTopLevelWindowMSW::OnActivate(wxActivateEvent& event) #if wxUSE_MENUS bool -wxTopLevelWindowMSW::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU WXUNUSED(hMenu)) +wxTopLevelWindowMSW::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU hMenu) { + // Ignore the special messages generated when the menu is closed (this is + // the only case when the flags are set to -1), in particular don't clear + // the help string in the status bar when this happens as it had just been + // restored by the base class code. + if ( !hMenu && flags == 0xffff ) + return false; + + // Unfortunately we also need to ignore another message which is sent after + // closing the currently active submenu of the menu bar by pressing Escape: + // in this case we get WM_UNINITMENUPOPUP, from which we generate + // wxEVT_MENU_CLOSE, and _then_ we get WM_MENUSELECT for the top level menu + // from which we overwrite the help string just restored by OnMenuClose() + // handler in wxFrameBase. To prevent this from happening we discard these + // messages but only in the case it's really the top level menu as we still + // need to clear the help string when a submenu is selected in a menu. + if ( flags == (MF_POPUP | MF_HILITE) && !m_menuDepth ) + return false; + // sign extend to int from unsigned short we get from Windows int item = (signed short)nItem; @@ -1508,6 +1532,25 @@ wxTopLevelWindowMSW::HandleMenuSelect(WXWORD nItem, WXWORD flags, WXHMENU WXUNUS bool wxTopLevelWindowMSW::DoSendMenuOpenCloseEvent(wxEventType evtType, wxMenu* menu, bool popup) { + // Update the menu depth when dealing with the top level menus. + if ( !popup ) + { + if ( evtType == wxEVT_MENU_OPEN ) + { + m_menuDepth++; + } + else if ( evtType == wxEVT_MENU_CLOSE ) + { + wxASSERT_MSG( m_menuDepth > 0, wxS("No open menus?") ); + + m_menuDepth--; + } + else + { + wxFAIL_MSG( wxS("Unexpected menu event type") ); + } + } + wxMenuEvent event(evtType, popup ? wxID_ANY : 0, menu); event.SetEventObject(menu);