Date: Fri, 27 Oct 2006 09:37:25 +0900 (JST) Message-Id: <20061027.093725.95890766.garrigue at math.nagoya-u.ac.jp> To: matthieu.dubuget at laposte.net Cc: lablgtk at math.nagoya-u.ac.jp Subject: Re: Cursors From: Jacques Garrigue In-Reply-To: <453DE9F1.8060404 at laposte.net> References: <453DE9F1.8060404 at laposte.net> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: Text/Plain; charset=us-ascii Content-Length: 1520 From: Matthieu Dubuget > I would like to modify the cursor of my application during a long > computation, > 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 shown. Jacques