remove race condition from workspace warping code
This commit is contained in:
parent
186ebd5870
commit
d2bb60239b
2 changed files with 22 additions and 15 deletions
|
@ -1,6 +1,8 @@
|
||||||
(Format: Year/Month/Day)
|
(Format: Year/Month/Day)
|
||||||
Changes for 1.0rc3:
|
Changes for 1.0rc3:
|
||||||
*07/01/07:
|
*07/01/07:
|
||||||
|
* Fixed workspace warping going crazy, bug #1467124 (Mark)
|
||||||
|
Window.cc
|
||||||
* Fix little bug with iconbar rendering, bug #1549209 (Mark)
|
* Fix little bug with iconbar rendering, bug #1549209 (Mark)
|
||||||
IconbarTool.cc
|
IconbarTool.cc
|
||||||
* Fix RefCount crash and Slit deconstruction ordering (Simon)
|
* Fix RefCount crash and Slit deconstruction ordering (Simon)
|
||||||
|
|
|
@ -2849,12 +2849,6 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
|
||||||
if (! isMoving()) {
|
if (! isMoving()) {
|
||||||
startMoving(me.x_root, me.y_root);
|
startMoving(me.x_root, me.y_root);
|
||||||
} else {
|
} 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
|
// Warp to next or previous workspace?, must have moved sideways some
|
||||||
int moved_x = me.x_root - m_last_resize_x;
|
int moved_x = me.x_root - m_last_resize_x;
|
||||||
// save last event point
|
// save last event point
|
||||||
|
@ -2871,25 +2865,36 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
|
||||||
moved_x > 0) {
|
moved_x > 0) {
|
||||||
//warp right
|
//warp right
|
||||||
new_id = (cur_id + 1) % screen().numberOfWorkspaces();
|
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 &&
|
} else if (me.x_root <= warpPad &&
|
||||||
moved_x < 0) {
|
moved_x < 0) {
|
||||||
//warp left
|
//warp left
|
||||||
new_id = (cur_id + screen().numberOfWorkspaces() - 1) % screen().numberOfWorkspaces();
|
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) {
|
if (new_id != cur_id) {
|
||||||
|
|
||||||
XWarpPointer(display, None, None, 0, 0, 0, 0, dx, 0);
|
// 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
|
||||||
screen().changeWorkspaceID(new_id);
|
screen().changeWorkspaceID(new_id);
|
||||||
|
|
||||||
m_last_resize_x = me.x_root + dx;
|
|
||||||
|
|
||||||
// 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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
// dx = current left side, dy = current top
|
||||||
doSnapping(dx, dy);
|
doSnapping(dx, dy);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue