From 3e7e862415ac6f802ef42ad882c413a5c4bcba56 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 11 Apr 2020 13:10:20 -0400 Subject: [PATCH] gtk: Just use current time for showing urls We don't really have an event anywhere close in most cases, and we already pass GDK_CURRENT_TIME in half the cases anyway. If we want to be serious about this, we need to pass the event itself, since future focus-stealing protocols may not rely on just a timestamp. --- gtk/gtkaboutdialog.c | 2 +- gtk/gtkfilechooserwidget.c | 2 +- gtk/gtklabel.c | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/gtk/gtkaboutdialog.c b/gtk/gtkaboutdialog.c index c3ce0403cb..577eb6e633 100644 --- a/gtk/gtkaboutdialog.c +++ b/gtk/gtkaboutdialog.c @@ -981,7 +981,7 @@ gtk_about_dialog_activate_link (GtkAboutDialog *about, { GError *error = NULL; - if (!gtk_show_uri_on_window (GTK_WINDOW (about), uri, gtk_get_current_event_time (), &error)) + if (!gtk_show_uri_on_window (GTK_WINDOW (about), uri, GDK_CURRENT_TIME, &error)) { GtkWidget *dialog; diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c index f02939df3e..c7f6b34c31 100644 --- a/gtk/gtkfilechooserwidget.c +++ b/gtk/gtkfilechooserwidget.c @@ -1502,7 +1502,7 @@ open_folder_cb (GSimpleAction *action, gchar *uri; uri = g_file_get_uri (file); - gtk_show_uri_on_window (GTK_WINDOW (toplevel), uri, gtk_get_current_event_time (), NULL); + gtk_show_uri_on_window (GTK_WINDOW (toplevel), uri, GDK_CURRENT_TIME, NULL); g_free (uri); } diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index f930b2de73..6f6efaec64 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -5816,13 +5816,12 @@ gtk_label_activate_link (GtkLabel *label, { GtkWidget *widget = GTK_WIDGET (label); GtkWidget *toplevel = GTK_WIDGET (gtk_widget_get_root (widget)); - guint32 timestamp = gtk_get_current_event_time (); GError *error = NULL; if (!GTK_IS_WINDOW (toplevel)) return FALSE; - if (!gtk_show_uri_on_window (GTK_WINDOW (toplevel), uri, timestamp, &error)) + if (!gtk_show_uri_on_window (GTK_WINDOW (toplevel), uri, GDK_CURRENT_TIME, &error)) { g_warning ("Unable to show '%s': %s", uri, error->message); g_error_free (error);