aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAymeric Vincent <vaymeric@users.sf.net>2013-01-10 07:16:01 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2013-01-10 07:16:01 (GMT)
commit79fe2fca1de5140f538e68f6981b27cf7f917e7a (patch)
tree29bf771c02cda1f2739d0be1b6cc01643bde1553
parentcfe4a80f863ca774ef62e3d880f0aabddac223e7 (diff)
downloadfluxbox-79fe2fca1de5140f538e68f6981b27cf7f917e7a.zip
fluxbox-79fe2fca1de5140f538e68f6981b27cf7f917e7a.tar.bz2
Reduced lagging begind of windows on slower displays
In certain situations a speedy mouse might generate more move-events than fluxbox can handle: The event queue will fill up faster than the repositioning of the window is finished. The user will experience a window which lags behind the mouse cursor, aka the window-dance. We now check the next event in the queue and postpone the move a little bit so the queue does not fill up that fast.
-rw-r--r--src/Window.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Window.cc b/src/Window.cc
index 1195127..a15c6e0 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -2393,6 +2393,7 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2393 Fluxbox::instance()->keys()->doAction(me.type, me.state, m_last_pressed_button, context, &winClient(), me.time); 2393 Fluxbox::instance()->keys()->doAction(me.type, me.state, m_last_pressed_button, context, &winClient(), me.time);
2394 2394
2395 if (moving) { 2395 if (moving) {
2396 XEvent e;
2396 2397
2397 // Warp to next or previous workspace?, must have moved sideways some 2398 // Warp to next or previous workspace?, must have moved sideways some
2398 int moved_x = me.x_root - m_last_resize_x; 2399 int moved_x = me.x_root - m_last_resize_x;
@@ -2428,7 +2429,6 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2428 if (new_id != cur_id) { 2429 if (new_id != cur_id) {
2429 2430
2430 // remove motion events from queue to avoid repeated warps 2431 // remove motion events from queue to avoid repeated warps
2431 XEvent e;
2432 while (XCheckTypedEvent(display, MotionNotify, &e)) { 2432 while (XCheckTypedEvent(display, MotionNotify, &e)) {
2433 // might as well update the y-coordinate 2433 // might as well update the y-coordinate
2434 m_last_resize_y = e.xmotion.y_root; 2434 m_last_resize_y = e.xmotion.y_root;
@@ -2454,6 +2454,12 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2454 // dx = current left side, dy = current top 2454 // dx = current left side, dy = current top
2455 doSnapping(dx, dy); 2455 doSnapping(dx, dy);
2456 2456
2457 // do not update display if another motion event is already pending
2458 if (XCheckTypedEvent(display, MotionNotify, &e)) {
2459 XPutBackEvent(display, &e);
2460 return;
2461 }
2462
2457 if (!screen().doOpaqueMove()) { 2463 if (!screen().doOpaqueMove()) {
2458 parent().drawRectangle(screen().rootTheme()->opGC(), 2464 parent().drawRectangle(screen().rootTheme()->opGC(),
2459 dx, dy, 2465 dx, dy,