From 2e952cd1136d5419f409ac7e98f38c57309a31f7 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sat, 13 Aug 2011 16:17:59 +0000 Subject: [PATCH] simplify global cursor setting git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68685 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/cursor.cpp | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/src/gtk/cursor.cpp b/src/gtk/cursor.cpp index 525bccdb7e..615677e506 100644 --- a/src/gtk/cursor.cpp +++ b/src/gtk/cursor.cpp @@ -390,20 +390,15 @@ const wxCursor wxBusyCursor::GetBusyCursor() return wxCursor(wxCURSOR_WATCH); } -static void UpdateCursors(const wxWindowList& list, GdkDisplay*& display) +static void UpdateCursors(GdkDisplay** display) { - wxWindowList::const_iterator i = list.begin(); - for (size_t n = list.size(); n--; ++i) + wxWindowList::const_iterator i = wxTopLevelWindows.begin(); + for (size_t n = wxTopLevelWindows.size(); n--; ++i) { wxWindow* win = *i; - if (display == NULL && win->m_widget) - { - GdkWindow* w = gtk_widget_get_window(win->m_widget); - if (w) - display = gdk_drawable_get_display(w); - } - win->GTKUpdateCursor(true, false); - UpdateCursors(win->GetChildren(), display); + win->GTKUpdateCursor(); + if (display && *display == NULL && win->m_widget) + *display = gtk_widget_get_display(win->m_widget); } } @@ -414,8 +409,7 @@ void wxEndBusyCursor() g_globalCursor = gs_savedCursor; gs_savedCursor = wxNullCursor; - GdkDisplay* unused = NULL; - UpdateCursors(wxTopLevelWindows, unused); + UpdateCursors(NULL); } void wxBeginBusyCursor(const wxCursor* cursor) @@ -429,7 +423,7 @@ void wxBeginBusyCursor(const wxCursor* cursor) gs_savedCursor = g_globalCursor; g_globalCursor = *cursor; GdkDisplay* display = NULL; - UpdateCursors(wxTopLevelWindows, display); + UpdateCursors(&display); if (display) gdk_display_flush(display); } @@ -442,6 +436,5 @@ bool wxIsBusy() void wxSetCursor( const wxCursor& cursor ) { g_globalCursor = cursor; - GdkDisplay* unused = NULL; - UpdateCursors(wxTopLevelWindows, unused); + UpdateCursors(NULL); } -- 2.45.2