gdk events - cunsumes much CPU time



Hi,

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");
          break;

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

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

        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?

Any hints?

thanks
Andreas



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