summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2021-12-08 09:40:57 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2021-12-08 09:41:06 +0100
commit4bc25f7f9df2872189d57c21f1fa937d83b71536 (patch)
tree1e244c3edebfccf478ec8c01f65c2dcfcb4c533f
parent630517049f21d83dd6a4d63a0f6bbff55a05ac70 (diff)
Fix for issue #278 - continued : add CMake OPTION_USE_KDIALOG
Use of the kdialog command by class Fl_Naive_File_Chooser can now be turned off at build-time through CMake OPTION_USE_KDIALOG. If building via configure + make, set #define USE_KDIALOG to 0 in config.h before make.
-rw-r--r--CMake/options.cmake9
-rw-r--r--configh.cmake.in6
-rw-r--r--configh.in6
-rw-r--r--src/CMakeLists.txt6
-rw-r--r--src/Fl_Native_File_Chooser_GTK.cxx6
5 files changed, 31 insertions, 2 deletions
diff --git a/CMake/options.cmake b/CMake/options.cmake
index ccb253522..cad4b86e2 100644
--- a/CMake/options.cmake
+++ b/CMake/options.cmake
@@ -610,6 +610,15 @@ endif (OPTION_FILESYSTEM_SUPPORT)
#######################################################################
#######################################################################
+option (OPTION_USE_KDIALOG "Fl_Native_File_Chooser may run kdialog" ON)
+if (OPTION_USE_KDIALOG)
+ set (USE_KDIALOG 1)
+else ()
+ set (USE_KDIALOG 0)
+endif (OPTION_USE_KDIALOG)
+#######################################################################
+
+#######################################################################
option (OPTION_CREATE_ANDROID_STUDIO_IDE "create files needed to compile FLTK for Android" OFF)
#######################################################################
diff --git a/configh.cmake.in b/configh.cmake.in
index d208619e8..be69885d1 100644
--- a/configh.cmake.in
+++ b/configh.cmake.in
@@ -369,3 +369,9 @@
*/
#cmakedefine FL_CFG_NO_FILESYSTEM_SUPPORT 1
+
+/*
+ * Do we want class Fl_Native_File_Chooser to run kdialog when desktop is KDE?
+ */
+
+#cmakedefine01 USE_KDIALOG
diff --git a/configh.in b/configh.in
index 8d52f34c0..1428bf724 100644
--- a/configh.in
+++ b/configh.in
@@ -370,3 +370,9 @@
*/
#undef FL_CFG_NO_FILESYSTEM_SUPPORT
+
+/*
+ * Do we want class Fl_Native_File_Chooser to run kdialog when desktop is KDE?
+ */
+
+#define USE_KDIALOG 1
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 507b106ec..dceb15d0d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -213,9 +213,13 @@ if (USE_X11)
fl_dnd_x.cxx
Fl_Native_File_Chooser_FLTK.cxx
Fl_Native_File_Chooser_GTK.cxx
- Fl_Native_File_Chooser_Kdialog.cxx
Fl_get_key.cxx
)
+
+ if (OPTION_USE_KDIALOG)
+ set (DRIVER_FILES ${DRIVER_FILES} Fl_Native_File_Chooser_Kdialog.cxx)
+ endif (OPTION_USE_KDIALOG)
+
if (USE_XFT)
set (DRIVER_FILES ${DRIVER_FILES}
drivers/Xlib/Fl_Xlib_Graphics_Driver_font_xft.cxx
diff --git a/src/Fl_Native_File_Chooser_GTK.cxx b/src/Fl_Native_File_Chooser_GTK.cxx
index fd9c5194f..a161da77d 100644
--- a/src/Fl_Native_File_Chooser_GTK.cxx
+++ b/src/Fl_Native_File_Chooser_GTK.cxx
@@ -17,7 +17,9 @@
#include <config.h>
#include <FL/Fl_Native_File_Chooser.H>
-#include "Fl_Native_File_Chooser_Kdialog.H"
+#if USE_KDIALOG
+# include "Fl_Native_File_Chooser_Kdialog.H"
+#endif
#if HAVE_DLSYM && HAVE_DLFCN_H
#include <FL/platform.H>
@@ -913,6 +915,7 @@ Fl_Native_File_Chooser::Fl_Native_File_Chooser(int val) {
// otherwise, use FLTK file chooser.
platform_fnfc = NULL;
if (Fl::option(Fl::OPTION_FNFC_USES_GTK)) {
+#if USE_KDIALOG
const char *desktop = getenv("XDG_CURRENT_DESKTOP");
if (desktop && strcmp(desktop, "KDE") == 0 && val != BROWSE_MULTI_DIRECTORY) {
if (!Fl_Kdialog_Native_File_Chooser_Driver::have_looked_for_kdialog) {
@@ -929,6 +932,7 @@ Fl_Native_File_Chooser::Fl_Native_File_Chooser(int val) {
// if we found kdialog, we will use the Fl_Kdialog_Native_File_Chooser_Driver
if (Fl_Kdialog_Native_File_Chooser_Driver::did_find_kdialog) platform_fnfc = new Fl_Kdialog_Native_File_Chooser_Driver(val);
}
+#endif // USE_KDIALOG
#if HAVE_DLSYM && HAVE_DLFCN_H
if (!platform_fnfc) {
if ( Fl_GTK_Native_File_Chooser_Driver::have_looked_for_GTK_libs == 0) {