From 79fe2fca1de5140f538e68f6981b27cf7f917e7a Mon Sep 17 00:00:00 2001 From: Aymeric Vincent Date: Thu, 10 Jan 2013 08:16:01 +0100 Subject: 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. --- src/Window.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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) { Fluxbox::instance()->keys()->doAction(me.type, me.state, m_last_pressed_button, context, &winClient(), me.time); if (moving) { + XEvent e; // Warp to next or previous workspace?, must have moved sideways some int moved_x = me.x_root - m_last_resize_x; @@ -2428,7 +2429,6 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) { if (new_id != cur_id) { // remove motion events from queue to avoid repeated warps - XEvent e; while (XCheckTypedEvent(display, MotionNotify, &e)) { // might as well update the y-coordinate m_last_resize_y = e.xmotion.y_root; @@ -2454,6 +2454,12 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) { // dx = current left side, dy = current top doSnapping(dx, dy); + // do not update display if another motion event is already pending + if (XCheckTypedEvent(display, MotionNotify, &e)) { + XPutBackEvent(display, &e); + return; + } + if (!screen().doOpaqueMove()) { parent().drawRectangle(screen().rootTheme()->opGC(), dx, dy, -- cgit v0.11.2