Re: setting the wait mouse cursor during a longer load operation (solved)



Hi Allin,

I've found it out! Using gdk_window_set cursor is perfectly okay (better that
gdk_pointer_grab in my case - that sets the wait-cursor for the whole screen).

My error was using g_object_unref() onto the cursor object, where instead I
should have used  gdk_cursor_unref().
Btw. gdk_cursor_destroy(plswait); is deprecated ;-)

Still it is not nice that there is no method to acces the window field of a
GtkWidget (like gtk_widget_get_window()). I'll ask on the gtk-devel list about that.

Stefan

Allin Cottrell wrote:
On Sat, 25 Sep 2004, Stefan Kost wrote:

when loading a long file I would like to disabled events for the
main-window and set a wait mouse-coursor for it.


Here's what I do:

if (whatever) {
    GdkCursor *plswait;

    plswait = gdk_cursor_new(GDK_WATCH);
    gdk_pointer_grab(mywindow, TRUE,
             GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK |
             GDK_BUTTON_RELEASE_MASK,
             NULL, plswait,
             GDK_CURRENT_TIME);
    gdk_cursor_destroy(plswait);

    /* do whatever needs to be done, then... */

    gdk_pointer_ungrab(GDK_CURRENT_TIME);
}

Allin Cottrell


-- 
      \|/            Stefan Kost
     <@ @>           private            business
+-oOO-(_)-OOo------------------------------------------------------ - - -  -   -
|       __  Address  Simildenstr. 5     HTWK Leipzig, Fb IMN, Postfach 301166
|      ///           04277 Leipzig      04251 Leipzig
| __  ///            Germany            Germany
| \\\///    Phone    +49341 2253538     +49341 30766101
|  \__/     EMail    st_kost_at_gmx.net kost_at_imn.htwk-leipzig.de
|           WWW      www.sonicpulse.de  www.imn.htwk-leipzig.de/~kost/about.html
===-=-=--=---=---------------------------------- - - -  -    -


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]