- _dx = x_root - _posqueue[0]->pos.x(); _posqueue[0]->pos.setX(x_root);
- _dy = y_root - _posqueue[0]->pos.y(); _posqueue[0]->pos.setY(y_root);
-
- OBWidget *w = dynamic_cast<OBWidget*>
- (Openbox::instance->findHandler(e.window));
-
- // XXX: i can envision all sorts of crazy shit with this.. gestures, etc
- // maybe that should all be done via python tho.. (or radial menus!)
- // run the simple MOTION python hook for now...
-/* doCallback(Action_MouseMotion, e.window,
- (OBWidget::WidgetType)(w ? w->type():-1),
- e.state, (unsigned)-1, x_root, y_root, e.time);*/
- if (w) {
- Openbox::instance->bindings()->fire(MouseMotion, w->type(), e.window,
- e.state, _posqueue[0]->button,
- _dx, _dy, e.time);
- } else
- assert(false); // why isnt there a type?
-}
-
-void OBActions::mapRequestHandler(const XMapRequestEvent &e)
-{
- doCallback(Action_NewWindow, e.window, (OBWidget::WidgetType)-1,
- 0, 0, 0, 0, 0);
-}
-
-void OBActions::unmapHandler(const XUnmapEvent &e)
-{
- (void)e;
- doCallback(Action_CloseWindow, e.window, (OBWidget::WidgetType)-1,
- 0, 0, 0, 0, 0);
-}
-
-void OBActions::destroyHandler(const XDestroyWindowEvent &e)
-{
- (void)e;
- doCallback(Action_CloseWindow, e.window, (OBWidget::WidgetType)-1,
- 0, 0, 0, 0, 0);
-}
-
-void OBActions::doCallback(ActionType action, Window window,
- OBWidget::WidgetType type, unsigned int state,
- unsigned int button, int xroot, int yroot,
- Time time)
-{
- std::pair<CallbackMap::iterator, CallbackMap::iterator> it_pair =
- _callbacks.equal_range(action);
-
- CallbackMap::iterator it;
-// for (it = it_pair.first; it != it_pair.second; ++it)
-// python_callback(it->second, action, window, type, state,
-// button, xroot, yroot, time);
- // XXX do a callback
-}
-
-bool OBActions::registerCallback(ActionType action, PyObject *func,
- bool atfront)
-{
- if (action < 0 || action >= OBActions::NUM_ACTIONS) {
- return false;
+ WidgetBase *w = dynamic_cast<WidgetBase*>
+ (openbox->findHandler(e.window));
+ if (!w) return;
+
+ if (!_dragging) {
+ long threshold;
+ int dx = x_root - _posqueue[0]->pos.x();
+ int dy = y_root - _posqueue[0]->pos.y();
+ // XXX: dont get this from python every time!
+ if (!python_get_long("drag_threshold", &threshold))
+ threshold = 0;
+ if (!(std::abs(dx) >= threshold || std::abs(dy) >= threshold))
+ return; // not at the threshold yet