diff options
author | Elijah Newren <newren@gmail.com> | 2005-10-24 01:24:54 +0000 |
---|---|---|
committer | Elijah Newren <newren@src.gnome.org> | 2005-10-24 01:24:54 +0000 |
commit | 895ce4d11e4df28ff35d5d97b14fc276d412bd08 (patch) | |
tree | a96d6eee061d9a51a68558e90d38b84bad5bb00a | |
parent | 290fad0783714056618d13530163d3bf380381bb (diff) | |
download | metacity-895ce4d11e4df28ff35d5d97b14fc276d412bd08.tar.gz |
Fix (both keyboard and mouse) snap-moving from erroneously operating
2005-10-23 Elijah Newren <newren@gmail.com>
Fix (both keyboard and mouse) snap-moving from erroneously
operating multi-dimensionally. #124582.
* src/display.h (struct MetaDisplay): to avoid some flickering,
add a grab_ignore_enter_leave_until_mouse_motion field
* src/display.c (meta_display_being_grab_op): Initialize
display->grab_ignore_enter_leave_until_mouse_motion
* src/window.c (update_move): get the old position of the window
and only do snap moving if the position has changed, also fix a
horizontal/vertical maximization positioning bug,
(meta_window_handle_mouse_grab_op_event): handle
display->grab_ignore_enter_leave_until_mouse_motion,
(warp_grab_pointer): update the grab position so that the mouse
motion from the warping of the pointer doesn't cause snapping too,
turn off using enter/leave notify events for mouse motion in order
to avoid some flickering
-rw-r--r-- | ChangeLog | 21 | ||||
-rw-r--r-- | src/display.c | 1 | ||||
-rw-r--r-- | src/display.h | 1 | ||||
-rw-r--r-- | src/window.c | 29 |
4 files changed, 48 insertions, 4 deletions
@@ -1,5 +1,26 @@ 2005-10-23 Elijah Newren <newren@gmail.com> + Fix (both keyboard and mouse) snap-moving from erroneously + operating multi-dimensionally. #124582. + + * src/display.h (struct MetaDisplay): to avoid some flickering, + add a grab_ignore_enter_leave_until_mouse_motion field + + * src/display.c (meta_display_being_grab_op): Initialize + display->grab_ignore_enter_leave_until_mouse_motion + + * src/window.c (update_move): get the old position of the window + and only do snap moving if the position has changed, also fix a + horizontal/vertical maximization positioning bug, + (meta_window_handle_mouse_grab_op_event): handle + display->grab_ignore_enter_leave_until_mouse_motion, + (warp_grab_pointer): update the grab position so that the mouse + motion from the warping of the pointer doesn't cause snapping too, + turn off using enter/leave notify events for mouse motion in order + to avoid some flickering + +2005-10-23 Elijah Newren <newren@gmail.com> + Various tiny cleanups * constraints-ideas.txt: Update for little things fixed, reminder diff --git a/src/display.c b/src/display.c index ccfa9385..aa5919de 100644 --- a/src/display.c +++ b/src/display.c @@ -3260,6 +3260,7 @@ meta_display_begin_grab_op (MetaDisplay *display, display->grab_anchor_root_y = root_y; display->grab_latest_motion_x = root_x; display->grab_latest_motion_y = root_y; + display->grab_ignore_enter_leave_until_mouse_motion = FALSE; display->grab_last_moveresize_time.tv_sec = 0; display->grab_last_moveresize_time.tv_usec = 0; display->grab_motion_notify_time = 0; diff --git a/src/display.h b/src/display.h index 5d587533..dfad444c 100644 --- a/src/display.h +++ b/src/display.h @@ -253,6 +253,7 @@ struct _MetaDisplay MetaRectangle grab_anchor_window_pos; int grab_latest_motion_x; int grab_latest_motion_y; + gboolean grab_ignore_enter_leave_until_mouse_motion; gulong grab_mask; guint grab_have_pointer : 1; guint grab_have_keyboard : 1; diff --git a/src/window.c b/src/window.c index 9b749117..072cad88 100644 --- a/src/window.c +++ b/src/window.c @@ -6407,6 +6407,7 @@ update_move (MetaWindow *window, { int dx, dy; int new_x, new_y; + int old_x, old_y; int shake_threshold; window->display->grab_latest_motion_x = x; @@ -6514,21 +6515,23 @@ update_move (MetaWindow *window, } } + meta_window_get_position (window, &old_x, &old_y); + if (mask & ShiftMask) { /* snap to edges */ - if (dy != 0) + if (new_x != old_x) new_x = meta_window_find_nearest_vertical_edge (window, new_x); - if (dx != 0) + if (new_y != old_y) new_y = meta_window_find_nearest_horizontal_edge (window, new_y); } /* Don't allow movement in the maximized directions */ if (window->maximized_horizontally) - new_x = window->rect.x; + new_x = old_x; if (window->maximized_vertically) - new_y = window->rect.y; + new_y = old_y; if (window->display->grab_wireframe_active) meta_window_update_wireframe (window, new_x, new_y, @@ -6913,6 +6916,8 @@ meta_window_handle_mouse_grab_op_event (MetaWindow *window, { if (event->xmotion.root == window->screen->xroot) { + window->display->grab_ignore_enter_leave_until_mouse_motion = + FALSE; if (check_use_this_motion_notify (window, event)) update_move (window, @@ -6925,6 +6930,8 @@ meta_window_handle_mouse_grab_op_event (MetaWindow *window, { if (event->xmotion.root == window->screen->xroot) { + window->display->grab_ignore_enter_leave_until_mouse_motion = + FALSE; if (check_use_this_motion_notify (window, event)) update_resize (window, @@ -6937,6 +6944,8 @@ meta_window_handle_mouse_grab_op_event (MetaWindow *window, case EnterNotify: case LeaveNotify: + if (window->display->grab_ignore_enter_leave_until_mouse_motion) + break; if (meta_grab_op_is_moving (window->display->grab_op)) { if (event->xcrossing.root == window->screen->xroot) @@ -7429,6 +7438,18 @@ warp_grab_pointer (MetaWindow *window, meta_topic (META_DEBUG_WINDOW_OPS, "Warping pointer to %d,%d with window at %d,%d\n", *x, *y, rect.x, rect.y); + + /* Avoid some ugly flickering that warping the pointer could cause */ + window->display->grab_ignore_enter_leave_until_mouse_motion = TRUE; + /* Need to update the grab positions so that the XWarpPointer() call from + * meta_window_update_keyboard_move() doesn't cause funkiness. See bug + * 124582. + */ + window->display->grab_anchor_root_x = *x; + window->display->grab_anchor_root_y = *y; + meta_window_get_position (window, + &window->display->grab_anchor_window_pos.x, + &window->display->grab_anchor_window_pos.y); XWarpPointer (window->display->xdisplay, None, |