summaryrefslogtreecommitdiff
path: root/src/Fl_Native_File_Chooser_GTK.cxx
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2024-04-22 16:34:08 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2024-04-22 16:34:08 +0200
commitabfc8ee52f5e7b7e9022dd0bb6fd370a0e9c32af (patch)
tree95d6a53874a68c0cc13bda5128561d40314b78a9 /src/Fl_Native_File_Chooser_GTK.cxx
parentee37965fad79a815feea3f8a4a6cfec03d4a9029 (diff)
Fix: Fl_Native_File_Chooser::filter_value() [Kdialog] always returns 0 (#899)
- remove build option FLTK_USE_KDIALOG replaced by an Fl::option() option - new run-time option OPTION_FNFC_USES_KDIALOG - make options OPTION_FNFC_USES_KDIALOG and OPTION_FNFC_USES_ZENITY false by default - add mention of new program fltk-options in the doc of Fl::option() - change logic of choice of the native file chooser under X11/Wayland: the zenity and kdialog choosers are opt-in; otherwise the GTK file chooser is used, unless opted out with OPTION_FNFC_USES_GTK - document that zenity may be interesting for sandboxed apps - document that both zenity and kdialog make member functions Fl_Native_File_Chooser::filter_value() inoperable
Diffstat (limited to 'src/Fl_Native_File_Chooser_GTK.cxx')
-rw-r--r--src/Fl_Native_File_Chooser_GTK.cxx18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/Fl_Native_File_Chooser_GTK.cxx b/src/Fl_Native_File_Chooser_GTK.cxx
index 28363aeda..263acfad7 100644
--- a/src/Fl_Native_File_Chooser_GTK.cxx
+++ b/src/Fl_Native_File_Chooser_GTK.cxx
@@ -17,10 +17,8 @@
#include <config.h>
#include <FL/Fl_Native_File_Chooser.H>
-#if USE_KDIALOG
-# include "Fl_Native_File_Chooser_Zenity.H"
-# include "Fl_Native_File_Chooser_Kdialog.H"
-#endif
+#include "Fl_Native_File_Chooser_Zenity.H"
+#include "Fl_Native_File_Chooser_Kdialog.H"
#if HAVE_DLSYM && HAVE_DLFCN_H
#include <FL/platform.H>
@@ -931,8 +929,6 @@ Fl_Native_File_Chooser::Fl_Native_File_Chooser(int val) {
// otherwise, use FLTK file chooser.
platform_fnfc = NULL;
fl_open_display();
- if (Fl::option(Fl::OPTION_FNFC_USES_GTK)) {
-#if USE_KDIALOG
if (Fl::option(Fl::OPTION_FNFC_USES_ZENITY)&& val != BROWSE_MULTI_DIRECTORY) {
if (!Fl_Zenity_Native_File_Chooser_Driver::have_looked_for_zenity) {
// First Time here, try to find zenity
@@ -949,7 +945,8 @@ Fl_Native_File_Chooser::Fl_Native_File_Chooser(int val) {
if (Fl_Zenity_Native_File_Chooser_Driver::did_find_zenity) platform_fnfc = new Fl_Zenity_Native_File_Chooser_Driver(val);
}
const char *desktop = getenv("XDG_CURRENT_DESKTOP");
- if (!platform_fnfc && desktop && strcmp(desktop, "KDE") == 0 && val != BROWSE_MULTI_DIRECTORY) {
+ if (!platform_fnfc && Fl::option(Fl::OPTION_FNFC_USES_KDIALOG) && desktop &&
+ strcmp(desktop, "KDE") == 0 && val != BROWSE_MULTI_DIRECTORY) {
if (!Fl_Kdialog_Native_File_Chooser_Driver::have_looked_for_kdialog) {
// First Time here, try to find kdialog
FILE *pipe = popen("kdialog -v 2> /dev/null", "r");
@@ -964,9 +961,9 @@ 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 (!platform_fnfc) {
+ if (Fl::option(Fl::OPTION_FNFC_USES_GTK)) {
if ( Fl_GTK_Native_File_Chooser_Driver::have_looked_for_GTK_libs == 0) {
// First Time here, try to find the GTK libs if they are installed
Fl_GTK_Native_File_Chooser_Driver::probe_for_GTK_libs();
@@ -975,7 +972,8 @@ Fl_Native_File_Chooser::Fl_Native_File_Chooser(int val) {
// if we found all the GTK functions we need, we will use the GtkFileChooserDialog
if (Fl_GTK_Native_File_Chooser_Driver::did_find_GTK_libs) platform_fnfc = new Fl_GTK_Native_File_Chooser_Driver(val);
}
-#endif // HAVE_DLSYM && HAVE_DLFCN_H
}
+#endif // HAVE_DLSYM && HAVE_DLFCN_H
+
if (!platform_fnfc) platform_fnfc = new Fl_Native_File_Chooser_FLTK_Driver(val);
}