Re: gdk_gc_predraw error



Hi,

Markus Fischer <mfischer guru josefine at> writes:

> A GtkWindow is derived from GtkWidget which provides ->window .
> ->window is always its associated GdkWindow (or its parent
> GdkWindow in some cases). Your widget needs to be realize'd so
> you can access its GdkWindow:
> 
> window_edit = gtk_window_new();
> gtk_widget_realize(GTK_WIDGET(window_edit));
> [...]
> 
> gdk_window_set_cursor(window_edit->window, ...

explicitely realizing the window is ugly, try:

window_edit = gtk_window_new();
gtk_signal_connect_after (GTK_OBJECT (window_edit), "realize",
                          GTK_SIGNAL_FUNC (window_edit_realize),
                          cursor);

static void
window_edit_realize (GtkWidget *widget,
                     gpointer   data)
{
  GdkCursor *cursor = (GdkCursor *) data;

  if (GTK_WIDGET_REALIZED (widget))
    {
       /* now widget->window is valid and the cursor can be set */
       ...
    }      
}


Salut, Sven




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