RE: [gtk-list] Re: Gdk Documentation



According to Preben Randhol:
| What are you trying to do by the way?

I'm trying to create my own event loop and capture key presses from the
keyboard.  Checking for GDK_KEY_PRESS and using event->key.keyval (I'm not sure
this is correct, I gleaned it from gdk/gdktypes.h).  It doesn't seem to work. 
It does, however, capture GDK_DESTROY and GDK_DELETE.  I'm stuck here, and I
don't know where to turn.  I eventually hope to enable the arrow keys control an
image I've pasted into the gdk window with gdk_imlib.

Here's the loop:

GdkEvent *ev;

...

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

--
tile
tile@primenet.com



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