From f0d27ba96ed690d8b6022fd2df4eb4cffeee614a Mon Sep 17 00:00:00 2001 From: bulia byak Date: Wed, 14 Mar 2007 18:03:38 +0000 Subject: add a flag and a setter method for busy cursor (bzr r2646) --- src/desktop.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/desktop.cpp') diff --git a/src/desktop.cpp b/src/desktop.cpp index 5fa251842..668d46b31 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -54,6 +54,7 @@ #include #include +#include #include "macros.h" #include "inkscape-private.h" @@ -127,6 +128,7 @@ SPDesktop::SPDesktop() zooms_future = NULL; is_fullscreen = false; + waiting_cursor = false; gr_item = NULL; gr_point_type = 0; @@ -1070,6 +1072,21 @@ void SPDesktop::disableInteraction() _widget->disableInteraction(); } +void SPDesktop::setWaitingCursor() +{ + GdkCursor *waiting = gdk_cursor_new(GDK_WATCH); + gdk_window_set_cursor(GTK_WIDGET(sp_desktop_canvas(this))->window, waiting); + gdk_cursor_unref(waiting); + waiting_cursor = true; + + // Stupidly broken GDK cannot just set the new cursor right now - it needs some main loop iterations for that + // Since setting waiting_cursor is usually immediately followed by some Real Work, we must run the iterations here + // CAUTION: iterations may redraw, and redraw may be interrupted, so you cannot assume that anything is the same + // after the call to setWaitingCursor as it was before + while( Gtk::Main::events_pending() ) + Gtk::Main::iteration(); +} + //---------------------------------------------------------------------- // Callback implementations. The virtual ones are connected by the view. -- cgit v1.2.3