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.
This commit is contained in:
Matthias Clasen 2020-04-11 13:10:20 -04:00
parent 4eeb413047
commit 3e7e862415
3 changed files with 3 additions and 4 deletions

View File

@ -981,7 +981,7 @@ gtk_about_dialog_activate_link (GtkAboutDialog *about,
{ {
GError *error = NULL; 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; GtkWidget *dialog;

View File

@ -1502,7 +1502,7 @@ open_folder_cb (GSimpleAction *action,
gchar *uri; gchar *uri;
uri = g_file_get_uri (file); 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); g_free (uri);
} }

View File

@ -5816,13 +5816,12 @@ gtk_label_activate_link (GtkLabel *label,
{ {
GtkWidget *widget = GTK_WIDGET (label); GtkWidget *widget = GTK_WIDGET (label);
GtkWidget *toplevel = GTK_WIDGET (gtk_widget_get_root (widget)); GtkWidget *toplevel = GTK_WIDGET (gtk_widget_get_root (widget));
guint32 timestamp = gtk_get_current_event_time ();
GError *error = NULL; GError *error = NULL;
if (!GTK_IS_WINDOW (toplevel)) if (!GTK_IS_WINDOW (toplevel))
return FALSE; 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_warning ("Unable to show '%s': %s", uri, error->message);
g_error_free (error); g_error_free (error);