- // XXX: i can envision all sorts of crazy shit with this.. gestures, etc
- printf("GUILE: MOTION: win %lx modifiers %u x %d y %d\n",
- (long)e.window, e.state, _dx, _dy);
+ // compress changes to a window into a single change
+ XEvent ce;
+ while (XCheckTypedEvent(otk::OBDisplay::display, e.type, &ce)) {
+ if (ce.xmotion.window != e.window) {
+ XPutBackEvent(otk::OBDisplay::display, &ce);
+ break;
+ } else {
+ x_root = e.x_root;
+ y_root = e.y_root;
+ }
+ }
+
+ OBWidget *w = dynamic_cast<OBWidget*>
+ (Openbox::instance->findHandler(e.window));
+ assert(w); // everything should be a widget
+
+ // run the MOTION python hook
+ unsigned int state = e.state & (ControlMask | ShiftMask | Mod1Mask |
+ Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask);
+ unsigned int button = _posqueue[0]->button;
+ MotionData *data = new_motion_data(e.window, e.time, state, button,
+ w->mcontext(), MouseMotion,
+ x_root, y_root, _posqueue[0]->pos,
+ _posqueue[0]->clientarea);
+ Openbox::instance->bindings()->fireButton((ButtonData*)data);
+ Py_DECREF((PyObject*)data);