From 41f37613ec6a14fb8b3357e2dc0323116bf8439b Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Tue, 13 Dec 2022 18:37:48 +0100 Subject: =?UTF-8?q?Derive=20Fl=5FZenity=5FNative=5FFile=5FChooser=5FDriver?= =?UTF-8?q?=20from=20Fl=5FKdialog=5FNative=5F=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also add Fl::option(OPTION_FNFC_USES_ZENITY) --- FL/Fl.H | 3 +++ FL/Fl_Native_File_Chooser.H | 24 ++++++++++++++++-------- 2 files changed, 19 insertions(+), 8 deletions(-) (limited to 'FL') diff --git a/FL/Fl.H b/FL/Fl.H index 9eb4a541f..506dc34ce 100644 --- a/FL/Fl.H +++ b/FL/Fl.H @@ -272,6 +272,9 @@ public: /// value. /// When switched off, no such window gets displayed. OPTION_SHOW_SCALING, + /// Meaningful for the Wayland/X11 platform only. When switched on (default), the library uses a Zenity-based file dialog. + /// When switched off, the GTK file dialog is used instead. + OPTION_FNFC_USES_ZENITY, // don't change this, leave it always as the last element /// For internal use only. OPTION_LAST diff --git a/FL/Fl_Native_File_Chooser.H b/FL/Fl_Native_File_Chooser.H index ab9516f7c..b920a1565 100644 --- a/FL/Fl_Native_File_Chooser.H +++ b/FL/Fl_Native_File_Chooser.H @@ -102,15 +102,23 @@ class Fl_Native_File_Chooser_Driver; to open files with a non-ASCII name). Platform Specific Caveats - - - Under X windows, and if Fl::OPTION_FNFC_USES_GTK has not been switched off, - the widget attempts to use standard GTK file chooser dialogs if they are - available at run-time on the platform, and falls back to use FLTK's Fl_File_Chooser if they are not. - In the first case, calling fl_register_images() adds a "Preview" button to the GTK chooser dialog. - In the latter case, it's best if you call Fl_File_Icon::load_system_icons() + + - Under X11/Wayland, what dialog opens is determined as follows: + -# If command \p zenity is available at run-time and if \p Fl::option(OPTION_FNFC_USES_ZENITY) is + not turned off, the \p zenity -based dialog opens. This is expected to be more appropriate + than other dialog forms for sandboxed apps. + -# Else if the app runs under the KDE desktop and if command \p kdialog is available at run-time + and if the library was not built with cmake -DOPTION_USE_KDIALOG=Off, the + \p kdialog -based dialog opens. + -# Else if the GTK library is available at run-time on the computer and if \p Fl::option(OPTION_FNFC_USES_GTK) is + not turned off, the GTK-styled dialog opens. Call fl_register_images() to add a "Preview" button to this dialog. + Use the static public attributes of class Fl_File_Chooser to localize the browser. + -# Otherwise, FLTK's own dialog produced by the Fl_File_Chooser class opens. + Call fl_register_images() to add a "Preview" button to it. + It's best if you also call Fl_File_Icon::load_system_icons() at the start of main(), to enable the nicer looking file browser widgets. - Use the static public attributes of class Fl_File_Chooser to localize - the browser. + Use the static public attributes of class Fl_File_Chooser to localize the browser. + - Some operating systems support certain OS specific options; see Fl_Native_File_Chooser::options() for a list. -- cgit v1.2.3