- case Expose:
- while (g_xstuff.pXCheckTypedEvent(g_xstuff.display, Expose, &evt))
- ;
- break;
-
- case KeyPress:
- *is_down = 1;
- return g_xstuff.pXLookupKeysym(&evt.xkey, 0);
-
- case KeyRelease:
- *is_down = 0;
- return g_xstuff.pXLookupKeysym(&evt.xkey, 0);
- // printf("press %d\n", evt.xkey.keycode);
+ case Expose:
+ while (g_xstuff.pXCheckTypedEvent(g_xstuff.display, Expose, &evt))
+ ;
+ break;
+
+ case KeyPress:
+ keysym = g_xstuff.pXLookupKeysym(&evt.xkey, 0);
+ if (key_cb != NULL)
+ key_cb(cb_arg, keysym, 1);
+ break;
+
+ case KeyRelease:
+ keysym = g_xstuff.pXLookupKeysym(&evt.xkey, 0);
+ if (key_cb != NULL)
+ key_cb(cb_arg, keysym, 0);
+ break;
+
+ case ButtonPress:
+ if (mouseb_cb != NULL)
+ mouseb_cb(cb_arg, evt.xbutton.x, evt.xbutton.y,
+ evt.xbutton.button, 1);
+ break;
+
+ case ButtonRelease:
+ if (mouseb_cb != NULL)
+ mouseb_cb(cb_arg, evt.xbutton.x, evt.xbutton.y,
+ evt.xbutton.button, 0);
+ break;
+
+ case MotionNotify:
+ if (mousem_cb != NULL)
+ mousem_cb(cb_arg, evt.xmotion.x, evt.xmotion.y);
+ break;