Suppress size event when IsMaximized is called on OSX
IsMaximized internally calls [NSWindow isZoomed] which triggers a windowWillResize call. Resize events will be ignored while calling isZoomed. Closes #17407. See https://github.com/wxWidgets/wxWidgets/pull/740
This commit is contained in:
committed by
Vadim Zeitlin
parent
4e5904a4cc
commit
dd2d62c703
@@ -116,6 +116,8 @@ public:
|
|||||||
|
|
||||||
void OSXHandleMiniaturize(double WXUNUSED(timestampsec), bool miniaturized);
|
void OSXHandleMiniaturize(double WXUNUSED(timestampsec), bool miniaturized);
|
||||||
|
|
||||||
|
void OSXSetIgnoreResizing(bool value) { m_ignoreResizing = value; }
|
||||||
|
|
||||||
void WindowWasPainted();
|
void WindowWasPainted();
|
||||||
|
|
||||||
virtual bool Destroy();
|
virtual bool Destroy();
|
||||||
@@ -154,6 +156,7 @@ private :
|
|||||||
#if wxUSE_GRAPHICS_CONTEXT
|
#if wxUSE_GRAPHICS_CONTEXT
|
||||||
wxGraphicsPath m_shapePath;
|
wxGraphicsPath m_shapePath;
|
||||||
#endif // wxUSE_GRAPHICS_CONTEXT
|
#endif // wxUSE_GRAPHICS_CONTEXT
|
||||||
|
bool m_ignoreResizing;
|
||||||
};
|
};
|
||||||
|
|
||||||
// list of all frames and modeless dialogs
|
// list of all frames and modeless dialogs
|
||||||
|
@@ -998,7 +998,12 @@ bool wxNonOwnedWindowCocoaImpl::IsMaximized() const
|
|||||||
{
|
{
|
||||||
if (([m_macWindow styleMask] & NSResizableWindowMask) != 0)
|
if (([m_macWindow styleMask] & NSResizableWindowMask) != 0)
|
||||||
{
|
{
|
||||||
return [m_macWindow isZoomed];
|
// isZoomed internally calls windowWillResize which would trigger
|
||||||
|
// an wxEVT_SIZE. Setting ignore resizing supresses the event
|
||||||
|
m_wxPeer->OSXSetIgnoreResizing(true);
|
||||||
|
BOOL result = [m_macWindow isZoomed];
|
||||||
|
m_wxPeer->OSXSetIgnoreResizing(false);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -97,6 +97,7 @@ void wxNonOwnedWindow::Init()
|
|||||||
{
|
{
|
||||||
m_nowpeer = NULL;
|
m_nowpeer = NULL;
|
||||||
m_isNativeWindowWrapper = false;
|
m_isNativeWindowWrapper = false;
|
||||||
|
m_ignoreResizing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxNonOwnedWindow::Create(wxWindow *parent,
|
bool wxNonOwnedWindow::Create(wxWindow *parent,
|
||||||
@@ -306,6 +307,9 @@ void wxNonOwnedWindow::HandleResized( double WXUNUSED(timestampsec) )
|
|||||||
|
|
||||||
void wxNonOwnedWindow::HandleResizing( double WXUNUSED(timestampsec), wxRect* rect )
|
void wxNonOwnedWindow::HandleResizing( double WXUNUSED(timestampsec), wxRect* rect )
|
||||||
{
|
{
|
||||||
|
if ( m_ignoreResizing )
|
||||||
|
return;
|
||||||
|
|
||||||
wxRect r = *rect ;
|
wxRect r = *rect ;
|
||||||
|
|
||||||
// this is a EVT_SIZING not a EVT_SIZE type !
|
// this is a EVT_SIZING not a EVT_SIZE type !
|
||||||
|
Reference in New Issue
Block a user