From 776c350eb654c78a21a6163dcc82d802039c76e6 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Thu, 17 Dec 2020 21:07:12 -0500 Subject: make LaunchBrowser better --- util.hpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'util.hpp') diff --git a/util.hpp b/util.hpp index 11355a0..2d455c4 100644 --- a/util.hpp +++ b/util.hpp @@ -54,17 +54,10 @@ private: #include #endif -inline void LaunchBrowser(std::string url) { -#if defined(_WIN32) - // wtf i love the win32 api now ??? - ShellExecuteA(NULL, "open", url.c_str(), NULL, NULL, SW_SHOWNORMAL); -#elif defined(__APPLE__) - std::system(("open " + url).c_str()); -#elif defined(__linux__) - std::system(("xdg-open " + url).c_str()); -#else - printf("can't open url on this platform\n"); -#endif +inline void LaunchBrowser(Glib::ustring url) { + GError *err = nullptr; + if (!gtk_show_uri_on_window(nullptr, url.c_str(), GDK_CURRENT_TIME, &err)) + printf("failed to open uri: %s\n", err->message); } inline void GetImageDimensions(int inw, int inh, int &outw, int &outh, int clampw = 400, int clamph = 300) { -- cgit v1.2.3