Re: how to tell gtk to update only the GUI



> I agree the right thing is normally to make the widgets
> insensitive but it is possible to do what Mehmet requested
> too with gtk_grab_add() on some `passive' widget -- see the
> attached example.

That should work, however it doesn't seems to be what I need (gtk_grab_add need at least one gtkwidget).
I should give more information about my case and what solution I have found.

Let say I have two functions do_calc() and do_screen_update(), both know nothing about the GUI, so I have something like:

do_calc ()
{
        while (1)
        {
        do_calc_one_iteration();
        do_screen_update();     // update the screen
        }
}

I solved my problem by installing my own event handler inside do_screen_update and dropping any GDK_KEY_PRESS, GDK_BUTTON_PRESS ... events. So I have :

void my_handler(GdkEvent *event)
{
        case (event->type)
        {
        case GDK_KEY_PRESS:
         ...
                break;
        default:
                gtk_main_do_event(event);
                break;
        }
}


do_screen_update()
{
gdk_event_handler_set(my_handler, NULL, NULL);
while (gtk_events_pending())
            gtk_main_iteration_do(FALSE);
gdk_event_handler_set(gtk_main_do_event, NULL, NULL);
}

That way, I don't need to know anything about toplevel windows, I don't need to modify any keypress handler ...

Mehmet



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