+
+
+void Actions::leaveHandler(const XCrossingEvent &e)
+{
+ otk::EventHandler::leaveHandler(e);
+
+ // run the LEAVE python hook
+ int screen;
+ Client *c = openbox->findClient(e.window);
+ if (c)
+ screen = c->screen();
+ else
+ screen = otk::display->findScreen(e.root)->screen();
+ EventData data(screen, c, EventLeaveWindow, e.state);
+ openbox->bindings()->fireEvent(&data);
+}
+
+
+void Actions::keyPressHandler(const XKeyEvent &e)
+{
+ otk::EventHandler::keyPressHandler(e);
+
+ // kill off the Button1Mask etc, only want the modifiers
+ unsigned int state = e.state & (ControlMask | ShiftMask | Mod1Mask |
+ Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask);
+ openbox->bindings()->
+ fireKey(otk::display->findScreen(e.root)->screen(),
+ state, e.keycode, e.time);
+}
+
+
+void Actions::motionHandler(const XMotionEvent &e)
+{
+ otk::EventHandler::motionHandler(e);
+
+ if (!e.same_screen) return; // this just gets stupid
+
+ 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, e.type, &ce)) {
+ if (ce.xmotion.window != e.window) {
+ XPutBackEvent(**otk::display, &ce);
+ break;
+ } else {
+ x_root = e.x_root;
+ y_root = e.y_root;
+ }
+ }
+
+ WidgetBase *w = dynamic_cast<WidgetBase*>
+ (openbox->findHandler(e.window));
+ if (!w) return;
+
+ // 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->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->bindings()->fireButton(&data);
+}
+
+void Actions::mapRequestHandler(const XMapRequestEvent &e)
+{
+ otk::EventHandler::mapRequestHandler(e);
+ // do this in Screen::manageWindow
+}
+
+void Actions::unmapHandler(const XUnmapEvent &e)
+{
+ otk::EventHandler::unmapHandler(e);
+ // do this in Screen::unmanageWindow
+}
+
+void Actions::destroyHandler(const XDestroyWindowEvent &e)
+{
+ otk::EventHandler::destroyHandler(e);
+ // do this in Screen::unmanageWindow
+}
+
+#ifdef XKB
+void Actions::xkbHandler(const XkbEvent &e)
+{
+ Window w;
+ int screen;
+
+ otk::EventHandler::xkbHandler(e);
+
+ switch (((XkbAnyEvent*)&e)->xkb_type) {
+ case XkbBellNotify:
+ w = ((XkbBellNotifyEvent*)&e)->window;
+ Client *c = openbox->findClient(w);
+ if (c)
+ screen = c->screen();
+ else
+ screen = openbox->focusedScreen()->number();
+ EventData data(screen, c, EventBell, 0);
+ openbox->bindings()->fireEvent(&data);
+ break;
+ }
+}
+#endif // XKB
+
+}
+