Capturing GDK_KEY_PRESS events



I have a GdkWindow declared and initialized, and I'd like to capture any
keypresses that occur when that window is focused.  Right now I'm capturing
events in my own event loop with gdk_event_get ().  It seems to get GDK_DELETE
and GDK_DESTROY fine, but GDK_KEY_PRESS or GDK_KEY_RELEASE never come up.  Is
there another way to go about this; am I doing anything incorrectly?

Here's the code:

do
{
  ev = gdk_event_get ();
  if (ev)
    switch (ev->type)
    {
      case GDK_KEY_PRESS:
        printf ("0%o\n", ev->key.keyval);
        break;
      case GDK_DELETE:
      case GDK_DESTROY:
        gdk_exit (0);
    }
} while (1);

--
tile
tile@primenet.com



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