allow 4px deadzone for clicks

For the shaky ones.
Since this introduces a visible gap between trigger and move event, we
temporarily manipulate the coordinates in the global last event what
covers the outdated patch #134

REQUEST: 178
This commit is contained in:
Thomas Lübking 2016-09-03 22:16:50 +02:00
parent b93010c5e2
commit 6c2641404a

View file

@ -2462,6 +2462,8 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent &be) {
} }
const unsigned int DEADZONE = 4;
void FluxboxWindow::buttonReleaseEvent(XButtonEvent &re) { void FluxboxWindow::buttonReleaseEvent(XButtonEvent &re) {
if (m_last_pressed_button == static_cast<int>(re.button)) { if (m_last_pressed_button == static_cast<int>(re.button)) {
@ -2474,7 +2476,7 @@ void FluxboxWindow::buttonReleaseEvent(XButtonEvent &re) {
stopResizing(); stopResizing();
else if (m_attaching_tab) else if (m_attaching_tab)
attachTo(re.x_root, re.y_root); 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; int context = 0;
context = frame().getContext(re.subwindow ? re.subwindow : re.window, context = frame().getContext(re.subwindow ? re.subwindow : re.window,
re.x_root, re.y_root); 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 // in case someone put MoveX :StartMoving etc into keys, we have
// to activate it before doing the actual motionNotify code // to activate it before doing the actual motionNotify code
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); 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) { if (moving) {