From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alp Aker Newsgroups: gmane.emacs.bugs Subject: bug#9175: [PATCH] 24.0.50: Images colors on NextStep do not default correctly Date: Tue, 26 Jul 2011 14:44:17 -0400 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: dough.gmane.org 1311818185 22691 80.91.229.12 (28 Jul 2011 01:56:25 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 28 Jul 2011 01:56:25 +0000 (UTC) To: 9175@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jul 28 03:56:21 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QmFpi-0001y6-R3 for geb-bug-gnu-emacs@m.gmane.org; Thu, 28 Jul 2011 03:56:19 +0200 Original-Received: from localhost ([::1]:48215 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QmFpi-0000s1-EN for geb-bug-gnu-emacs@m.gmane.org; Wed, 27 Jul 2011 21:56:18 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:51320) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qm9VX-0003qV-3O for bug-gnu-emacs@gnu.org; Wed, 27 Jul 2011 15:11:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qm9VW-0001JM-81 for bug-gnu-emacs@gnu.org; Wed, 27 Jul 2011 15:11:03 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:39929) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qm9VW-0001JE-59 for bug-gnu-emacs@gnu.org; Wed, 27 Jul 2011 15:11:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1Qm9VW-00073F-31; Wed, 27 Jul 2011 15:11:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alp Aker Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Jul 2011 19:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 9175 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.131179382427039 (code B ref -1); Wed, 27 Jul 2011 19:11:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 27 Jul 2011 19:10:24 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qm9Ut-000722-5x for submit@debbugs.gnu.org; Wed, 27 Jul 2011 15:10:23 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QlmcF-0004d5-1J for submit@debbugs.gnu.org; Tue, 26 Jul 2011 14:44:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qlmc8-00064i-Vj for submit@debbugs.gnu.org; Tue, 26 Jul 2011 14:44:21 -0400 Original-Received: from lists.gnu.org ([140.186.70.17]:35138) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qlmc8-00064e-OG for submit@debbugs.gnu.org; Tue, 26 Jul 2011 14:44:20 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:44014) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qlmc7-0006Bo-Pw for bug-gnu-emacs@gnu.org; Tue, 26 Jul 2011 14:44:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qlmc6-00064U-Ou for bug-gnu-emacs@gnu.org; Tue, 26 Jul 2011 14:44:19 -0400 Original-Received: from mail-qy0-f169.google.com ([209.85.216.169]:35802) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qlmc6-00064N-Mh for bug-gnu-emacs@gnu.org; Tue, 26 Jul 2011 14:44:18 -0400 Original-Received: by qyk32 with SMTP id 32so2038707qyk.0 for ; Tue, 26 Jul 2011 11:44:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=K2a08GdvN3CHtf9dSVUL6NOKoSKa8WXLJhCgWnM03Tw=; b=K5RF6XlMrt9JnepwE+8dfYJLRN+LBP5HJ5dEpxUDU30FC478heFxlj0LyiO2KNAvLN F5we1Uw6ujgUe3W6Om5PNhetZTyMJILLOR++OOkuxS+TGNieNBWHN5oBeSD96KOQ2rtb c8jq+s6EEEWX2Xr5Po7VyS1mLC0I05zyJ/d8k= Original-Received: by 10.229.2.160 with SMTP id 32mr4472773qcj.280.1311705857353; Tue, 26 Jul 2011 11:44:17 -0700 (PDT) Original-Received: by 10.229.250.132 with HTTP; Tue, 26 Jul 2011 11:44:17 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Mailman-Approved-At: Wed, 27 Jul 2011 15:10:22 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Wed, 27 Jul 2011 15:11:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 140.186.70.43 X-Mailman-Approved-At: Wed, 27 Jul 2011 21:56:16 -0400 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:49638 Archived-At: Image types that support :foreground and :background keywords in their image descriptors are supposed to default to the frame foreground and background colors when the relevant colors aren't specified. On NS, however, these default to black. An easy test case is provided by visiting a mono PBM image file (such as etc/images/splash.pbm) in image-mode; what one will see is simply a black square. Diagnostic: The image loading functions in image.c take the default colors from the frame's foreground_pixel and background_pixel fields, but on NS the relevant frame parameter handlers don't set those fields. The following patch corrects that. 2011-07-25 Alp Aker * nsfns.m (x_set_foreground_color): Set f->foreground_pixel when setting frame foreground color. (x_set_background_color): Likewise. === modified file 'src/nsfns.m' --- src/nsfns.m 2011-07-08 15:39:40 +0000 +++ src/nsfns.m 2011-07-25 17:22:05 +0000 @@ -321,6 +321,7 @@ 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 @@ [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 @@ 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 @@ [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];