FLTK logo

[master] 5ec7176 - Fix for Fl_Native_File_Chooser::filter_value() - cont'd (#899)

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[master] 5ec7176 - Fix for Fl_Native_File_Chooser::filter_value() - cont'd (#899) "ManoloFLTK" 09:47 Apr 22  
 
commit 5ec7176e81e6951ffa8360bc41a4e953de2b2070
Author:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Mon Apr 22 18:35:34 2024 +0200
Commit:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Mon Apr 22 18:35:59 2024 +0200

     Fix for Fl_Native_File_Chooser::filter_value() - cont'd (#899)

 FL/Fl.H                            |  2 +-
 fltk-options/fltk-options.cxx      |  2 +-
 src/Fl_Native_File_Chooser_GTK.cxx | 54 ++++++++++++++++++--------------------
 3 files changed, 28 insertions(+), 30 deletions(-)

diff --git FL/Fl.H FL/Fl.H
index e1f69b5..e35ebe2 100644
--- FL/Fl.H
+++ FL/Fl.H
@@ -269,7 +269,7 @@ public:
     /// Meaningful for the Wayland/X11 platform only. When switched on, the library uses a Zenity-based file dialog.
     /// When switched off (default), no zenity-based file dialog is used.
     OPTION_FNFC_USES_ZENITY,
-    /// Meaningful for the Wayland/X11 platform only and for the KDE-Plasma desktop only.
+    /// Meaningful for the Wayland/X11 platform only.
     /// When switched on, the library uses a kdialog-based file dialog if command 'kdialog' is available on the running system.
     /// When switched off (default), no kdialog-based file dialog is used.
     OPTION_FNFC_USES_KDIALOG,
diff --git fltk-options/fltk-options.cxx fltk-options/fltk-options.cxx
index 50dbc61..5996417 100644
--- fltk-options/fltk-options.cxx
+++ fltk-options/fltk-options.cxx
@@ -144,7 +144,7 @@ Fo_Option_Descr g_option_list[] = {
   { FO_OPTION_BOOL, "Native File Chooser uses Kdialog:",
     Fl::OPTION_FNFC_USES_KDIALOG, "OPTION_FNFC_USES_KDIALOG", "UseKdialog", false,
     "Fl_Native_File_Chooser uses the 'kdialog' command if possible.",
-    "Meaningful for the Wayland/X11 platform and the KDE-Plasma desktop only. "
+    "Meaningful for the Wayland/X11 platform. "
     "When switched on, the library uses a kdialog-based file dialog if command 'kdialog' is "
     "available. When switched off (default), command 'kdialog' is not used." },
   { FO_HEADLINE, "Print dialog Options" },
diff --git src/Fl_Native_File_Chooser_GTK.cxx src/Fl_Native_File_Chooser_GTK.cxx
index 263acfa..49b99f6 100644
--- src/Fl_Native_File_Chooser_GTK.cxx
+++ src/Fl_Native_File_Chooser_GTK.cxx
@@ -929,38 +929,36 @@ 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_ZENITY)&& val != BROWSE_MULTI_DIRECTORY) {
-      if (!Fl_Zenity_Native_File_Chooser_Driver::have_looked_for_zenity) {
-        // First Time here, try to find zenity
-        FILE *pipe = popen("zenity --version 2> /dev/null", "r");
-        if (pipe) {
-          char *p, line[100] = "";
-          p = fgets(line, sizeof(line), pipe);
-          if (p && strlen(line) > 0) Fl_Zenity_Native_File_Chooser_Driver::did_find_zenity = true;
-          pclose(pipe);
-        }
-        Fl_Zenity_Native_File_Chooser_Driver::have_looked_for_zenity = true;
+  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
+      FILE *pipe = popen("zenity --version 2> /dev/null", "r");
+      if (pipe) {
+        char *p, line[100] = "";
+        p = fgets(line, sizeof(line), pipe);
+        if (p && strlen(line) > 0) Fl_Zenity_Native_File_Chooser_Driver::did_find_zenity = true;
+        pclose(pipe);
       }
-      // if we found zenity, we will use the Fl_Zenity_Native_File_Chooser_Driver
-      if (Fl_Zenity_Native_File_Chooser_Driver::did_find_zenity) platform_fnfc = new Fl_Zenity_Native_File_Chooser_Driver(val);
+      Fl_Zenity_Native_File_Chooser_Driver::have_looked_for_zenity = true;
     }
-    const char *desktop = getenv("XDG_CURRENT_DESKTOP");
-    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");
-        if (pipe) {
-          char *p, line[100] = "";
-          p = fgets(line, sizeof(line), pipe);
-          if (p && strlen(line) > 0) Fl_Kdialog_Native_File_Chooser_Driver::did_find_kdialog = true;
-          pclose(pipe);
-        }
-        Fl_Kdialog_Native_File_Chooser_Driver::have_looked_for_kdialog = true;
+    // if we found zenity, we will use the Fl_Zenity_Native_File_Chooser_Driver
+    if (Fl_Zenity_Native_File_Chooser_Driver::did_find_zenity) platform_fnfc = new Fl_Zenity_Native_File_Chooser_Driver(val);
+  }
+  if (!platform_fnfc && Fl::option(Fl::OPTION_FNFC_USES_KDIALOG) && 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");
+      if (pipe) {
+        char *p, line[100] = "";
+        p = fgets(line, sizeof(line), pipe);
+        if (p && strlen(line) > 0) Fl_Kdialog_Native_File_Chooser_Driver::did_find_kdialog = true;
+        pclose(pipe);
       }
-      // 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);
+      Fl_Kdialog_Native_File_Chooser_Driver::have_looked_for_kdialog = true;
     }
+    // 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);
+  }
 #if HAVE_DLSYM && HAVE_DLFCN_H
   if (!platform_fnfc) {
     if (Fl::option(Fl::OPTION_FNFC_USES_GTK)) {
Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.