aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Lübking <thomas.luebking@gmail.com>2016-09-03 20:16:50 (GMT)
committerThomas Lübking <thomas.luebking@gmail.com>2016-09-03 22:09:40 (GMT)
commit6c2641404a62c55a231f8004e237aca459501309 (patch)
tree75c0a68832c9bddb7b417d9b14a8747bf710c4d0
parentb93010c5e27081d73abd8ed16b0ce3e789ae3edb (diff)
downloadfluxbox-6c2641404a62c55a231f8004e237aca459501309.zip
fluxbox-6c2641404a62c55a231f8004e237aca459501309.tar.bz2
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
-rw-r--r--src/Window.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/Window.cc b/src/Window.cc
index 5377965..ad58263 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -2462,6 +2462,8 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent &be) {
2462 2462
2463} 2463}
2464 2464
2465const unsigned int DEADZONE = 4;
2466
2465void FluxboxWindow::buttonReleaseEvent(XButtonEvent &re) { 2467void FluxboxWindow::buttonReleaseEvent(XButtonEvent &re) {
2466 2468
2467 if (m_last_pressed_button == static_cast<int>(re.button)) { 2469 if (m_last_pressed_button == static_cast<int>(re.button)) {
@@ -2474,7 +2476,7 @@ void FluxboxWindow::buttonReleaseEvent(XButtonEvent &re) {
2474 stopResizing(); 2476 stopResizing();
2475 else if (m_attaching_tab) 2477 else if (m_attaching_tab)
2476 attachTo(re.x_root, re.y_root); 2478 attachTo(re.x_root, re.y_root);
2477 else if (m_last_button_x == re.x_root && m_last_button_y == re.y_root) { 2479 else if (std::abs(m_last_button_x - re.x_root) + std::abs(m_last_button_y - re.y_root) < DEADZONE) {
2478 int context = 0; 2480 int context = 0;
2479 context = frame().getContext(re.subwindow ? re.subwindow : re.window, 2481 context = frame().getContext(re.subwindow ? re.subwindow : re.window,
2480 re.x_root, re.y_root); 2482 re.x_root, re.y_root);
@@ -2505,7 +2507,14 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2505 2507
2506 // in case someone put MoveX :StartMoving etc into keys, we have 2508 // in case someone put MoveX :StartMoving etc into keys, we have
2507 // to activate it before doing the actual motionNotify code 2509 // to activate it before doing the actual motionNotify code
2508 Fluxbox::instance()->keys()->doAction(me.type, me.state, m_last_pressed_button, context, &winClient(), me.time); 2510 if (std::abs(m_last_button_x - me.x_root) + std::abs(m_last_button_y - me.y_root) >= DEADZONE) {
2511 XEvent &e = const_cast<XEvent&>(Fluxbox::instance()->lastEvent()); // is copy of "me"
2512 e.xmotion.x_root = m_last_button_x;
2513 e.xmotion.y_root = m_last_button_y;
2514 Fluxbox::instance()->keys()->doAction(me.type, me.state, m_last_pressed_button, context, &winClient(), me.time);
2515 e.xmotion.x = me.x_root;
2516 e.xmotion.y = me.y_root;
2517 }
2509 2518
2510 if (moving) { 2519 if (moving) {
2511 2520