From 29d19ee85179d26af3420a3752d0f47199270570 Mon Sep 17 00:00:00 2001 From: buliabyak Date: Wed, 14 Mar 2007 18:03:38 +0000 Subject: [PATCH] add a flag and a setter method for busy cursor --- src/desktop.cpp | 17 +++++++++++++++++ src/desktop.h | 3 +++ 2 files changed, 20 insertions(+) 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. diff --git a/src/desktop.h b/src/desktop.h index 9f3d77520..fbc92b7a4 100644 --- a/src/desktop.h +++ b/src/desktop.h @@ -99,6 +99,7 @@ struct SPDesktop : public Inkscape::UI::View::View unsigned int number; bool is_fullscreen; unsigned int interaction_disabled_counter; + bool waiting_cursor; /// \todo fixme: This has to be implemented in different way */ guint guides_active : 1; @@ -240,6 +241,8 @@ struct SPDesktop : public Inkscape::UI::View::View void enableInteraction(); void disableInteraction(); + + void setWaitingCursor(); void fullscreen(); -- 2.30.2