Re: how to display "busy" cursor ? and another question



Thanks Allin. I tried your example code and it somehow did not work
for me, i.e. the cursor does not show "watch".  However, I am running
my code on nokia maemo platform, which might impact the result.

besides, I have a question inline:


On Sat, Oct 4, 2008 at 12:13 PM, Allin Cottrell <cottrell wfu edu> wrote:
On Sat, 4 Oct 2008, Han wrote:

I have a couple of questions when learning to program GTK+ :

1) How can I display a "busy" cursor to users ?  The reason is that I
need to perform a task and cannot response to users for a few seconds.

Something like this, maybe:

void busy_stuff ()
{
   GdkDisplay *display;
   GdkCursor *cursor;
   GdkWindow *window;
   gint x, y;

   cursor = gdk_cursor_new(GDK_WATCH);

   display = gdk_display_get_default();
   window = gdk_display_get_window_at_pointer(disp, &x, &y);

   gdk_window_set_cursor(window, cursor);
   gdk_display_sync(display);
   gdk_cursor_unref(cursor);

[Han]  why do we call gdk_cursor_unref here ?

thanks.


   /* do time-consuming stuff here */

   gdk_window_set_cursor(window, NULL);
}

(Sorry, I pass on question 2.)

Allin Cottrell




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