From 9a1d32121566f0b122535e674b60a8060f8bdfc3 Mon Sep 17 00:00:00 2001 From: Pera Pisar <1405223@gmail.com> Date: Mon, 22 Apr 2019 01:58:57 +0200 Subject: [PATCH] Introduce library blacklist; enable GTK dialogs on all Linux distributions --- libraries.rb | 15 ++++++++++++++- src/oneshot.cpp | 21 ++++++--------------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/libraries.rb b/libraries.rb index c203955..a4d5e1f 100644 --- a/libraries.rb +++ b/libraries.rb @@ -2,11 +2,24 @@ #encoding: utf-8 require 'fileutils' +# These libraries MUST NOT be packaged with OneShot +# or otherwise they will cause cross-distro +# incompatibilities. +BLACKLIST = [ + # These packaged on Manjaro cause issues on openSUSE. + 'libc.so.6', + 'libpthread.so.0', + 'libdl.so.2', + 'libm.so.6' +] + line = gets files = [] while line if line =~ / => (\/.*) \(/ - files << $1 + if not BLACKLIST.include? $1 + files << $1 + end end line = gets end diff --git a/src/oneshot.cpp b/src/oneshot.cpp index 87a68fe..02bbc9b 100644 --- a/src/oneshot.cpp +++ b/src/oneshot.cpp @@ -282,6 +282,8 @@ Oneshot::Oneshot(RGSSThreadData &threadData) : #ifdef OS_LINUX char const* xdg_current_desktop = getenv("XDG_CURRENT_DESKTOP"); + gtk_init(0, 0); + if (xdg_current_desktop == NULL) { desktopEnv = "nope"; } else { @@ -289,19 +291,15 @@ Oneshot::Oneshot(RGSSThreadData &threadData) : std::transform(desktop.begin(), desktop.end(), desktop.begin(), ::tolower); if (desktop.find("cinnamon") != std::string::npos) { desktopEnv = "cinnamon"; - gtk_init(0, 0); } else if ( desktop.find("gnome") != std::string::npos || desktop.find("unity") != std::string::npos ) { desktopEnv = "gnome"; - gtk_init(0, 0); } else if (desktop.find("mate") != std::string::npos) { desktopEnv = "mate"; - gtk_init(0, 0); } else if (desktop.find("xfce") != std::string::npos) { desktopEnv = "xfce"; - gtk_init(0, 0); } else if (desktop.find("kde") != std::string::npos) { desktopEnv = "kde"; } else if (desktop.find("lxde") != std::string::npos) { @@ -488,17 +486,10 @@ bool Oneshot::msgbox(int type, const char *body, const char *title) if (!title) title = ""; #if defined OS_LINUX - if ( - desktopEnv == "gnome" || - desktopEnv == "mate" || - desktopEnv == "cinnamon" || - desktopEnv == "xfce" - ) { - linux_DialogData data = {type, body, title, 0}; - gdk_threads_add_idle(linux_dialog, &data); - gtk_main(); - return data.result; - } + linux_DialogData data = {type, body, title, 0}; + gdk_threads_add_idle(linux_dialog, &data); + gtk_main(); + return data.result; #endif // SDL message box