diff --git a/src/Window.cc b/src/Window.cc index 53779655..ad58263f 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -2462,6 +2462,8 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent &be) { } +const unsigned int DEADZONE = 4; + void FluxboxWindow::buttonReleaseEvent(XButtonEvent &re) { if (m_last_pressed_button == static_cast<int>(re.button)) { @@ -2474,7 +2476,7 @@ void FluxboxWindow::buttonReleaseEvent(XButtonEvent &re) { stopResizing(); else if (m_attaching_tab) attachTo(re.x_root, re.y_root); - else if (m_last_button_x == re.x_root && m_last_button_y == re.y_root) { + else if (std::abs(m_last_button_x - re.x_root) + std::abs(m_last_button_y - re.y_root) < DEADZONE) { int context = 0; context = frame().getContext(re.subwindow ? re.subwindow : re.window, re.x_root, re.y_root); @@ -2505,7 +2507,14 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) { // in case someone put MoveX :StartMoving etc into keys, we have // to activate it before doing the actual motionNotify code - Fluxbox::instance()->keys()->doAction(me.type, me.state, m_last_pressed_button, context, &winClient(), me.time); + if (std::abs(m_last_button_x - me.x_root) + std::abs(m_last_button_y - me.y_root) >= DEADZONE) { + XEvent &e = const_cast<XEvent&>(Fluxbox::instance()->lastEvent()); // is copy of "me" + e.xmotion.x_root = m_last_button_x; + e.xmotion.y_root = m_last_button_y; + Fluxbox::instance()->keys()->doAction(me.type, me.state, m_last_pressed_button, context, &winClient(), me.time); + e.xmotion.x = me.x_root; + e.xmotion.y = me.y_root; + } if (moving) {