summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-02-03 13:39:55 +0100
committerraveit65 <[email protected]>2020-02-21 17:31:50 +0100
commit3b6919c5eafb76f36f240f8c5651698539860853 (patch)
treeba8ada86c24155c94aca9ade30d194eebec7adfc
parent7ffa17976ba5d0549ac2fb8a81c65dd19aac3767 (diff)
downloadmarco-3b6919c5eafb76f36f240f8c5651698539860853.tar.bz2
marco-3b6919c5eafb76f36f240f8c5651698539860853.tar.xz
remove warning: 'GTimeVal' is deprecated
-rw-r--r--src/core/display-private.h2
-rw-r--r--src/core/display.c7
-rw-r--r--src/core/effects.c12
-rw-r--r--src/core/screen.c16
-rw-r--r--src/core/window-private.h2
-rw-r--r--src/core/window.c45
6 files changed, 34 insertions, 50 deletions
diff --git a/src/core/display-private.h b/src/core/display-private.h
index 586ed26e..3352fb72 100644
--- a/src/core/display-private.h
+++ b/src/core/display-private.h
@@ -184,7 +184,7 @@ struct _MetaDisplay {
int grab_initial_x, grab_initial_y; /* These are only relevant for */
gboolean grab_threshold_movement_reached; /* raise_on_click == FALSE. */
MetaResizePopup* grab_resize_popup;
- GTimeVal grab_last_moveresize_time;
+ gint64 grab_last_moveresize_time;
guint32 grab_motion_notify_time;
int grab_wireframe_last_display_width;
int grab_wireframe_last_display_height;
diff --git a/src/core/display.c b/src/core/display.c
index dc741b32..0214d5e6 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -3658,8 +3658,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_last_moveresize_time.tv_sec = 0;
- display->grab_last_moveresize_time.tv_usec = 0;
+ display->grab_last_moveresize_time = 0;
display->grab_motion_notify_time = 0;
display->grab_old_window_stacking = NULL;
#ifdef HAVE_XSYNC
@@ -3712,9 +3711,7 @@ meta_display_begin_grab_op (MetaDisplay *display,
display->grab_window->sync_request_counter, init);
display->grab_window->sync_request_serial = 0;
- display->grab_window->sync_request_time.tv_sec = 0;
- display->grab_window->sync_request_time.tv_usec = 0;
-
+ display->grab_window->sync_request_time = 0;
values.trigger.counter = display->grab_window->sync_request_counter;
values.trigger.value_type = XSyncAbsolute;
values.trigger.test_type = XSyncPositiveTransition;
diff --git a/src/core/effects.c b/src/core/effects.c
index 2866246f..f23c60f2 100644
--- a/src/core/effects.c
+++ b/src/core/effects.c
@@ -79,7 +79,7 @@ typedef struct
MetaScreen *screen;
double millisecs_duration;
- GTimeVal start_time;
+ gint64 start_time;
#ifdef HAVE_SHAPE
/** For wireframe window */
@@ -318,7 +318,7 @@ static gboolean
effects_draw_box_animation_timeout (BoxAnimationContext *context)
{
double elapsed;
- GTimeVal current_time;
+ gint64 current_time;
MetaRectangle draw_rect;
double fraction;
@@ -337,12 +337,10 @@ effects_draw_box_animation_timeout (BoxAnimationContext *context)
#endif /* !HAVE_SHAPE */
- g_get_current_time (&current_time);
+ current_time = g_get_real_time ();
/* We use milliseconds for all times */
- elapsed =
- ((((double)current_time.tv_sec - context->start_time.tv_sec) * G_USEC_PER_SEC +
- (current_time.tv_usec - context->start_time.tv_usec))) / 1000.0;
+ elapsed = (current_time - context->start_time) / 1000.0;
if (elapsed < 0)
{
@@ -481,7 +479,7 @@ draw_box_animation (MetaScreen *screen,
/* Do this only after we get the pixbuf from the server,
* so that the animation doesn't get truncated.
*/
- g_get_current_time (&context->start_time);
+ context->start_time = g_get_real_time ();
/* Add the timeout - a short one, could even use an idle,
* but this is maybe more CPU-friendly.
diff --git a/src/core/screen.c b/src/core/screen.c
index 78a41d83..feaac951 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -2607,7 +2607,7 @@ remove_sequence (MetaScreen *screen,
typedef struct
{
GSList *list;
- GTimeVal now;
+ gint64 now;
} CollectTimedOutData;
/* This should be fairly long, as it should never be required unless
@@ -2623,14 +2623,15 @@ collect_timed_out_foreach (void *element,
{
CollectTimedOutData *ctod = data;
SnStartupSequence *sequence = element;
- long tv_sec, tv_usec;
double elapsed;
- sn_startup_sequence_get_last_active_time (sequence, &tv_sec, &tv_usec);
+ time_t tv_sec;
+ suseconds_t tv_usec;
+ gint64 tv;
- elapsed =
- ((((double)ctod->now.tv_sec - tv_sec) * G_USEC_PER_SEC +
- (ctod->now.tv_usec - tv_usec))) / 1000.0;
+ sn_startup_sequence_get_last_active_time (sequence, &tv_sec, &tv_usec);
+ tv = (tv_sec * G_USEC_PER_SEC) + tv_usec;
+ elapsed = (ctod->now - tv) / 1000.0;
meta_topic (META_DEBUG_STARTUP,
"Sequence used %g seconds vs. %g max: %s\n",
@@ -2649,7 +2650,8 @@ startup_sequence_timeout (void *data)
GSList *tmp;
ctod.list = NULL;
- g_get_current_time (&ctod.now);
+
+ ctod.now = g_get_real_time ();
g_slist_foreach (screen->startup_sequences,
collect_timed_out_foreach,
&ctod);
diff --git a/src/core/window-private.h b/src/core/window-private.h
index 008979e5..5abef1e1 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -345,7 +345,7 @@ struct _MetaWindow
/* XSync update counter */
XSyncCounter sync_request_counter;
guint sync_request_serial;
- GTimeVal sync_request_time;
+ gint64 sync_request_time;
#endif
/* Number of UnmapNotify that are caused by us, if
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 (&current_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 (&current_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 (&current_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)