x11: Stop using GTimeVal

It has been deprecated, and that is breaking our
ci builds with -Werror.
This commit is contained in:
Matthias Clasen 2020-07-31 10:54:41 -04:00
parent 8c66e2ff66
commit 2dfa5ac804
3 changed files with 11 additions and 13 deletions

View File

@ -127,13 +127,13 @@ end_startup_notification (GdkDisplay *display,
* the sequence (dont use an SnMonitorContext)
*/
#define STARTUP_TIMEOUT_LENGTH_SECONDS 30
#define STARTUP_TIMEOUT_LENGTH (STARTUP_TIMEOUT_LENGTH_SECONDS * 1000)
#define STARTUP_TIMEOUT_LENGTH (STARTUP_TIMEOUT_LENGTH_SECONDS * 1000) /* ms */
typedef struct
{
GdkDisplay *display;
char *startup_id;
GTimeVal time;
gint64 time;
} StartupNotificationData;
static void
@ -175,14 +175,14 @@ startup_timeout (void *data)
{
StartupTimeoutData *std;
GSList *tmp;
GTimeVal now;
gint64 now;
int min_timeout;
std = data;
min_timeout = STARTUP_TIMEOUT_LENGTH;
g_get_current_time (&now);
now = g_get_monotonic_time ();
tmp = std->contexts;
while (tmp != NULL)
@ -194,9 +194,7 @@ startup_timeout (void *data)
sn_data = tmp->data;
next = tmp->next;
elapsed =
((((double) now.tv_sec - sn_data->time.tv_sec) * G_USEC_PER_SEC +
(now.tv_usec - sn_data->time.tv_usec))) / 1000.0;
elapsed = (now - sn_data->time) / 1000.0;
if (elapsed >= STARTUP_TIMEOUT_LENGTH)
{
@ -246,7 +244,7 @@ add_startup_timeout (GdkX11Screen *screen,
sn_data = g_new (StartupNotificationData, 1);
sn_data->display = g_object_ref (GDK_SCREEN_DISPLAY (screen));
sn_data->startup_id = g_strdup (startup_id);
g_get_current_time (&sn_data->time);
sn_data->time = g_get_monotonic_time ();
data->contexts = g_slist_prepend (data->contexts, sn_data);

View File

@ -1131,7 +1131,7 @@ fetch_net_wm_check_window (GdkX11Screen *x11_screen)
{
GdkDisplay *display;
Window window;
GTimeVal tv;
guint64 now;
int error;
display = x11_screen->display;
@ -1141,9 +1141,9 @@ fetch_net_wm_check_window (GdkX11Screen *x11_screen)
if (x11_screen->wmspec_check_window != None)
return; /* already have it */
g_get_current_time (&tv);
now = g_get_monotonic_time ();
if (ABS (tv.tv_sec - x11_screen->last_wmspec_check_time) < 15)
if ((now - x11_screen->last_wmspec_check_time) / 1e6 < 15)
return; /* we've checked recently */
window = get_net_supporting_wm_check (x11_screen, x11_screen->xroot_window);
@ -1170,7 +1170,7 @@ fetch_net_wm_check_window (GdkX11Screen *x11_screen)
return;
x11_screen->wmspec_check_window = window;
x11_screen->last_wmspec_check_time = tv.tv_sec;
x11_screen->last_wmspec_check_time = now;
x11_screen->need_refetch_net_supported = TRUE;
x11_screen->need_refetch_wm_name = TRUE;

View File

@ -50,7 +50,7 @@ struct _GdkX11Screen
int xft_dpi;
/* Window manager */
long last_wmspec_check_time;
gint64 last_wmspec_check_time;
Window wmspec_check_window;
char *window_manager_name;