summaryrefslogtreecommitdiff
path: root/src/nsfns.m
diff options
context:
space:
mode:
authorAlp Aker <alp.tekin.aker@gmail.com>2011-07-28 14:29:09 -0400
committerChong Yidong <cyd@stupidchicken.com>2011-07-28 14:29:09 -0400
commitd8c2fa787973fc6d0d8c3693b97ddbba622ca41f (patch)
treed1316769d33023fb31f55cc71dec6e32fe3e071e /src/nsfns.m
parent4843aac304884a75581bcc27454cb9fc4353f036 (diff)
downloademacs-d8c2fa787973fc6d0d8c3693b97ddbba622ca41f.tar.gz
Fix image fg and bg colors on NS (Bug#9175).
* nsfns.m (x_set_foreground_color): Set f->foreground_pixel when setting frame foreground color. (x_set_background_color): Likewise.
Diffstat (limited to 'src/nsfns.m')
-rw-r--r--src/nsfns.m13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/nsfns.m b/src/nsfns.m
index 0452086201e..85246a4c25f 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -321,6 +321,7 @@ static void
x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
NSColor *col;
+ CGFloat r, g, b, alpha;
if (ns_lisp_to_color (arg, &col))
{
@@ -332,6 +333,10 @@ x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
[f->output_data.ns->foreground_color release];
f->output_data.ns->foreground_color = col;
+ [col getRed: &r green: &g blue: &b alpha: &alpha];
+ FRAME_FOREGROUND_PIXEL (f) =
+ ARGB_TO_ULONG ((int)(alpha*0xff), (int)(r*0xff), (int)(g*0xff), (int)(b*0xff));
+
if (FRAME_NS_VIEW (f))
{
update_face_from_frame_parameter (f, Qforeground_color, arg);
@@ -348,7 +353,7 @@ x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
struct face *face;
NSColor *col;
NSView *view = FRAME_NS_VIEW (f);
- float alpha;
+ CGFloat r, g, b, alpha;
if (ns_lisp_to_color (arg, &col))
{
@@ -364,10 +369,14 @@ x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
[col retain];
[f->output_data.ns->background_color release];
f->output_data.ns->background_color = col;
+
+ [col getRed: &r green: &g blue: &b alpha: &alpha];
+ FRAME_BACKGROUND_PIXEL (f) =
+ ARGB_TO_ULONG ((int)(alpha*0xff), (int)(r*0xff), (int)(g*0xff), (int)(b*0xff));
+
if (view != nil)
{
[[view window] setBackgroundColor: col];
- alpha = [col alphaComponent];
if (alpha != 1.0)
[[view window] setOpaque: NO];