Re: gdk events - cunsumes much CPU time

On Fri, 2003-06-27 at 16:29, Andreas Volz wrote:

I used this in a gdk app to get the events:

for (;;)
    if ((event=gdk_event_get()))
      if (event->type == GDK_BUTTON_PRESS)
        switch (event->button.button)
          /* left button pressed */
        case 1:
          start_app ("xterm");

          /* middle button pressed */
        case 2:
          start_app ("gExec2");

          /* right button pressed */
        case 3:
          start_app ("xsteak");

        printf("button press: button = %d\n", event->button.button);

It works like it should, but there is a little problem. My app cunsumes
more than 95% CPU time and this is to much ;-)

Where is the problem? Is perhaps gdk_event_get() not the correct
function for this problem?

What are you trying to do? Are you trying to write a GDK app
without using GTK+? Without using the GLib main loop...?


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