Optimized update events by only sending them to visible windows

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48854 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2007-09-21 10:51:31 +00:00
parent 523a54d953
commit 24bd6cb9df
7 changed files with 16 additions and 16 deletions

View File

@@ -1076,7 +1076,7 @@ void wxWindowDFB::HandleKeyEvent(const wxDFBWindowEvent& event_)
void wxWindowDFB::OnInternalIdle() void wxWindowDFB::OnInternalIdle()
{ {
if (wxUpdateUIEvent::CanUpdate(this)) if (wxUpdateUIEvent::CanUpdate(this) && IsShown())
UpdateWindowUI(wxUPDATE_UI_FROMIDLE); UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
} }

View File

@@ -2839,7 +2839,7 @@ void wxWindowGTK::OnInternalIdle()
} }
} }
if (wxUpdateUIEvent::CanUpdate(this)) if (wxUpdateUIEvent::CanUpdate(this) && IsShown())
UpdateWindowUI(wxUPDATE_UI_FROMIDLE); UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
} }

View File

@@ -1583,7 +1583,7 @@ static gint gtk_window_button_press_callback( GtkWidget *widget,
} }
g_lastMouseEvent = (GdkEvent*) gdk_event; g_lastMouseEvent = (GdkEvent*) gdk_event;
wxMouseEvent event( event_type ); wxMouseEvent event( event_type );
InitMouseEvent( win, event, gdk_event ); InitMouseEvent( win, event, gdk_event );
@@ -1686,7 +1686,7 @@ static gint gtk_window_button_release_callback( GtkWidget *widget,
} }
g_lastMouseEvent = (GdkEvent*) gdk_event; g_lastMouseEvent = (GdkEvent*) gdk_event;
wxMouseEvent event( event_type ); wxMouseEvent event( event_type );
InitMouseEvent( win, event, gdk_event ); InitMouseEvent( win, event, gdk_event );
@@ -2958,7 +2958,7 @@ void wxWindowGTK::OnInternalIdle()
} }
} }
if (wxUpdateUIEvent::CanUpdate(this)) if (wxUpdateUIEvent::CanUpdate(this) && IsShown())
UpdateWindowUI(wxUPDATE_UI_FROMIDLE); UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
} }

View File

@@ -1225,6 +1225,6 @@ wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
void wxWindowMGL::OnInternalIdle() void wxWindowMGL::OnInternalIdle()
{ {
if (wxUpdateUIEvent::CanUpdate(this)) if (wxUpdateUIEvent::CanUpdate(this) && IsShown())
UpdateWindowUI(wxUPDATE_UI_FROMIDLE); UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
} }

View File

@@ -1172,7 +1172,7 @@ void wxWindow::DoGetSize(int *x, int *y) const
XmNwidth, &xx, XmNwidth, &xx,
XmNheight, &yy, XmNheight, &yy,
NULL ); NULL );
if(x) *x = widget ? xx : -1; if(x) *x = widget ? xx : -1;
if(y) *y = widget ? yy : -1; if(y) *y = widget ? yy : -1;
} }
@@ -1654,7 +1654,7 @@ void wxWindow::OnInternalIdle()
{ {
// This calls the UI-update mechanism (querying windows for // This calls the UI-update mechanism (querying windows for
// menu/toolbar/control state information) // menu/toolbar/control state information)
if (wxUpdateUIEvent::CanUpdate(this)) if (wxUpdateUIEvent::CanUpdate(this) && IsShown())
UpdateWindowUI(wxUPDATE_UI_FROMIDLE); UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
} }
@@ -2624,14 +2624,14 @@ void wxGetTextExtent(const wxWindow* window, const wxString& str,
{ {
XRectangle ink, logical; XRectangle ink, logical;
WXFontSet fset = (WXFontSet) args[0].value; WXFontSet fset = (WXFontSet) args[0].value;
XmbTextExtents( (XFontSet)fset, str.c_str(), str.length(), XmbTextExtents( (XFontSet)fset, str.c_str(), str.length(),
&ink, &logical); &ink, &logical);
if( width ) *width = logical.width; if( width ) *width = logical.width;
if( height ) *height = logical.height; if( height ) *height = logical.height;
if( ascent ) *ascent = -logical.y; if( ascent ) *ascent = -logical.y;
if( descent ) *descent = logical.height + logical.y; if( descent ) *descent = logical.height + logical.y;
} }
else else
{ {
@@ -2670,14 +2670,14 @@ void wxGetTextExtent(const wxWindow* window, const wxString& str,
if (type == XmFONT_IS_FONTSET) if (type == XmFONT_IS_FONTSET)
{ {
XRectangle ink, logical; XRectangle ink, logical;
XmbTextExtents( (XFontSet)thing, str.c_str(), str.length(), XmbTextExtents( (XFontSet)thing, str.c_str(), str.length(),
&ink, &logical); &ink, &logical);
if( width ) *width = logical.width; if( width ) *width = logical.width;
if( height ) *height = logical.height; if( height ) *height = logical.height;
if( ascent ) *ascent = -logical.y; if( ascent ) *ascent = -logical.y;
if( descent ) *descent = logical.height + logical.y; if( descent ) *descent = logical.height + logical.y;
} }
else else
{ {

View File

@@ -1442,7 +1442,7 @@ void wxWindowMSW::OnInternalIdle()
} }
#endif // !HAVE_TRACKMOUSEEVENT #endif // !HAVE_TRACKMOUSEEVENT
if (wxUpdateUIEvent::CanUpdate(this)) if (wxUpdateUIEvent::CanUpdate(this) && IsShown())
UpdateWindowUI(wxUPDATE_UI_FROMIDLE); UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
} }

View File

@@ -1312,7 +1312,7 @@ void wxWindowX11::OnInternalIdle()
// This calls the UI-update mechanism (querying windows for // This calls the UI-update mechanism (querying windows for
// menu/toolbar/control state information) // menu/toolbar/control state information)
if (wxUpdateUIEvent::CanUpdate((wxWindow*) this)) if (wxUpdateUIEvent::CanUpdate((wxWindow*) this) && IsShown())
UpdateWindowUI(wxUPDATE_UI_FROMIDLE); UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
// Set the input focus if couldn't do it before // Set the input focus if couldn't do it before