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
This commit is contained in:
Havoc Pennington 2002-10-03 21:49:13 +00:00 committed by Havoc Pennington
parent ba9d2d1a71
commit a544f68ac9
2 changed files with 18 additions and 10 deletions

View File

@ -1,3 +1,8 @@
2002-10-03 Havoc Pennington <hp@redhat.com>
* src/window.c (check_moveresize_frequency): handle the case where
the clock is set backward
2002-10-01 Havoc Pennington <hp@pobox.com> 2002-10-01 Havoc Pennington <hp@pobox.com>
* src/place.c (find_next_cascade): try extra cascades alongside * src/place.c (find_next_cascade): try extra cascades alongside

View File

@ -6061,6 +6061,14 @@ window_query_root_pointer (MetaWindow *window,
*y = root_y_return; *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 static gboolean
check_moveresize_frequency (MetaWindow *window) check_moveresize_frequency (MetaWindow *window)
{ {
@ -6074,9 +6082,12 @@ check_moveresize_frequency (MetaWindow *window)
((((double)current_time.tv_sec - window->display->grab_last_moveresize_time.tv_sec) * G_USEC_PER_SEC + ((((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; (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 #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; return FALSE;
else if (elapsed < (0.0 - EPSILON)) /* handle clock getting set backward */
clear_moveresize_time (window);
/* store latest time */ /* store latest time */
window->display->grab_last_moveresize_time = current_time; window->display->grab_last_moveresize_time = current_time;
@ -6084,14 +6095,6 @@ check_moveresize_frequency (MetaWindow *window)
return TRUE; return TRUE;
} }
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 static void
update_move (MetaWindow *window, update_move (MetaWindow *window,
unsigned int mask, unsigned int mask,