fixes to Freeze/Thawn when the window is shown or hidden in between Freeze and Thaw
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52688 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -4311,15 +4311,67 @@ GdkWindow* wxWindowGTK::GTKGetDrawingWindow() const
|
|||||||
// freeze/thaw
|
// freeze/thaw
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
|
||||||
|
// this is called if we attempted to freeze unrealized widget when it finally
|
||||||
|
// is realized (and so can be frozen):
|
||||||
|
static void wx_frozen_widget_realize(GtkWidget* w, void* WXUNUSED(data))
|
||||||
|
{
|
||||||
|
wxASSERT( w && !GTK_WIDGET_NO_WINDOW(w) );
|
||||||
|
wxASSERT( GTK_WIDGET_REALIZED(w) );
|
||||||
|
|
||||||
|
g_signal_handlers_disconnect_by_func
|
||||||
|
(
|
||||||
|
w,
|
||||||
|
(void*)wx_frozen_widget_realize,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
gdk_window_freeze_updates(w->window);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // extern "C"
|
||||||
|
|
||||||
void wxWindowGTK::GTKFreezeWidget(GtkWidget *w)
|
void wxWindowGTK::GTKFreezeWidget(GtkWidget *w)
|
||||||
{
|
{
|
||||||
if ( w && !GTK_WIDGET_NO_WINDOW(w) )
|
if ( !w || GTK_WIDGET_NO_WINDOW(w) )
|
||||||
|
return; // window-less widget, cannot be frozen
|
||||||
|
|
||||||
|
if ( !GTK_WIDGET_REALIZED(w) )
|
||||||
|
{
|
||||||
|
// we can't thaw unrealized widgets because they don't have GdkWindow,
|
||||||
|
// so set it up to be done immediately after realization:
|
||||||
|
g_signal_connect_after
|
||||||
|
(
|
||||||
|
w,
|
||||||
|
"realize",
|
||||||
|
G_CALLBACK(wx_frozen_widget_realize),
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
gdk_window_freeze_updates(w->window);
|
gdk_window_freeze_updates(w->window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowGTK::GTKThawWidget(GtkWidget *w)
|
void wxWindowGTK::GTKThawWidget(GtkWidget *w)
|
||||||
{
|
{
|
||||||
if ( w && !GTK_WIDGET_NO_WINDOW(w) )
|
if ( !w || GTK_WIDGET_NO_WINDOW(w) )
|
||||||
|
return; // window-less widget, cannot be frozen
|
||||||
|
|
||||||
|
if ( !GTK_WIDGET_REALIZED(w) )
|
||||||
|
{
|
||||||
|
// the widget wasn't realized yet, no need to thaw
|
||||||
|
g_signal_handlers_disconnect_by_func
|
||||||
|
(
|
||||||
|
w,
|
||||||
|
(void*)wx_frozen_widget_realize,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
gdk_window_thaw_updates(w->window);
|
gdk_window_thaw_updates(w->window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -716,6 +716,16 @@ bool wxWindowMSW::Show(bool show)
|
|||||||
::ShowWindow(hWnd, show ? SW_SHOW : SW_HIDE);
|
::ShowWindow(hWnd, show ? SW_SHOW : SW_HIDE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( IsFrozen() )
|
||||||
|
{
|
||||||
|
// DoFreeze/DoThaw don't do anything if the window is not shown, so
|
||||||
|
// we have to call them from here now
|
||||||
|
if ( show )
|
||||||
|
DoFreeze();
|
||||||
|
else
|
||||||
|
DoThaw();
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1615,20 +1625,22 @@ static inline void SendSetRedraw(HWND hwnd, bool on)
|
|||||||
|
|
||||||
void wxWindowMSW::DoFreeze()
|
void wxWindowMSW::DoFreeze()
|
||||||
{
|
{
|
||||||
if ( IsShown() )
|
if ( !IsShown() )
|
||||||
|
return; // no point in freezing hidden window
|
||||||
|
|
||||||
SendSetRedraw(GetHwnd(), false);
|
SendSetRedraw(GetHwnd(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowMSW::DoThaw()
|
void wxWindowMSW::DoThaw()
|
||||||
{
|
{
|
||||||
if ( IsShown() )
|
if ( !IsShown() )
|
||||||
{
|
return; // hidden windows aren't frozen by DoFreeze
|
||||||
|
|
||||||
SendSetRedraw(GetHwnd(), true);
|
SendSetRedraw(GetHwnd(), true);
|
||||||
|
|
||||||
// we need to refresh everything or otherwise the invalidated area
|
// we need to refresh everything or otherwise the invalidated area
|
||||||
// is not going to be repainted
|
// is not going to be repainted
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowMSW::Refresh(bool eraseBack, const wxRect *rect)
|
void wxWindowMSW::Refresh(bool eraseBack, const wxRect *rect)
|
||||||
|
Reference in New Issue
Block a user