Avoid gtk_show_uri() with GTK+3.9x

This commit is contained in:
Paul Cornett 2017-12-07 10:51:57 -08:00
parent 23caf6fe00
commit db00ab9c02
2 changed files with 17 additions and 1 deletions

View File

@ -345,6 +345,13 @@ static bool wxGetTopLevel(GtkWidget** widget, GdkWindow** window)
return false; return false;
} }
GtkWidget* wxGetTopLevelGTK()
{
GtkWidget* widget = NULL;
wxGetTopLevel(&widget, NULL);
return widget;
}
GdkWindow* wxGetTopLevelGDK() GdkWindow* wxGetTopLevelGDK()
{ {
GdkWindow* window; GdkWindow* window;

View File

@ -45,6 +45,7 @@
#endif #endif
#endif #endif
GdkWindow* wxGetTopLevelGDK(); GdkWindow* wxGetTopLevelGDK();
GtkWidget* wxGetTopLevelGTK();
#endif #endif
// Only X11 backend is supported for wxGTK here // Only X11 backend is supported for wxGTK here
@ -2679,12 +2680,20 @@ bool
wxDoLaunchDefaultBrowser(const wxLaunchBrowserParams& params) wxDoLaunchDefaultBrowser(const wxLaunchBrowserParams& params)
{ {
#ifdef __WXGTK__ #ifdef __WXGTK__
#if GTK_CHECK_VERSION(2,14,0) #if GTK_CHECK_VERSION(3,90,0)
if (gtk_show_uri_on_window((GtkWindow*)wxGetTopLevelGTK(),
params.url.utf8_str(), GDK_CURRENT_TIME, NULL))
{
return true;
}
#elif GTK_CHECK_VERSION(2,14,0)
if (wx_is_at_least_gtk2(14)) if (wx_is_at_least_gtk2(14))
{ {
GdkScreen* screen = gdk_window_get_screen(wxGetTopLevelGDK()); GdkScreen* screen = gdk_window_get_screen(wxGetTopLevelGDK());
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
if (gtk_show_uri(screen, params.url.utf8_str(), GDK_CURRENT_TIME, NULL)) if (gtk_show_uri(screen, params.url.utf8_str(), GDK_CURRENT_TIME, NULL))
return true; return true;
wxGCC_WARNING_RESTORE()
} }
#endif // GTK_CHECK_VERSION(2,14,0) #endif // GTK_CHECK_VERSION(2,14,0)
#endif // __WXGTK__ #endif // __WXGTK__