From: Julian Smart Date: Fri, 21 Sep 2007 10:51:31 +0000 (+0000) Subject: Optimized update events by only sending them to visible windows X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/24bd6cb9dfac17711772ec4e028e82c1a1e23386 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 --- diff --git a/src/dfb/window.cpp b/src/dfb/window.cpp index 40e8fddbee..2470e530ba 100644 --- a/src/dfb/window.cpp +++ b/src/dfb/window.cpp @@ -1076,7 +1076,7 @@ void wxWindowDFB::HandleKeyEvent(const wxDFBWindowEvent& event_) void wxWindowDFB::OnInternalIdle() { - if (wxUpdateUIEvent::CanUpdate(this)) + if (wxUpdateUIEvent::CanUpdate(this) && IsShown()) UpdateWindowUI(wxUPDATE_UI_FROMIDLE); } diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index fed52353e4..7f19277268 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -2839,7 +2839,7 @@ void wxWindowGTK::OnInternalIdle() } } - if (wxUpdateUIEvent::CanUpdate(this)) + if (wxUpdateUIEvent::CanUpdate(this) && IsShown()) UpdateWindowUI(wxUPDATE_UI_FROMIDLE); } diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index d74a0e0e3f..3b6b76436f 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -1583,7 +1583,7 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, } g_lastMouseEvent = (GdkEvent*) gdk_event; - + wxMouseEvent event( event_type ); InitMouseEvent( win, event, gdk_event ); @@ -1686,7 +1686,7 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, } g_lastMouseEvent = (GdkEvent*) gdk_event; - + wxMouseEvent event( event_type ); 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); } diff --git a/src/mgl/window.cpp b/src/mgl/window.cpp index 85f2abeee3..caa7490178 100644 --- a/src/mgl/window.cpp +++ b/src/mgl/window.cpp @@ -1225,6 +1225,6 @@ wxWindow* wxFindWindowAtPoint(const wxPoint& pt) void wxWindowMGL::OnInternalIdle() { - if (wxUpdateUIEvent::CanUpdate(this)) + if (wxUpdateUIEvent::CanUpdate(this) && IsShown()) UpdateWindowUI(wxUPDATE_UI_FROMIDLE); } diff --git a/src/motif/window.cpp b/src/motif/window.cpp index efc13e5273..d219483039 100644 --- a/src/motif/window.cpp +++ b/src/motif/window.cpp @@ -1172,7 +1172,7 @@ void wxWindow::DoGetSize(int *x, int *y) const XmNwidth, &xx, XmNheight, &yy, NULL ); - if(x) *x = widget ? xx : -1; + if(x) *x = widget ? xx : -1; if(y) *y = widget ? yy : -1; } @@ -1654,7 +1654,7 @@ void wxWindow::OnInternalIdle() { // This calls the UI-update mechanism (querying windows for // menu/toolbar/control state information) - if (wxUpdateUIEvent::CanUpdate(this)) + if (wxUpdateUIEvent::CanUpdate(this) && IsShown()) UpdateWindowUI(wxUPDATE_UI_FROMIDLE); } @@ -2624,14 +2624,14 @@ void wxGetTextExtent(const wxWindow* window, const wxString& str, { XRectangle ink, logical; WXFontSet fset = (WXFontSet) args[0].value; - + XmbTextExtents( (XFontSet)fset, str.c_str(), str.length(), &ink, &logical); if( width ) *width = logical.width; if( height ) *height = logical.height; - if( ascent ) *ascent = -logical.y; - if( descent ) *descent = logical.height + logical.y; + if( ascent ) *ascent = -logical.y; + if( descent ) *descent = logical.height + logical.y; } else { @@ -2670,14 +2670,14 @@ void wxGetTextExtent(const wxWindow* window, const wxString& str, if (type == XmFONT_IS_FONTSET) { XRectangle ink, logical; - + XmbTextExtents( (XFontSet)thing, str.c_str(), str.length(), &ink, &logical); if( width ) *width = logical.width; if( height ) *height = logical.height; - if( ascent ) *ascent = -logical.y; - if( descent ) *descent = logical.height + logical.y; + if( ascent ) *ascent = -logical.y; + if( descent ) *descent = logical.height + logical.y; } else { diff --git a/src/msw/window.cpp b/src/msw/window.cpp index c41f9b1e61..1a119e8191 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -1442,7 +1442,7 @@ void wxWindowMSW::OnInternalIdle() } #endif // !HAVE_TRACKMOUSEEVENT - if (wxUpdateUIEvent::CanUpdate(this)) + if (wxUpdateUIEvent::CanUpdate(this) && IsShown()) UpdateWindowUI(wxUPDATE_UI_FROMIDLE); } diff --git a/src/x11/window.cpp b/src/x11/window.cpp index cdcd39a1b0..dbd6b97cff 100644 --- a/src/x11/window.cpp +++ b/src/x11/window.cpp @@ -1312,7 +1312,7 @@ void wxWindowX11::OnInternalIdle() // This calls the UI-update mechanism (querying windows for // menu/toolbar/control state information) - if (wxUpdateUIEvent::CanUpdate((wxWindow*) this)) + if (wxUpdateUIEvent::CanUpdate((wxWindow*) this) && IsShown()) UpdateWindowUI(wxUPDATE_UI_FROMIDLE); // Set the input focus if couldn't do it before