summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2002-10-03 21:49:13 +0000
committerHavoc Pennington <hp@src.gnome.org>2002-10-03 21:49:13 +0000
commita544f68ac967e6ab15d97b7dd53d03e4c675c374 (patch)
tree948a4348cd284a1ec44f6dc3875cfd6cf9634e6b /src
parentba9d2d1a71f60a8160a0fcc40a641bd549c6e6fa (diff)
downloadmetacity-a544f68ac967e6ab15d97b7dd53d03e4c675c374.tar.gz
handle the case where the clock is set backward
2002-10-03 Havoc Pennington <hp@redhat.com> * src/window.c (check_moveresize_frequency): handle the case where the clock is set backward
Diffstat (limited to 'src')
-rw-r--r--src/window.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/window.c b/src/window.c
index 1df06e78..b538ec73 100644
--- a/src/window.c
+++ b/src/window.c
@@ -6061,6 +6061,14 @@ window_query_root_pointer (MetaWindow *window,
*y = root_y_return;
}
+static void
+clear_moveresize_time (MetaWindow *window)
+{
+ /* Forces the next update to actually do something */
+ window->display->grab_last_moveresize_time.tv_sec = 0;
+ window->display->grab_last_moveresize_time.tv_usec = 0;
+}
+
static gboolean
check_moveresize_frequency (MetaWindow *window)
{
@@ -6074,10 +6082,13 @@ check_moveresize_frequency (MetaWindow *window)
((((double)current_time.tv_sec - window->display->grab_last_moveresize_time.tv_sec) * G_USEC_PER_SEC +
(current_time.tv_usec - window->display->grab_last_moveresize_time.tv_usec))) / 1000.0;
+#define EPSILON (1e-6)
#define MAX_RESIZES_PER_SECOND 30.0
- if (elapsed < (1000.0 / MAX_RESIZES_PER_SECOND))
+ if (elapsed >= 0.0 && elapsed < (1000.0 / MAX_RESIZES_PER_SECOND))
return FALSE;
-
+ else if (elapsed < (0.0 - EPSILON)) /* handle clock getting set backward */
+ clear_moveresize_time (window);
+
/* store latest time */
window->display->grab_last_moveresize_time = current_time;
@@ -6085,14 +6096,6 @@ check_moveresize_frequency (MetaWindow *window)
}
static void
-clear_moveresize_time (MetaWindow *window)
-{
- /* Forces the next update to actually do something */
- window->display->grab_last_moveresize_time.tv_sec = 0;
- window->display->grab_last_moveresize_time.tv_usec = 0;
-}
-
-static void
update_move (MetaWindow *window,
unsigned int mask,
int x,