changeset 96817:6b7bbb1d9eb1

fix bug with quickdraw smoothing; also, in Makefile, clean out ns_appdir in 'clean' target
author Adrian Robert <Adrian.B.Robert@gmail.com>
date Sat, 19 Jul 2008 22:23:30 +0000
parents 4de78b0389b4
children 043230d6aac3
files src/Makefile.in src/nsfont.m src/nsterm.h src/nsterm.m
diffstat 4 files changed, 25 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/src/Makefile.in	Sat Jul 19 20:47:26 2008 +0000
+++ b/src/Makefile.in	Sat Jul 19 22:23:30 2008 +0000
@@ -1355,9 +1355,12 @@
 	rm -f buildobj.lst
 clean: mostlyclean
 	rm -f emacs-*.*.*${EXEEXT} emacs${EXEEXT}
+#ifdef HAVE_NS
+	rm -fr ${ns_appdir}
 #ifdef NS_IMPL_GNUSTEP
 	rm -f *.d
 #endif
+#endif
 /* bootstrap-clean is used to clean up just before a bootstrap.
    It should remove all files generated during a compilation/bootstrap,
    but not things like config.status or TAGS.  */
--- a/src/nsfont.m	Sat Jul 19 20:47:26 2008 +0000
+++ b/src/nsfont.m	Sat Jul 19 22:23:30 2008 +0000
@@ -1060,7 +1060,7 @@
       CGContextSetShouldAntialias (gcontext, 0);
     else
       CGContextSetShouldAntialias (gcontext, 1);
-    if (ns_use_qd_smoothing)
+    if (EQ (ns_use_qd_smoothing, Qt))
       CGContextSetFontRenderingMode (gcontext, 2); /* 0 is Cocoa, 2 is QD */
 
     CGContextSetTextMatrix (gcontext, fliptf);
--- a/src/nsterm.h	Sat Jul 19 20:47:26 2008 +0000
+++ b/src/nsterm.h	Sat Jul 19 22:23:30 2008 +0000
@@ -331,7 +331,7 @@
     IBOutlet NSButton *smoothFontsCheck;
     IBOutlet NSButton *useQuickdrawCheck;
     IBOutlet NSButton *useSysHiliteCheck;
-    BOOL prevUseHighlightColor;
+    Lisp_Object prevUseHighlightColor;
 #endif
     float prevExpandSpace;
     float prevBlinkRate;
--- a/src/nsterm.m	Sat Jul 19 20:47:26 2008 +0000
+++ b/src/nsterm.m	Sat Jul 19 22:23:30 2008 +0000
@@ -180,7 +180,7 @@
 Lisp_Object ns_expand_space;
 
 /* Control via default 'GSFontAntiAlias' on OS X and GNUstep. */
-int ns_antialias_text;
+Lisp_Object ns_antialias_text;
 
 /* On OS X picks up the default NSGlobalDomain AppleAntiAliasingThreshold,
    the maximum font size to NOT antialias.  On GNUstep there is currently
@@ -189,10 +189,10 @@
 
 /* Controls use of an undocumented CG function to do Quickdraw-style font
    smoothing (less heavy) instead of regular Quartz smoothing. */
-int ns_use_qd_smoothing;
+Lisp_Object ns_use_qd_smoothing;
 
 /* Used to pick up AppleHighlightColor on OS X */
-int ns_use_system_highlight_color;
+Lisp_Object ns_use_system_highlight_color;
 NSString *ns_selection_color;
 
 
@@ -3488,10 +3488,10 @@
   ns_cursor_blink_rate = Qnil;
   ns_cursor_blink_mode = Qnil;
   ns_expand_space = make_float (0.0);
-  ns_antialias_text = YES;
-  ns_antialias_threshold = 10.0;
-  ns_use_qd_smoothing = NO;
-  ns_use_system_highlight_color = YES;
+  ns_antialias_text = Qt;
+  ns_antialias_threshold = 10.0; /* not exposed to lisp side */
+  ns_use_qd_smoothing = Qnil;
+  ns_use_system_highlight_color = Qt;
 }
 
 
