mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
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:
parent
ba9d2d1a71
commit
a544f68ac9
@ -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>
|
||||
|
||||
* src/place.c (find_next_cascade): try extra cascades alongside
|
||||
|
23
src/window.c
23
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,24 +6082,19 @@ 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;
|
||||
|
||||
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
|
||||
update_move (MetaWindow *window,
|
||||
unsigned int mask,
|
||||
|
Loading…
Reference in New Issue
Block a user