diff options
author | markt <markt> | 2007-01-07 18:44:46 (GMT) |
---|---|---|
committer | markt <markt> | 2007-01-07 18:44:46 (GMT) |
commit | d2bb60239be166dfe674e641ec1a8bf8e2748045 (patch) | |
tree | d1096ed5d03905bfcce3435652177a5a881f3c3b | |
parent | 186ebd58707a1850abfaccecd41b02c9a5f6cf91 (diff) | |
download | fluxbox_paul-d2bb60239be166dfe674e641ec1a8bf8e2748045.zip fluxbox_paul-d2bb60239be166dfe674e641ec1a8bf8e2748045.tar.bz2 |
remove race condition from workspace warping code
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | src/Window.cc | 33 |
2 files changed, 21 insertions, 14 deletions
@@ -1,6 +1,8 @@ | |||
1 | (Format: Year/Month/Day) | 1 | (Format: Year/Month/Day) |
2 | Changes for 1.0rc3: | 2 | Changes for 1.0rc3: |
3 | *07/01/07: | 3 | *07/01/07: |
4 | * Fixed workspace warping going crazy, bug #1467124 (Mark) | ||
5 | Window.cc | ||
4 | * Fix little bug with iconbar rendering, bug #1549209 (Mark) | 6 | * Fix little bug with iconbar rendering, bug #1549209 (Mark) |
5 | IconbarTool.cc | 7 | IconbarTool.cc |
6 | * Fix RefCount crash and Slit deconstruction ordering (Simon) | 8 | * Fix RefCount crash and Slit deconstruction ordering (Simon) |
diff --git a/src/Window.cc b/src/Window.cc index ca42c96..fe4cf4a 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -2849,12 +2849,6 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) { | |||
2849 | if (! isMoving()) { | 2849 | if (! isMoving()) { |
2850 | startMoving(me.x_root, me.y_root); | 2850 | startMoving(me.x_root, me.y_root); |
2851 | } else { | 2851 | } else { |
2852 | int dx = me.x_root - m_button_grab_x, | ||
2853 | dy = me.y_root - m_button_grab_y; | ||
2854 | |||
2855 | dx -= frame().window().borderWidth(); | ||
2856 | dy -= frame().window().borderWidth(); | ||
2857 | |||
2858 | // Warp to next or previous workspace?, must have moved sideways some | 2852 | // Warp to next or previous workspace?, must have moved sideways some |
2859 | int moved_x = me.x_root - m_last_resize_x; | 2853 | int moved_x = me.x_root - m_last_resize_x; |
2860 | // save last event point | 2854 | // save last event point |
@@ -2871,25 +2865,36 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) { | |||
2871 | moved_x > 0) { | 2865 | moved_x > 0) { |
2872 | //warp right | 2866 | //warp right |
2873 | new_id = (cur_id + 1) % screen().numberOfWorkspaces(); | 2867 | new_id = (cur_id + 1) % screen().numberOfWorkspaces(); |
2874 | dx = - me.x_root; // move mouse back to x=0 | 2868 | m_last_resize_x = 0; // move mouse back to x=0 |
2875 | } else if (me.x_root <= warpPad && | 2869 | } else if (me.x_root <= warpPad && |
2876 | moved_x < 0) { | 2870 | moved_x < 0) { |
2877 | //warp left | 2871 | //warp left |
2878 | new_id = (cur_id + screen().numberOfWorkspaces() - 1) % screen().numberOfWorkspaces(); | 2872 | new_id = (cur_id + screen().numberOfWorkspaces() - 1) % screen().numberOfWorkspaces(); |
2879 | dx = screen().width() - me.x_root-1; // move mouse to screen width - 1 | 2873 | m_last_resize_x = screen().width() - 1; // move mouse to screen width - 1 |
2880 | } | 2874 | } |
2881 | if (new_id != cur_id) { | 2875 | if (new_id != cur_id) { |
2882 | 2876 | ||
2883 | XWarpPointer(display, None, None, 0, 0, 0, 0, dx, 0); | 2877 | // remove motion events from queue to avoid repeated warps |
2884 | screen().changeWorkspaceID(new_id); | 2878 | XEvent e; |
2879 | while (XCheckTypedEvent(display, MotionNotify, &e)) { | ||
2880 | // might as well update the y-coordinate | ||
2881 | m_last_resize_y = e.xmotion.y_root; | ||
2882 | } | ||
2885 | 2883 | ||
2886 | m_last_resize_x = me.x_root + dx; | 2884 | // move the pointer to (m_last_resize_x,m_last_resize_y) |
2885 | XWarpPointer(display, None, me.root, 0, 0, 0, 0, | ||
2886 | m_last_resize_x, m_last_resize_y); | ||
2887 | 2887 | ||
2888 | // dx is the difference, so our new x is what it would have been | 2888 | screen().changeWorkspaceID(new_id); |
2889 | // without the warp, plus the difference. | ||
2890 | dx += me.x_root - m_button_grab_x; | ||
2891 | } | 2889 | } |
2892 | } | 2890 | } |
2891 | |||
2892 | int dx = m_last_resize_x - m_button_grab_x, | ||
2893 | dy = m_last_resize_y - m_button_grab_y; | ||
2894 | |||
2895 | dx -= frame().window().borderWidth(); | ||
2896 | dy -= frame().window().borderWidth(); | ||
2897 | |||
2893 | // dx = current left side, dy = current top | 2898 | // dx = current left side, dy = current top |
2894 | doSnapping(dx, dy); | 2899 | doSnapping(dx, dy); |
2895 | 2900 | ||