@@ -3807,9 +3807,10 @@
   ns_antialias_threshold = NILP (tmp) ? 10.0 : XFLOATINT (tmp);
   ns_default ("UseQuickdrawSmoothing", &ns_use_qd_smoothing,
              Qt, Qnil, NO, NO);
+fprintf(stderr, "qd smoothing: %d (%d, %d)\n", ns_use_qd_smoothing, EQ(ns_use_qd_smoothing, Qt), NILP(ns_use_qd_smoothing));
   ns_default ("UseSystemHighlightColor", &ns_use_system_highlight_color,
              Qt, Qnil, NO, NO);
-  if (ns_use_system_highlight_color == YES)
+  if (EQ (ns_use_system_highlight_color, Qt))
     {
       ns_selection_color = [[NSUserDefaults standardUserDefaults]
                                stringForKey: @"AppleHighlightColor"];
@@ -4018,13 +4019,13 @@
 or shrunk (negative).  Zero (the default) means standard line height.\n\
 (This variable should only be read, never set.)");
 
-  DEFVAR_BOOL ("ns-antialias-text", &ns_antialias_text,
+  DEFVAR_LISP ("ns-antialias-text", &ns_antialias_text,
                "Non-nil (the default) means to render text antialiased. Only has an effect on OS X Panther and above.");
 
-  DEFVAR_BOOL ("ns-use-qd-smoothing", &ns_use_qd_smoothing,
+  DEFVAR_LISP ("ns-use-qd-smoothing", &ns_use_qd_smoothing,
                "Whether to render text using QuickDraw (less heavy) antialiasing. Only has an effect on OS X Panther and above.  Default is nil (use Quartz smoothing).");
 
-  DEFVAR_BOOL ("ns-use-system-highlight-color",
+  DEFVAR_LISP ("ns-use-system-highlight-color",
                &ns_use_system_highlight_color,
                "Whether to use the system default (on OS X only) for the highlight color.  Nil means to use standard emacs (prior to version 21) 'grey'.");
 
@@ -6158,9 +6159,9 @@
 		     parse_solitary_modifier (ns_control_modifier));
   selectItemWithTag (functionModMenu,
 		     parse_solitary_modifier (ns_function_modifier));
-  [smoothFontsCheck setState: ns_antialias_text ? YES : NO];
-  [useQuickdrawCheck setState: ns_use_qd_smoothing ? YES : NO];
-  [useSysHiliteCheck setState: prevUseHighlightColor ? YES : NO];
+  [smoothFontsCheck setState: (NILP (ns_antialias_text) ? NO : YES)];
+  [useQuickdrawCheck setState: (NILP (ns_use_qd_smoothing) ? NO : YES)];
+  [useSysHiliteCheck setState: (NILP (prevUseHighlightColor) ? NO : YES)];
 #endif
 }
 
@@ -6230,13 +6231,13 @@
 #ifdef NS_IMPL_COCOA
   ns_control_modifier = ns_mod_to_lisp (ctrlTag);
   ns_function_modifier = ns_mod_to_lisp (fnTag);
-  ns_antialias_text = [smoothFontsCheck state];
-  ns_use_qd_smoothing = [useQuickdrawCheck state];
-  ns_use_system_highlight_color = [useSysHiliteCheck state];
-  if (ns_use_system_highlight_color != prevUseHighlightColor)
+  ns_antialias_text = [smoothFontsCheck state] ? Qt : Qnil;
+  ns_use_qd_smoothing = [useQuickdrawCheck state] ? Qt : Qnil;
+  ns_use_system_highlight_color = [useSysHiliteCheck state] ? Qt : Qnil;
+  if (! EQ (ns_use_system_highlight_color, prevUseHighlightColor))
     {
       prevUseHighlightColor = ns_use_system_highlight_color;
-      if (ns_use_system_highlight_color == YES)
+      if (EQ (ns_use_system_highlight_color, Qt))
         {
           ns_selection_color = [[NSUserDefaults standardUserDefaults]
                                  stringForKey: @"AppleHighlightColor"];