Merge branch 'glib-build-fix' into 'master'

widget: Drop unnecessary includes

See merge request GNOME/gtk!2328
This commit is contained in:
Matthias Clasen 2020-07-31 18:52:50 +00:00
commit 1087ff48f0
12 changed files with 96 additions and 98 deletions

View File

@ -16,7 +16,7 @@ stages:
# Common variables
variables:
COMMON_MESON_FLAGS: "--fatal-meson-warnings --werror"
COMMON_MESON_FLAGS: "--fatal-meson-warnings -Dgtk:werror=true"
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true -Dvulkan=yes"
FEATURE_FLAGS: "-Dcloudproviders=true"
MESON_TEST_TIMEOUT_MULTIPLIER: 3

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;

View File

@ -332,7 +332,7 @@ struct _GtkIconTheme
GtkSettings *display_settings;
/* time when we last stat:ed for theme changes */
glong last_stat_time;
gint64 last_stat_time;
GArray *dir_mtimes;
gulong theme_changed_idle;
@ -1966,7 +1966,6 @@ load_themes (GtkIconTheme *self)
int base;
char *dir;
const char *file;
GTimeVal tv;
GStatBuf stat_buf;
int j;
@ -2029,8 +2028,7 @@ load_themes (GtkIconTheme *self)
self->themes_valid = TRUE;
g_get_current_time (&tv);
self->last_stat_time = tv.tv_sec;
self->last_stat_time = g_get_monotonic_time ();
GTK_DISPLAY_NOTE (self->display, ICONTHEME, {
GList *l;
@ -2051,14 +2049,13 @@ static gboolean
ensure_valid_themes (GtkIconTheme *self,
gboolean non_blocking)
{
GTimeVal tv;
gboolean was_valid = self->themes_valid;
if (self->themes_valid)
{
g_get_current_time (&tv);
gint64 now = g_get_monotonic_time ();
if (ABS (tv.tv_sec - self->last_stat_time) > 5)
if ((now - self->last_stat_time) / G_USEC_PER_SEC > 5)
{
if (non_blocking)
return FALSE;
@ -2749,7 +2746,6 @@ rescan_themes (GtkIconTheme *self)
{
int stat_res;
GStatBuf stat_buf;
GTimeVal tv;
guint i;
for (i = 0; i < self->dir_mtimes->len; i++)
@ -2771,8 +2767,7 @@ rescan_themes (GtkIconTheme *self)
return TRUE;
}
g_get_current_time (&tv);
self->last_stat_time = tv.tv_sec;
self->last_stat_time = g_get_monotonic_time ();
return FALSE;
}

View File

@ -144,6 +144,8 @@ COMPARE_FUNCS(gulong)
COMPARE_FUNCS(gint64)
COMPARE_FUNCS(guint64)
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
#define NUMERIC_SORT_KEYS(TYPE, key_type, type, default_value) \
static void \
gtk_ ## type ## _sort_keys_init_key (GtkSortKeys *keys, \
@ -210,6 +212,8 @@ NUMERIC_SORT_KEYS(ULONG, gulong, ulong, G_MAXLONG)
NUMERIC_SORT_KEYS(INT64, gint64, int64, G_MININT64)
NUMERIC_SORT_KEYS(UINT64, guint64, uint64, G_MAXUINT64)
G_GNUC_END_IGNORE_DEPRECATIONS
static GtkSortKeys *
gtk_numeric_sort_keys_new (GtkNumericSorter *self)
{
@ -329,6 +333,8 @@ gtk_numeric_sort_keys_new (GtkNumericSorter *self)
return (GtkSortKeys *) result;
}
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static GtkOrdering
gtk_numeric_sorter_compare (GtkSorter *sorter,
gpointer item1,
@ -450,6 +456,8 @@ out:
return result;
}
G_GNUC_END_IGNORE_DEPRECATIONS
static GtkSorterOrder
gtk_numeric_sorter_get_order (GtkSorter *sorter)
{

View File

@ -278,6 +278,7 @@ server_list_add_server (GtkPlacesView *view,
GError *error;
char *title;
char *uri;
GDateTime *now;
error = NULL;
bookmarks = server_list_load (view);
@ -295,7 +296,9 @@ server_list_add_server (GtkPlacesView *view,
title = g_file_info_get_attribute_as_string (info, G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME);
g_bookmark_file_set_title (bookmarks, uri, title);
g_bookmark_file_set_visited (bookmarks, uri, -1);
now = g_date_time_new_now_utc ();
g_bookmark_file_set_visited_date_time (bookmarks, uri, now);
g_date_time_unref (now);
g_bookmark_file_add_application (bookmarks, uri, NULL, NULL);
server_list_save (bookmarks);

View File

@ -125,7 +125,7 @@ typedef struct
guint count;
time_t stamp;
GDateTime *stamp;
} RecentAppInfo;
/**
@ -144,9 +144,9 @@ struct _GtkRecentInfo
char *display_name;
char *description;
time_t added;
time_t modified;
time_t visited;
GDateTime *added;
GDateTime *modified;
GDateTime *visited;
char *mime_type;
@ -1096,9 +1096,9 @@ build_recent_info (GBookmarkFile *bookmarks,
info->is_private = g_bookmark_file_get_is_private (bookmarks, info->uri, NULL);
info->added = g_bookmark_file_get_added (bookmarks, info->uri, NULL);
info->modified = g_bookmark_file_get_modified (bookmarks, info->uri, NULL);
info->visited = g_bookmark_file_get_visited (bookmarks, info->uri, NULL);
info->added = g_bookmark_file_get_added_date_time (bookmarks, info->uri, NULL);
info->modified = g_bookmark_file_get_modified_date_time (bookmarks, info->uri, NULL);
info->visited = g_bookmark_file_get_visited_date_time (bookmarks, info->uri, NULL);
groups = g_bookmark_file_get_groups (bookmarks, info->uri, &groups_len, NULL);
info->groups = g_malloc (sizeof (char *) * groups_len);
@ -1116,17 +1116,17 @@ build_recent_info (GBookmarkFile *bookmarks,
{
char *app_name, *app_exec;
guint count;
time_t stamp;
GDateTime *stamp;
RecentAppInfo *app_info;
gboolean res;
app_name = apps[i];
res = g_bookmark_file_get_app_info (bookmarks, info->uri, app_name,
&app_exec,
&count,
&stamp,
NULL);
res = g_bookmark_file_get_application_info (bookmarks, info->uri, app_name,
&app_exec,
&count,
&stamp,
NULL);
if (!res)
continue;
@ -1134,7 +1134,7 @@ build_recent_info (GBookmarkFile *bookmarks,
app_info->name= g_strdup (app_name);
app_info->exec = app_exec;
app_info->count = count;
app_info->stamp = stamp;
app_info->stamp = g_date_time_ref (stamp);
g_hash_table_replace (info->apps_lookup, app_info->name, app_info);
@ -1417,23 +1417,24 @@ gtk_recent_manager_clamp_to_age (GtkRecentManager *manager,
GtkRecentManagerPrivate *priv = manager->priv;
char **uris;
gsize n_uris, i;
time_t now;
GDateTime *now;
if (G_UNLIKELY (!priv->recent_items))
return;
now = time (NULL);
now = g_date_time_new_now_utc ();
uris = g_bookmark_file_get_uris (priv->recent_items, &n_uris);
for (i = 0; i < n_uris; i++)
{
const char *uri = uris[i];
time_t modified;
GDateTime *modified;
int item_age;
modified = g_bookmark_file_get_modified (priv->recent_items, uri, NULL);
item_age = (int) ((now - modified) / (60 * 60 * 24));
modified = g_bookmark_file_get_modified_date_time (priv->recent_items, uri, NULL);
item_age = (int) (g_date_time_difference (now, modified) / (double)G_TIME_SPAN_DAY);
if (item_age > age)
g_bookmark_file_remove_item (priv->recent_items, uri, NULL);
}
@ -1516,6 +1517,7 @@ gtk_recent_info_free (GtkRecentInfo *recent_info)
g_free (app_info->name);
g_free (app_info->exec);
g_date_time_unref (app_info->stamp);
}
g_free (recent_info->applications);
@ -1648,16 +1650,16 @@ gtk_recent_info_get_mime_type (GtkRecentInfo *info)
* gtk_recent_info_get_added:
* @info: a #GtkRecentInfo
*
* Gets the timestamp (seconds from systems Epoch) when the resource
* Gets the the time when the resource
* was added to the recently used resources list.
*
* Returns: the number of seconds elapsed from systems Epoch when
* the resource was added to the list, or -1 on failure.
* Returns: (transfer none): a #GDateTime for the time
* when the resource was added
*/
time_t
GDateTime *
gtk_recent_info_get_added (GtkRecentInfo *info)
{
g_return_val_if_fail (info != NULL, (time_t) -1);
g_return_val_if_fail (info != NULL, NULL);
return info->added;
}
@ -1666,16 +1668,16 @@ gtk_recent_info_get_added (GtkRecentInfo *info)
* gtk_recent_info_get_modified:
* @info: a #GtkRecentInfo
*
* Gets the timestamp (seconds from systems Epoch) when the meta-data
* Gets the time when the meta-data
* for the resource was last modified.
*
* Returns: the number of seconds elapsed from systems Epoch when
* the resource was last modified, or -1 on failure.
* Returns: (transfer none): a #GDateTime for the time
* when the resource was last modified
*/
time_t
GDateTime *
gtk_recent_info_get_modified (GtkRecentInfo *info)
{
g_return_val_if_fail (info != NULL, (time_t) -1);
g_return_val_if_fail (info != NULL, NULL);
return info->modified;
}
@ -1684,16 +1686,16 @@ gtk_recent_info_get_modified (GtkRecentInfo *info)
* gtk_recent_info_get_visited:
* @info: a #GtkRecentInfo
*
* Gets the timestamp (seconds from systems Epoch) when the meta-data
* Gets the time when the meta-data
* for the resource was last visited.
*
* Returns: the number of seconds elapsed from systems Epoch when
* the resource was last visited, or -1 on failure.
* Returns: (transfer none): a #GDateTime for the time
* when the resource was last visited
*/
time_t
GDateTime *
gtk_recent_info_get_visited (GtkRecentInfo *info)
{
g_return_val_if_fail (info != NULL, (time_t) -1);
g_return_val_if_fail (info != NULL, NULL);
return info->visited;
}
@ -1723,8 +1725,8 @@ gtk_recent_info_get_private_hint (GtkRecentInfo *info)
* @app_exec: (transfer none) (out): return location for the string containing
* the command line
* @count: (out): return location for the number of times this item was registered
* @time_: (out): return location for the timestamp this item was last registered
* for this application
* @stamp: (out) (transfer none): return location for the time this item was last
* registered for this application
*
* Gets the data regarding the application that has registered the resource
* pointed by @info.
@ -1742,7 +1744,7 @@ gtk_recent_info_get_application_info (GtkRecentInfo *info,
const char *app_name,
const char **app_exec,
guint *count,
time_t *time_)
GDateTime **stamp)
{
RecentAppInfo *ai;
@ -1766,8 +1768,8 @@ gtk_recent_info_get_application_info (GtkRecentInfo *info,
if (count)
*count = ai->count;
if (time_)
*time_ = ai->stamp;
if (stamp)
*stamp = ai->stamp;
return TRUE;
}
@ -1851,7 +1853,7 @@ char *
gtk_recent_info_last_application (GtkRecentInfo *info)
{
int i;
time_t last_stamp = (time_t) -1;
GDateTime *last_stamp = NULL;
char *name = NULL;
g_return_val_if_fail (info != NULL, NULL);
@ -1860,7 +1862,8 @@ gtk_recent_info_last_application (GtkRecentInfo *info)
{
const RecentAppInfo *ai = &info->applications[i];
if (ai->stamp > last_stamp)
if (last_stamp == NULL ||
g_date_time_compare (ai->stamp, last_stamp) > 0)
{
name = ai->name;
last_stamp = ai->stamp;
@ -2179,18 +2182,13 @@ gtk_recent_info_get_uri_display (GtkRecentInfo *info)
int
gtk_recent_info_get_age (GtkRecentInfo *info)
{
time_t now, delta;
int retval;
GDateTime *now;
g_return_val_if_fail (info != NULL, -1);
now = time (NULL);
now = g_date_time_new_now_utc ();
delta = now - info->modified;
retval = (int) (delta / (60 * 60 * 24));
return retval;
return (int) (g_date_time_difference (now, info->modified) / (double)G_TIME_SPAN_DAY);
}
/**

View File

@ -207,19 +207,19 @@ const char * gtk_recent_info_get_description (GtkRecentInfo *info)
GDK_AVAILABLE_IN_ALL
const char * gtk_recent_info_get_mime_type (GtkRecentInfo *info);
GDK_AVAILABLE_IN_ALL
time_t gtk_recent_info_get_added (GtkRecentInfo *info);
GDateTime * gtk_recent_info_get_added (GtkRecentInfo *info);
GDK_AVAILABLE_IN_ALL
time_t gtk_recent_info_get_modified (GtkRecentInfo *info);
GDateTime * gtk_recent_info_get_modified (GtkRecentInfo *info);
GDK_AVAILABLE_IN_ALL
time_t gtk_recent_info_get_visited (GtkRecentInfo *info);
GDateTime * gtk_recent_info_get_visited (GtkRecentInfo *info);
GDK_AVAILABLE_IN_ALL
gboolean gtk_recent_info_get_private_hint (GtkRecentInfo *info);
gboolean gtk_recent_info_get_private_hint (GtkRecentInfo *info);
GDK_AVAILABLE_IN_ALL
gboolean gtk_recent_info_get_application_info (GtkRecentInfo *info,
const char *app_name,
const char **app_exec,
guint *count,
time_t *time_);
gboolean gtk_recent_info_get_application_info (GtkRecentInfo *info,
const char *app_name,
const char **app_exec,
guint *count,
GDateTime **stamp);
GDK_AVAILABLE_IN_ALL
GAppInfo * gtk_recent_info_create_app_info (GtkRecentInfo *info,
const char *app_name,

View File

@ -82,8 +82,6 @@
#include "gsk/gskrendererprivate.h"
#include <cairo-gobject.h>
#include <gobject/gobjectnotifyqueue.c>
#include <gobject/gvaluecollector.h>
#include <locale.h>
#include <math.h>
#include <stdarg.h>

View File

@ -11,8 +11,8 @@ project('gtk', 'c',
license: 'LGPLv2.1+')
glib_major_req = 2
glib_minor_req = 63
glib_micro_req = 1
glib_minor_req = 65
glib_micro_req = 0
if glib_minor_req.is_odd()
glib_min_required = 'GLIB_VERSION_@0@_@1@'.format(glib_major_req, glib_minor_req - 1)

View File

@ -6029,7 +6029,7 @@ bench_iteration (GtkWidget *widget, void (* fn) (GtkWidget *widget))
static void
do_real_bench (GtkWidget *widget, void (* fn) (GtkWidget *widget), const char *name, int num)
{
GTimeVal tv0, tv1;
gint64 t0, t1;
double dt_first;
double dt;
int n;
@ -6041,19 +6041,17 @@ do_real_bench (GtkWidget *widget, void (* fn) (GtkWidget *widget), const char *n
printed_headers = TRUE;
}
g_get_current_time (&tv0);
bench_iteration (widget, fn);
g_get_current_time (&tv1);
t0 = g_get_monotonic_time ();
bench_iteration (widget, fn);
t1 = g_get_monotonic_time ();
dt_first = ((double)tv1.tv_sec - tv0.tv_sec) * 1000.0
+ (tv1.tv_usec - tv0.tv_usec) / 1000.0;
dt_first = ((double)(t1 - t0)) / 1000.0;
g_get_current_time (&tv0);
t0 = g_get_monotonic_time ();
for (n = 0; n < num - 1; n++)
bench_iteration (widget, fn);
g_get_current_time (&tv1);
dt = ((double)tv1.tv_sec - tv0.tv_sec) * 1000.0
+ (tv1.tv_usec - tv0.tv_usec) / 1000.0;
bench_iteration (widget, fn);
t1 = g_get_monotonic_time ();
dt = ((double)(t1 - t0)) / 1000.0;
g_print ("%s %5d ", pad (name, 20), num);
if (num > 1)