Re: gdk events - cunsumes much CPU time



Writing a GDK-only app is a not something people do very
often, if ever. A lot of stuff which is easy when using GTK+
gets quite cumbersome when working with GDK only.

But the easiest way to organize a GDK-only app would
be something like:

===
static void 
my_event_func (GdkEvent *event,
               gpointer  data)
{
  /* process an event */
}

int main (int argc, char **argv)
{
  GMainLoop *loop;

  gdk_init (&argv, &argc);

  gdk_event_handler_set (my_event_func, NULL, NULL);

  /* Create windows, etc. */

  loop = g_main_loop_new (NULL, FALSE);
  g_main_loop_run (loop);
  
  return 0;
}
===

That's more or less how GTK+ gets events from GDK.

Regards,
                                Owen





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