diff options
Diffstat (limited to 'src/core/window.c')
-rw-r--r-- | src/core/window.c | 45 |
1 files changed, 16 insertions, 29 deletions
diff --git a/src/core/window.c b/src/core/window.c index 83d0a33e..9dfe8634 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -408,8 +408,7 @@ meta_window_new_with_attrs (MetaDisplay *display, #ifdef HAVE_XSYNC window->sync_request_counter = None; window->sync_request_serial = 0; - window->sync_request_time.tv_sec = 0; - window->sync_request_time.tv_usec = 0; + window->sync_request_time = 0; #endif window->screen = NULL; @@ -3429,7 +3428,7 @@ send_sync_request (MetaWindow *window) XSendEvent (window->display->xdisplay, window->xwindow, False, 0, (XEvent*) &ev); - g_get_current_time (&window->sync_request_time); + window->sync_request_time = g_get_real_time (); } #endif @@ -3838,8 +3837,7 @@ meta_window_move_resize_internal (MetaWindow *window, #ifdef HAVE_XSYNC if (window->sync_request_counter != None && window->display->grab_sync_request_alarm != None && - window->sync_request_time.tv_usec == 0 && - window->sync_request_time.tv_sec == 0) + window->sync_request_time == 0) { /* turn off updating */ if (window->display->compositor) @@ -7141,38 +7139,27 @@ meta_window_titlebar_is_onscreen (MetaWindow *window) } static double -timeval_to_ms (const GTimeVal *timeval) +time_diff (const gint64 first, + const gint64 second) { - return (timeval->tv_sec * G_USEC_PER_SEC + timeval->tv_usec) / 1000.0; -} - -static double -time_diff (const GTimeVal *first, - const GTimeVal *second) -{ - double first_ms = timeval_to_ms (first); - double second_ms = timeval_to_ms (second); - - return first_ms - second_ms; + return (first - second) / 1000.0; } static gboolean check_moveresize_frequency (MetaWindow *window, gdouble *remaining) { - GTimeVal current_time; - - g_get_current_time (¤t_time); + gint64 current_time; + current_time = g_get_real_time (); #ifdef HAVE_XSYNC if (!window->disable_sync && window->display->grab_sync_request_alarm != None) { - if (window->sync_request_time.tv_sec != 0 || - window->sync_request_time.tv_usec != 0) - { - double elapsed = - time_diff (¤t_time, &window->sync_request_time); + if (window->sync_request_time != 0) + { + double elapsed = + time_diff (current_time, window->sync_request_time); if (elapsed < 1000.0) { @@ -7208,7 +7195,7 @@ check_moveresize_frequency (MetaWindow *window, const double ms_between_resizes = 1000.0 / max_resizes_per_second; double elapsed; - elapsed = time_diff (¤t_time, &window->display->grab_last_moveresize_time); + elapsed = time_diff (current_time, window->display->grab_last_moveresize_time); if (elapsed >= 0.0 && elapsed < ms_between_resizes) { @@ -7775,7 +7762,7 @@ update_resize (MetaWindow *window, /* Store the latest resize time, if we actually resized. */ if (window->rect.width != old.width || window->rect.height != old.height) - g_get_current_time (&window->display->grab_last_moveresize_time); + window->display->grab_last_moveresize_time = g_get_real_time (); } typedef struct @@ -7821,6 +7808,7 @@ check_use_this_motion_notify (MetaWindow *window, "Arrived at event with time %u (waiting for %u), using it\n", (unsigned int)event->xmotion.time, window->display->grab_motion_notify_time); + window->display->grab_motion_notify_time = 0; return TRUE; } @@ -7885,8 +7873,7 @@ meta_window_handle_mouse_grab_op_event (MetaWindow *window, * busy with a pagefault or a long computation). */ window->disable_sync = FALSE; - window->sync_request_time.tv_sec = 0; - window->sync_request_time.tv_usec = 0; + window->sync_request_time = 0; /* This means we are ready for another configure. */ switch (window->display->grab_op) |