/* examples/glarea/event.c */ #include He_node *princ, *glarea; void glarea_repaint_proc (He_node *hn) { printf ("glarea_repaint_proc\n"); } void glarea_event_proc (He_node *hn, He_event *hev) { printf ("glarea_event_proc "); switch (hev->type) { case EnterNotify : printf ("EnterNotify\n"); break; case LeaveNotify : printf ("LeaveNotify\n"); break; case KeyPress : printf ("KeyPress: \"%s\" keysym = XK_%s len = %d\n", hev->str, XKeysymToString(hev->sym), hev->len); break; case KeyRelease : printf ("KeyRelease\n"); break; case ButtonPress : printf ("ButtonPress bouton %d\n", hev->sb); break; case ButtonRelease : printf ("ButtonRelease bouton %d\n", hev->sb); break; case MotionNotify : printf ("MotionNotify %d,%d\n", hev->sx, hev->sy); break; } } int main (int argc, char *argv[]) { int attr_list[] = { GLX_RGBA, None }; HeInit (&argc, &argv); princ = HeCreateFrame(); HeSetFrameLabel (princ, "Évènements du glarea"); glarea = HeCreateGLArea (princ, attr_list, NULL); HeSetGLAreaRepaintProc (glarea, glarea_repaint_proc); HeSetGLAreaEventProc (glarea, glarea_event_proc); HeSetWidth (glarea, 300); HeSetHeight (glarea, 300); HeFit (princ); return HeMainLoop (princ); }