g_io_add_watch can block redraw ?



Hello.

I'm using Gtk+-1.2.10.
Developing a db access framework, I discovered (after LONG tracing :-( )
that it seems g_io_add_watch can block (at least partially) widgets
redraw.
This is a quick example (derived from base.c):

#include <gtk/gtk.h>

gboolean cbk(GIOChannel *ch, GIOCondition cond, gpointer ptr)
{
    return TRUE;
}

int main( int   argc,
          char *argv[] )
{
    GtkWidget *window;
    gtk_init (&argc, &argv);
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    w=gtk_button_new_with_label("Prova!");
    gtk_container_add(GTK_CONTAINER(window), w);
    gtk_widget_show_all(window);
    g_io_add_watch(g_io_channel_unix_new(1), G_IO_OUT, cbk, NULL);
    gtk_main ();
    return(0);
}

Since I'm not using file handle 1 (stdout), it's always write-ready. So
cbk gets continuously called.
If you drag the window around, you'll notice the button isn't redrawn,
except when you click it.

Is it normal? Is it a (mis-)feature?
At least, IMVHO, it deserves at least a comment in the docs/headers.

BYtE,
 Diego.



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