simplify global cursor setting
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68685 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -390,20 +390,15 @@ const wxCursor wxBusyCursor::GetBusyCursor()
|
|||||||
return wxCursor(wxCURSOR_WATCH);
|
return wxCursor(wxCURSOR_WATCH);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void UpdateCursors(const wxWindowList& list, GdkDisplay*& display)
|
static void UpdateCursors(GdkDisplay** display)
|
||||||
{
|
{
|
||||||
wxWindowList::const_iterator i = list.begin();
|
wxWindowList::const_iterator i = wxTopLevelWindows.begin();
|
||||||
for (size_t n = list.size(); n--; ++i)
|
for (size_t n = wxTopLevelWindows.size(); n--; ++i)
|
||||||
{
|
{
|
||||||
wxWindow* win = *i;
|
wxWindow* win = *i;
|
||||||
if (display == NULL && win->m_widget)
|
win->GTKUpdateCursor();
|
||||||
{
|
if (display && *display == NULL && win->m_widget)
|
||||||
GdkWindow* w = gtk_widget_get_window(win->m_widget);
|
*display = gtk_widget_get_display(win->m_widget);
|
||||||
if (w)
|
|
||||||
display = gdk_drawable_get_display(w);
|
|
||||||
}
|
|
||||||
win->GTKUpdateCursor(true, false);
|
|
||||||
UpdateCursors(win->GetChildren(), display);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -414,8 +409,7 @@ void wxEndBusyCursor()
|
|||||||
|
|
||||||
g_globalCursor = gs_savedCursor;
|
g_globalCursor = gs_savedCursor;
|
||||||
gs_savedCursor = wxNullCursor;
|
gs_savedCursor = wxNullCursor;
|
||||||
GdkDisplay* unused = NULL;
|
UpdateCursors(NULL);
|
||||||
UpdateCursors(wxTopLevelWindows, unused);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxBeginBusyCursor(const wxCursor* cursor)
|
void wxBeginBusyCursor(const wxCursor* cursor)
|
||||||
@@ -429,7 +423,7 @@ void wxBeginBusyCursor(const wxCursor* cursor)
|
|||||||
gs_savedCursor = g_globalCursor;
|
gs_savedCursor = g_globalCursor;
|
||||||
g_globalCursor = *cursor;
|
g_globalCursor = *cursor;
|
||||||
GdkDisplay* display = NULL;
|
GdkDisplay* display = NULL;
|
||||||
UpdateCursors(wxTopLevelWindows, display);
|
UpdateCursors(&display);
|
||||||
if (display)
|
if (display)
|
||||||
gdk_display_flush(display);
|
gdk_display_flush(display);
|
||||||
}
|
}
|
||||||
@@ -442,6 +436,5 @@ bool wxIsBusy()
|
|||||||
void wxSetCursor( const wxCursor& cursor )
|
void wxSetCursor( const wxCursor& cursor )
|
||||||
{
|
{
|
||||||
g_globalCursor = cursor;
|
g_globalCursor = cursor;
|
||||||
GdkDisplay* unused = NULL;
|
UpdateCursors(NULL);
|
||||||
UpdateCursors(wxTopLevelWindows, unused);
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user