garrigue at math.nagoya-u.ac.jp
Fri Oct 27 02:37:25 CEST 2006
From: Matthieu Dubuget <matthieu.dubuget at laposte.net>
> I would like to modify the cursor of my application during a long
> to let know the user that there is a work in progress. The best way
> would be to
> let the window manager do that (following it's theme). I found no
> solution for this.
There seems is a concept of "cursor theme" in gtk, and it
changes the cursors associated to each predefined name.
So if you choose a cursor in Gdk.Cursor.cursor_type, it is already
handled by the theme. But there are lots of choices...
> One way I tried to follow was to use:
> val set_cursor : Gdk.window -> Gdk.cursor -> unit
> with a fixed Gdk.cursor. (I still do not know how I would revert my
> modification after the long computation...)
Since there seems to be no way of obtaining the last cursor, I see no
solution to that. Except choosing a standard cursor for your
application, and sticking to it. Note that for my window manager the
default seems to be `LEFT_PTR, but I don't know whether this is fixed.
> Then, I tried to get one Gdk.window from my application window.
> Unfortunately, I experienced a runtime crash.
> let w = GWindow.window () in
> (* let win = w#misc#window in *)
> print_endline "Ciao";
> exit 0
> If I uncomment the commented line in the above program, I receive
> "Fatal error: exception Gpointer.Null"
That one is easy: you need to call w#misc#realize() befor accessing
w#misc#window. It is done automatically if the window is already
More information about the Lablgtk-list