[Xfce4-commits] [xfce/xfce4-panel] 01/01: Fix GTimeVal deprecation (Bug #16643)
noreply at xfce.org
noreply at xfce.org
Mon Apr 6 22:43:58 CEST 2020
This is an automated email from the git hooks/post-receive script.
o c h o s i p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository xfce/xfce4-panel.
commit fa8ca40cebc6ab37dd550c1e9b6e557a9f871f71
Author: Andre Miranda <andreldm at xfce.org>
Date: Mon Apr 6 22:22:33 2020 +0200
Fix GTimeVal deprecation (Bug #16643)
---
libxfce4panel/xfce-panel-plugin.c | 9 ++-------
panel/panel-base-window.c | 4 +---
panel/panel-plugin-external.c | 8 ++++----
plugins/launcher/launcher.c | 5 ++---
plugins/tasklist/tasklist-widget.c | 10 +++-------
5 files changed, 12 insertions(+), 24 deletions(-)
diff --git a/libxfce4panel/xfce-panel-plugin.c b/libxfce4panel/xfce-panel-plugin.c
index 5adc02a..d00c3d7 100644
--- a/libxfce4panel/xfce-panel-plugin.c
+++ b/libxfce4panel/xfce-panel-plugin.c
@@ -2648,7 +2648,6 @@ xfce_panel_plugin_position_widget (XfcePanelPlugin *plugin,
GdkRectangle geometry;
GdkDisplay *display;
GdkMonitor *monitor;
- GTimeVal now_t, end_t;
GtkWidget *toplevel, *plug;
gint px, py;
GtkAllocation alloc;
@@ -2692,8 +2691,7 @@ xfce_panel_plugin_position_widget (XfcePanelPlugin *plugin,
* use the coordinates */
if (plugin->priv->panel_lock > 0)
{
- g_get_current_time (&end_t);
- g_time_val_add (&end_t, G_USEC_PER_SEC / 2);
+ gint64 end_t = g_get_monotonic_time () + G_USEC_PER_SEC / 2;
while (*x == -9999 && *y == -9999)
{
@@ -2703,10 +2701,7 @@ xfce_panel_plugin_position_widget (XfcePanelPlugin *plugin,
gdk_window_get_position (gtk_widget_get_window (attach_widget), x, y);
/* don't try longer then 1/2 a second */
- g_get_current_time (&now_t);
- if (now_t.tv_sec > end_t.tv_sec
- || (now_t.tv_sec == end_t.tv_sec
- && now_t.tv_usec > end_t.tv_usec))
+ if (g_get_monotonic_time () > end_t)
break;
}
}
diff --git a/panel/panel-base-window.c b/panel/panel-base-window.c
index 35a93fd..cf03705 100644
--- a/panel/panel-base-window.c
+++ b/panel/panel-base-window.c
@@ -560,15 +560,13 @@ static gboolean
panel_base_window_active_timeout (gpointer user_data)
{
PanelBaseWindow *window = PANEL_BASE_WINDOW (user_data);
- GTimeVal timeval;
GtkStyleContext *context;
context = gtk_widget_get_style_context (GTK_WIDGET (window));
/* Animate the border à la "marching ants" by cycling betwee a dashed and
dotted border every other second */
- g_get_current_time (&timeval);
- if (timeval.tv_sec%2 == 0)
+ if ((g_get_real_time () / G_USEC_PER_SEC) % 2 == 0)
{
if (gtk_style_context_has_class (context, MARCHING_ANTS_DOTTED))
gtk_style_context_remove_class (context, MARCHING_ANTS_DOTTED);
diff --git a/panel/panel-plugin-external.c b/panel/panel-plugin-external.c
index 0b62bb8..3d8f924 100644
--- a/panel/panel-plugin-external.c
+++ b/panel/panel-plugin-external.c
@@ -526,7 +526,7 @@ panel_plugin_external_child_spawn (PanelPluginExternal *external)
gchar *program, *cmd_line;
guint i;
gint tmp_argc;
- GTimeVal timestamp;
+ gint64 timestamp;
panel_return_if_fail (PANEL_IS_PLUGIN_EXTERNAL (external));
panel_return_if_fail (gtk_widget_get_realized (GTK_WIDGET (external)));
@@ -539,7 +539,7 @@ panel_plugin_external_child_spawn (PanelPluginExternal *external)
if (panel_debug_has_domain (PANEL_DEBUG_GDB)
|| panel_debug_has_domain (PANEL_DEBUG_VALGRIND))
{
- g_get_current_time (×tamp);
+ timestamp = g_get_real_time ();
cmd_line = NULL;
program = NULL;
@@ -559,7 +559,7 @@ panel_plugin_external_child_spawn (PanelPluginExternal *external)
"-ex 'backtrace full' "
"-ex 'info registers' "
"-args",
- program, g_get_tmp_dir (), timestamp.tv_sec,
+ program, g_get_tmp_dir (), timestamp / G_USEC_PER_SEC,
panel_module_get_name (external->module),
argv[PLUGIN_ARGV_UNIQUE_ID]);
}
@@ -572,7 +572,7 @@ panel_plugin_external_child_spawn (PanelPluginExternal *external)
cmd_line = g_strdup_printf ("%s "
"--log-file='%s" G_DIR_SEPARATOR_S "%li_valgrind_%s_%s.log' "
"--leak-check=full --show-reachable=yes -v ",
- program, g_get_tmp_dir (), timestamp.tv_sec,
+ program, g_get_tmp_dir (), timestamp / G_USEC_PER_SEC,
panel_module_get_name (external->module),
argv[PLUGIN_ARGV_UNIQUE_ID]);
}
diff --git a/plugins/launcher/launcher.c b/plugins/launcher/launcher.c
index 531fc3e..06c922f 100644
--- a/plugins/launcher/launcher.c
+++ b/plugins/launcher/launcher.c
@@ -2789,15 +2789,14 @@ launcher_plugin_unique_filename (LauncherPlugin *plugin)
{
gchar *filename, *path;
static guint counter = 0;
- GTimeVal timeval;
panel_return_val_if_fail (XFCE_IS_LAUNCHER_PLUGIN (plugin), NULL);
- g_get_current_time (&timeval);
filename = g_strdup_printf (RELATIVE_CONFIG_PATH G_DIR_SEPARATOR_S "%ld%d.desktop",
xfce_panel_plugin_get_name (XFCE_PANEL_PLUGIN (plugin)),
xfce_panel_plugin_get_unique_id (XFCE_PANEL_PLUGIN (plugin)),
- timeval.tv_sec, ++counter);
+ g_get_real_time () / G_USEC_PER_SEC,
+ ++counter);
path = xfce_resource_save_location (XFCE_RESOURCE_CONFIG, filename, TRUE);
g_free (filename);
diff --git a/plugins/tasklist/tasklist-widget.c b/plugins/tasklist/tasklist-widget.c
index dfe91f1..8114f61 100644
--- a/plugins/tasklist/tasklist-widget.c
+++ b/plugins/tasklist/tasklist-widget.c
@@ -237,7 +237,7 @@ struct _XfceTasklistChild
guint unique_id;
/* last time this window was focused */
- GTimeVal last_focused;
+ gint64 last_focused;
/* list of windows in case of a group button */
GSList *windows;
@@ -987,11 +987,7 @@ xfce_tasklist_size_sort_window (gconstpointer a,
const XfceTasklistChild *child_b = b;
glong diff;
- diff = child_a->last_focused.tv_sec - child_b->last_focused.tv_sec;
- if (diff != 0)
- return CLAMP (diff, -1, 1);
-
- diff = child_a->last_focused.tv_usec - child_b->last_focused.tv_usec;
+ diff = child_a->last_focused - child_b->last_focused;
return CLAMP (diff, -1, 1);
}
@@ -1725,7 +1721,7 @@ xfce_tasklist_active_window_changed (WnckScreen *screen,
/* update timestamp for window */
if (child->window == active_window)
{
- g_get_current_time (&child->last_focused);
+ child->last_focused = g_get_real_time ();
/* the active window is in a group, so find the group button */
if (child->type == CHILD_TYPE_GROUP_MENU)
{
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list