Re: Mouse Pointer
- From: Havoc Pennington <hp redhat com>
- To: antony claire co jp
- Cc: gtk-list gnome org, gnome-devel-list gnome org, gtk-app-devel-list gnome org
- Subject: Re: Mouse Pointer
- Date: 26 Sep 2000 22:30:20 -0400
Antony Stace <antony claire co jp> writes:
> [snip]
> GtkWidget *switchW;
> GdkCursor* TelCursor = gdk_cursor_new(GDK_HAND2);
> switchW = gtk_window_new (GTK_WINDOW_POPUP);
> gdk_window_set_cursor(switchW->window, TelCursor);
> [snip]
>
>
> and here is the error
> oakura:/home/kermit> /tmp/switch.x
>
> Gdk-CRITICAL **: file gdkwindow.c: line 1274
> (gdk_window_set_cursor): assertion `window != NULL' failed.
>
You need to wait for the window to be realized. Since realization can
happen more than once I would simply gtk_signal_connect_after() to the
realize signal on the window, and set the cursor there.
So:
void
my_realize_cb (GtkWidget *widget, gpionter user_data)
{
GdkCursor *cursor;
cursor = gdk_cursor_new (GDK_HAND2);
gdk_window_set_cursor (widget->window, cursor);
gdk_cursor_destroy (cursor);
}
gtk_signal_connect_after (GTK_OBJECT (widget), "realize",
GTK_SIGNAL_FUNC (my_realize_cb), NULL);
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]