all repos — fluxbox @ d2bb60239be166dfe674e641ec1a8bf8e2748045

custom fork of the fluxbox windowmanager

remove race condition from workspace warping code
markt markt
commit

d2bb60239be166dfe674e641ec1a8bf8e2748045

parent

186ebd58707a1850abfaccecd41b02c9a5f6cf91

2 files changed, 21 insertions(+), 14 deletions(-)

jump to
M ChangeLogChangeLog

@@ -1,6 +1,8 @@

(Format: Year/Month/Day) Changes for 1.0rc3: *07/01/07: + * Fixed workspace warping going crazy, bug #1467124 (Mark) + Window.cc * Fix little bug with iconbar rendering, bug #1549209 (Mark) IconbarTool.cc * Fix RefCount crash and Slit deconstruction ordering (Simon)
M src/Window.ccsrc/Window.cc

@@ -2849,12 +2849,6 @@

if (! isMoving()) { startMoving(me.x_root, me.y_root); } else { - int dx = me.x_root - m_button_grab_x, - dy = me.y_root - m_button_grab_y; - - dx -= frame().window().borderWidth(); - dy -= frame().window().borderWidth(); - // Warp to next or previous workspace?, must have moved sideways some int moved_x = me.x_root - m_last_resize_x; // save last event point

@@ -2871,25 +2865,36 @@ if (me.x_root >= int(screen().width()) - warpPad - 1 &&

moved_x > 0) { //warp right new_id = (cur_id + 1) % screen().numberOfWorkspaces(); - dx = - me.x_root; // move mouse back to x=0 + m_last_resize_x = 0; // move mouse back to x=0 } else if (me.x_root <= warpPad && moved_x < 0) { //warp left new_id = (cur_id + screen().numberOfWorkspaces() - 1) % screen().numberOfWorkspaces(); - dx = screen().width() - me.x_root-1; // move mouse to screen width - 1 + m_last_resize_x = screen().width() - 1; // move mouse to screen width - 1 } if (new_id != cur_id) { - XWarpPointer(display, None, None, 0, 0, 0, 0, dx, 0); - screen().changeWorkspaceID(new_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; + } - m_last_resize_x = me.x_root + dx; + // move the pointer to (m_last_resize_x,m_last_resize_y) + XWarpPointer(display, None, me.root, 0, 0, 0, 0, + m_last_resize_x, m_last_resize_y); - // dx is the difference, so our new x is what it would have been - // without the warp, plus the difference. - dx += me.x_root - m_button_grab_x; + screen().changeWorkspaceID(new_id); } } + + int dx = m_last_resize_x - m_button_grab_x, + dy = m_last_resize_y - m_button_grab_y; + + dx -= frame().window().borderWidth(); + dy -= frame().window().borderWidth(); + // dx = current left side, dy = current top doSnapping(dx, dy);