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



Am Sa, den 25.09.2004 schrieb Stefan Kost um 01:32:
Hi all,

Hi Stefan,

Stefan Kost wrote:
hi,

when loading a long file I would like to disabled events for the main-window and
set a wait mouse-coursor for it. That they way I've tried it.

GdkWindow *window;
GdkCursor *cursor=gdk_cursor_new(GDK_WATCH);

gtk_widget_set_sensitive(GTK_WIDGET(self->private->main_window),FALSE);
// does not work -> (gdk_window_set_cursor): assertion `window != NULL' failed
window=gtk_window_get_transient_for(GTK_WINDOW(self->private->main_window));
I've now also tries
window=gtk_window_get_parent_window(GTK_WIDGET(self->private->main_window))
window=gtk_window_get_root_window(GTK_WIDGET(self->private->main_window))
window=GTK_WIDGET(self->private->main_window)->window;

I don't like to directly access the widget field. I've just tried whatever I
found in other sources. Still no method works.
The result is either
a) setting the cursor for all windows but mine (e.g. all other window titles, or
the gnome pannel then have the wait-mouse cursor)
b) getting a core dump

gdk_window_set_cursor(window,cursor);
... invoke the loading
gdk_window_set_cursor(window,NULL);
gtk_widget_set_sensitive(GTK_WIDGET(self->private->main_window),TRUE);

I manage to change the cursor for other windows (that are not mine!).
Hwen I got diffenrent mouse-cursors, then they neverr looked like the requested
ones.

Any ideas?

At first I've got to say: I have not much knowledge about GTK2, I'm
using 1.2 and did it this way (in Pascal, but you will get the idea):

        ...
        cursor := gdk_cursor_new_from_pixmap (source, mask, @fg, @bg, 8, 8);
        gdk_pixmap_unref (source);
        gdk_pixmap_unref (mask);
        ...
        window := TMainForm.create(stm);
        ...
        window.show;

        { set the cursor when the window is shown, won't work otherwise }
        gdk_window_set_cursor (window, cursor);

        gtk_main ();
        
This works fine as long as there are no entries or other widgets
involved, that set their own cursor. I did nothing about that, but maybe
this would be solvable by defining classes in the rc file ...

HTH,
Marc





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