Author: AlbrechtS
Date: 2010-12-03 08:41:45 -0800 (Fri, 03 Dec 2010)
New Revision: 7944
Log:
Fixed reading the correct preferences for Fl::options() (STR #2463).
Fixed not to override system options with user options, if they are not
explicitly set (same STR).


Modified:
   branches/branch-1.3/src/Fl.cxx

Modified: branches/branch-1.3/src/Fl.cxx
===================================================================
--- branches/branch-1.3/src/Fl.cxx      2010-12-03 15:39:16 UTC (rev 7943)
+++ branches/branch-1.3/src/Fl.cxx      2010-12-03 16:41:45 UTC (rev 7944)
@@ -1777,15 +1777,16 @@
     int tmp;
     { // first, read the system wide preferences
       Fl_Preferences prefs(Fl_Preferences::SYSTEM, "fltk.org", "fltk");
-      Fl_Preferences opt(prefs, "options");
-      prefs.get("ArrowFocus", tmp, 0); options_[OPTION_ARROW_FOCUS] = tmp;
-      prefs.get("NativeFilechooser", tmp, 0); 
options_[OPTION_NATIVE_FILECHOOSER] = tmp;
+      Fl_Preferences opt_prefs(prefs, "options");
+      opt_prefs.get("ArrowFocus", tmp, 0); options_[OPTION_ARROW_FOCUS] = tmp;
+      opt_prefs.get("NativeFilechooser", tmp, 0); 
options_[OPTION_NATIVE_FILECHOOSER] = tmp;
     }
     { // next, check the user preferences
+      // override system options only, if the option is set ( >= 0 )
       Fl_Preferences prefs(Fl_Preferences::USER, "fltk.org", "fltk");
-      Fl_Preferences opt(prefs, "options");
-      prefs.get("ArrowFocus", tmp, 0); options_[OPTION_ARROW_FOCUS] = tmp;
-      prefs.get("NativeFilechooser", tmp, 0); 
options_[OPTION_NATIVE_FILECHOOSER] = tmp;
+      Fl_Preferences opt_prefs(prefs, "options");
+      opt_prefs.get("ArrowFocus", tmp, -1); if (tmp >= 0) 
options_[OPTION_ARROW_FOCUS] = tmp;
+      opt_prefs.get("NativeFilechooser", tmp, -1); if (tmp >= 0) 
options_[OPTION_NATIVE_FILECHOOSER] = tmp;
     }
     { // now, if the developer has registered this app, we could as for 
per-application preferences
     }

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to