[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r115664: Customize ns-use-srgb-colorspace on OSX >=
From: |
Jan D. |
Subject: |
[Emacs-diffs] trunk r115664: Customize ns-use-srgb-colorspace on OSX >= 10.7 to use sRGB. |
Date: |
Sat, 21 Dec 2013 16:12:05 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 115664
revision-id: address@hidden
parent: address@hidden
committer: Jan D. <address@hidden>
branch nick: trunk
timestamp: Sat 2013-12-21 17:11:55 +0100
message:
Customize ns-use-srgb-colorspace on OSX >= 10.7 to use sRGB.
* etc/NEWS: Mention ns-use-srgb-colorspace.
* lisp/cus-start.el (all): Add ns-use-srgb-colorspace.
* src/nsfns.m (Fxw_color_values): Use colorUsingDefaultColorSpace.
* src/nsterm.h: Declare EmacsColor category.
* src/nsterm.m (NSColor): Implement EmacsColor category.
(ns_get_color): Use colorUsingDefaultColorSpace.
(ns_get_color, ns_term_init): Use colorForEmacsRed.
modified:
etc/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1485
etc/NEWS news-20100311060928-aoit31wvzf25yr1z-1
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/cus-start.el
cusstart.el-20091113204419-o5vbwnq5f7feedwu-1100
src/nsfns.m nsfns.m-20091113204419-o5vbwnq5f7feedwu-8741
src/nsterm.h nsterm.h-20091113204419-o5vbwnq5f7feedwu-8746
src/nsterm.m nsterm.m-20091113204419-o5vbwnq5f7feedwu-8747
=== modified file 'etc/ChangeLog'
--- a/etc/ChangeLog 2013-12-21 13:43:11 +0000
+++ b/etc/ChangeLog 2013-12-21 16:11:55 +0000
@@ -1,3 +1,7 @@
+2013-12-21 Jan Djärv <address@hidden>
+
+ * NEWS: Mention ns-use-srgb-colorspace.
+
2013-12-21 Chong Yidong <address@hidden>
* themes/tango-dark-theme.el: Minor color tweak.
=== modified file 'etc/NEWS'
--- a/etc/NEWS 2013-12-21 08:34:49 +0000
+++ b/etc/NEWS 2013-12-21 16:11:55 +0000
@@ -1174,6 +1174,10 @@
Customize `ns-use-native-fullscreen' to change style. For >= 10.7
native is the default.
+** OSX >= 10.7 can use sRGB colorspace.
+Customize `ns-use-srgb-colorspace' to change style. nil is the default.
+Note: This does not apply to images.
+
* Installation Changes in Emacs 24.3
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2013-12-21 15:31:09 +0000
+++ b/lisp/ChangeLog 2013-12-21 16:11:55 +0000
@@ -1,3 +1,7 @@
+2013-12-21 Jan Djärv <address@hidden>
+
+ * cus-start.el (all): Add ns-use-srgb-colorspace.
+
2013-12-21 Chong Yidong <address@hidden>
* custom.el (custom-theme-recalc-face): Do nothing if the face is
=== modified file 'lisp/cus-start.el'
--- a/lisp/cus-start.el 2013-12-18 03:21:48 +0000
+++ b/lisp/cus-start.el 2013-12-21 16:11:55 +0000
@@ -402,6 +402,7 @@
(ns-antialias-text ns boolean "23.1")
(ns-auto-hide-menu-bar ns boolean "24.0")
(ns-use-native-fullscreen ns boolean "24.4")
+ (ns-use-srgb-colorspace ns boolean "24.4")
;; process.c
(delete-exited-processes processes-basics boolean)
;; syntax.c
=== modified file 'src/nsfns.m'
--- a/src/nsfns.m 2013-12-07 14:21:53 +0000
+++ b/src/nsfns.m 2013-12-21 16:11:55 +0000
@@ -2289,7 +2289,7 @@
if (ns_lisp_to_color (color, &col))
return Qnil;
- [[col colorUsingColorSpaceName: NSCalibratedRGBColorSpace]
+ [[col colorUsingDefaultColorSpace]
getRed: &red green: &green blue: &blue alpha: &alpha];
return list3i (lrint (red * 65280), lrint (green * 65280),
lrint (blue * 65280));
=== modified file 'src/nsterm.h'
--- a/src/nsterm.h 2013-12-19 10:25:48 +0000
+++ b/src/nsterm.h 2013-12-21 16:11:55 +0000
@@ -78,6 +78,18 @@
/* ==========================================================================
+ NSColor, EmacsColor category.
+
+ ==========================================================================
*/
address@hidden NSColor (EmacsColor)
++ (NSColor *)colorForEmacsRed:(CGFloat)red green:(CGFloat)green
+ blue:(CGFloat)blue alpha:(CGFloat)alpha;
+- (NSColor *)colorUsingDefaultColorSpace;
+
address@hidden
+
+/* ==========================================================================
+
The Emacs application
==========================================================================
*/
=== modified file 'src/nsterm.m'
--- a/src/nsterm.m 2013-12-20 10:48:36 +0000
+++ b/src/nsterm.m 2013-12-21 16:11:55 +0000
@@ -105,6 +105,43 @@
/* ==========================================================================
+ NSColor, EmacsColor category.
+
+ ==========================================================================
*/
address@hidden NSColor (EmacsColor)
++ (NSColor *)colorForEmacsRed:(CGFloat)red green:(CGFloat)green
+ blue:(CGFloat)blue alpha:(CGFloat)alpha
+{
+#ifdef NS_IMPL_COCOA
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+ if (ns_use_srgb_colorspace)
+ return [NSColor colorWithSRGBRed: red
+ green: green
+ blue: blue
+ alpha: alpha];
+#endif
+#endif
+ return [NSColor colorWithCalibratedRed: red
+ green: green
+ blue: blue
+ alpha: alpha];
+}
+
+- (NSColor *)colorUsingDefaultColorSpace
+{
+#ifdef NS_IMPL_COCOA
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+ if (ns_use_srgb_colorspace)
+ return [self colorUsingColorSpace: [NSColorSpace sRGBColorSpace]];
+#endif
+#endif
+ return [self colorUsingColorSpaceName: NSCalibratedRGBColorSpace];
+}
+
address@hidden
+
+/* ==========================================================================
+
Local declarations
==========================================================================
*/
@@ -1509,7 +1546,7 @@
#endif
if ((new = [NSColor selectedTextBackgroundColor]) != nil)
{
- *col = [new colorUsingColorSpaceName: NSCalibratedRGBColorSpace];
+ *col = [new colorUsingDefaultColorSpace];
unblock_input ();
return 0;
}
@@ -1525,7 +1562,7 @@
*/
if ((new = [NSColor selectedTextColor]) != nil)
{
- *col = [new colorUsingColorSpaceName: NSCalibratedRGBColorSpace];
+ *col = [new colorUsingDefaultColorSpace];
unblock_input ();
return 0;
}
@@ -1572,7 +1609,7 @@
if (r >= 0.0F)
{
- *col = [NSColor colorWithCalibratedRed: r green: g blue: b alpha: 1.0];
+ *col = [NSColor colorForEmacsRed: r green: g blue: b alpha: 1.0];
unblock_input ();
return 0;
}
@@ -1604,7 +1641,7 @@
}
if (new)
- *col = [new colorUsingColorSpaceName: NSCalibratedRGBColorSpace];
+ *col = [new colorUsingDefaultColorSpace];
unblock_input ();
return new ? 0 : 1;
}
@@ -1645,9 +1682,9 @@
return build_string ((char *)str);
}
- [[col colorUsingColorSpaceName: NSCalibratedRGBColorSpace]
+ [[col colorUsingDefaultColorSpace]
getRed: &red green: &green blue: &blue alpha: &alpha];
- if (red ==green && red ==blue)
+ if (red == green && red == blue)
{
[[col colorUsingColorSpaceName: NSCalibratedWhiteColorSpace]
getWhite: &gray alpha: &alpha];
@@ -4273,10 +4310,10 @@
name = SSDATA (XCAR (color));
c = XINT (XCDR (color));
[cl setColor:
- [NSColor colorWithCalibratedRed: RED_FROM_ULONG (c) / 255.0
- green: GREEN_FROM_ULONG (c) / 255.0
- blue: BLUE_FROM_ULONG (c) / 255.0
- alpha: 1.0]
+ [NSColor colorForEmacsRed: RED_FROM_ULONG (c) / 255.0
+ green: GREEN_FROM_ULONG (c) / 255.0
+ blue: BLUE_FROM_ULONG (c) / 255.0
+ alpha: 1.0]
forKey: [NSString stringWithUTF8String: name]];
}
[cl writeToFile: nil];
@@ -7607,6 +7644,12 @@
#endif
ns_last_use_native_fullscreen = ns_use_native_fullscreen;
+ DEFVAR_BOOL ("ns-use-srgb-colorspace", ns_use_srgb_colorspace,
+ doc: /*Non-nil means to use sRGB colorspace on OSX >= 10.7.
+Note that this does not apply to images.
+This variable is ignored on OSX < 10.7 and GNUStep. Default is nil. */);
+ ns_use_srgb_colorspace = NO;
+
/* TODO: move to common code */
DEFVAR_LISP ("x-toolkit-scroll-bars", Vx_toolkit_scroll_bars,
doc: /* Which toolkit scroll bars Emacs uses, if any.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r115664: Customize ns-use-srgb-colorspace on OSX >= 10.7 to use sRGB.,
Jan D. <=