- printf("GUILE: KEY: win %lx type %d modifiers %u keycode %u\n",
- (long)e.window, (w ? w->type():-1), e.state, e.keycode);
+ int x_root = e.x_root, y_root = e.y_root;
+
+ // compress changes to a window into a single change
+ XEvent ce;
+ while (XCheckTypedEvent(otk::Display::display, e.type, &ce)) {
+ if (ce.xmotion.window != e.window) {
+ XPutBackEvent(otk::Display::display, &ce);
+ break;
+ } else {
+ x_root = e.x_root;
+ y_root = e.y_root;
+ }
+ }
+
+ WidgetBase *w = dynamic_cast<WidgetBase*>
+ (Openbox::instance->findHandler(e.window));
+ assert(w); // everything should be a widget
+
+ // run the MOTION python hook
+ // kill off the Button1Mask etc, only want the modifiers
+ unsigned int state = e.state & (ControlMask | ShiftMask | Mod1Mask |
+ Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask);
+ unsigned int button = _posqueue[0]->button;
+ int screen;
+ Client *c = Openbox::instance->findClient(e.window);
+ if (c)
+ screen = c->screen();
+ else
+ screen = otk::Display::findScreen(e.root)->screen();
+ MouseData data(screen, c, e.time, state, button, w->mcontext(), MouseMotion,
+ x_root, y_root, _posqueue[0]->pos, _posqueue[0]->clientarea);
+ Openbox::instance->bindings()->fireButton(&data);