You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wxGTK3/wxGTK3-3.0.2-gtk-show-uri.p...

49 lines
1.4 KiB

From 2dd407609b8987634180c045e9a6d131db6f947e Mon Sep 17 00:00:00 2001
From: Paul Cornett <paulcor@users.noreply.github.com>
Date: Mon, 17 Aug 2015 21:54:41 -0700
Subject: [PATCH] use gtk_show_uri() in wxLaunchDefaultBrowser() implementation
for GTK+
(cherry picked from commit 22eec388068044b9ea3c9fd1539d6686574a32df)
---
src/unix/utilsx11.cpp | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/unix/utilsx11.cpp b/src/unix/utilsx11.cpp
index 12ff73e..7d5811a 100644
--- a/src/unix/utilsx11.cpp
+++ b/src/unix/utilsx11.cpp
@@ -36,10 +36,11 @@
#endif
#ifdef __WXGTK__
-#include <gdk/gdk.h>
+#include <gtk/gtk.h>
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
#endif
+GdkWindow* wxGetTopLevelGDK();
#endif
// Only X11 backend is supported for wxGTK here
@@ -887,6 +888,19 @@ bool wxDoLaunchDefaultBrowser(const wxString& url, int flags)
{
wxUnusedVar(flags);
+#ifdef __WXGTK__
+#if GTK_CHECK_VERSION(2,14,0)
+#ifndef __WXGTK3__
+ if (gtk_check_version(2,14,0) == NULL)
+#endif
+ {
+ GdkScreen* screen = gdk_window_get_screen(wxGetTopLevelGDK());
+ if (gtk_show_uri(screen, url.utf8_str(), GDK_CURRENT_TIME, NULL))
+ return true;
+ }
+#endif // GTK_CHECK_VERSION(2,14,0)
+#endif // __WXGTK__
+
// Our best best is to use xdg-open from freedesktop.org cross-desktop
// compatibility suite xdg-utils
// (see http://portland.freedesktop.org/wiki/) -- this is installed on