Skip double size events.

Skip movements of floating pane when moving fast.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40760 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2006-08-22 22:47:50 +00:00
parent e65fbef69d
commit 0ae3bace9b
2 changed files with 21 additions and 0 deletions

View File

@@ -134,6 +134,14 @@ void wxFloatingPane::OnMoveEvent(wxMoveEvent& event)
return; return;
} }
// skip if moving fast
if ((abs(win_rect.x - m_last_rect.x) > 1) ||
(abs(win_rect.y - m_last_rect.y) > 1))
{
m_last_rect = win_rect;
return;
}
// prevent frame redocking during resize // prevent frame redocking during resize
if (m_last_rect.GetSize() != win_rect.GetSize()) if (m_last_rect.GetSize() != win_rect.GetSize())
{ {

View File

@@ -80,6 +80,8 @@ public:
m_Amount=0; m_Amount=0;
m_MaxWidth=0; m_MaxWidth=0;
m_MaxHeight=0; m_MaxHeight=0;
m_lastWidth=0;
m_lastHeight=0;
#ifdef __WXGTK__ #ifdef __WXGTK__
m_CanSetShape = false; // have to wait for window create event on GTK m_CanSetShape = false; // have to wait for window create event on GTK
#else #else
@@ -149,6 +151,16 @@ public:
void OnSize(wxSizeEvent& event) void OnSize(wxSizeEvent& event)
{ {
// We sometimes get surplus size events
if ((event.GetSize().GetWidth() == m_lastWidth) &&
(event.GetSize().GetHeight() == m_lastHeight))
{
event.Skip();
return;
}
m_lastWidth = event.GetSize().GetWidth();
m_lastHeight = event.GetSize().GetHeight();
SetTransparent(m_Amount); SetTransparent(m_Amount);
m_Region.Intersect(0, 0, event.GetSize().GetWidth(), m_Region.Intersect(0, 0, event.GetSize().GetWidth(),
event.GetSize().GetHeight()); event.GetSize().GetHeight());
@@ -162,6 +174,7 @@ private:
int m_MaxWidth; int m_MaxWidth;
int m_MaxHeight; int m_MaxHeight;
bool m_CanSetShape; bool m_CanSetShape;
int m_lastWidth,m_lastHeight;
wxRegion m_Region; wxRegion m_Region;