From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Third Newsgroups: gmane.emacs.bugs Subject: bug#29823: NS port tooltip colours Date: Sat, 23 Dec 2017 11:21:29 +0000 Message-ID: <20171223112129.GA41292@breton.holly.idiocy.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="17pEHd4RhPHOinZp" Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1514028018 16765 195.159.176.226 (23 Dec 2017 11:20:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 23 Dec 2017 11:20:18 +0000 (UTC) User-Agent: Mutt/1.9.1 (2017-09-22) To: 29823@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Dec 23 12:20:14 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eShqd-0003rF-J2 for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Dec 2017 12:20:11 +0100 Original-Received: from localhost ([::1]:41516 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eShsc-0008OM-23 for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Dec 2017 06:22:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39891) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eShsR-0008OH-HU for bug-gnu-emacs@gnu.org; Sat, 23 Dec 2017 06:22:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eShsQ-0004x8-Hg for bug-gnu-emacs@gnu.org; Sat, 23 Dec 2017 06:22:03 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:40060) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eShsQ-0004x0-Cf for bug-gnu-emacs@gnu.org; Sat, 23 Dec 2017 06:22:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eShsQ-0003yr-77 for bug-gnu-emacs@gnu.org; Sat, 23 Dec 2017 06:22:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Dec 2017 11:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 29823 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.151402810315275 (code B ref -1); Sat, 23 Dec 2017 11:22:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 23 Dec 2017 11:21:43 +0000 Original-Received: from localhost ([127.0.0.1]:48741 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eShs7-0003yJ-95 for submit@debbugs.gnu.org; Sat, 23 Dec 2017 06:21:43 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:48854) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eShs5-0003y6-IA for submit@debbugs.gnu.org; Sat, 23 Dec 2017 06:21:42 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eShrz-0004fm-7b for submit@debbugs.gnu.org; Sat, 23 Dec 2017 06:21:36 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:45284) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eShrz-0004fc-2y for submit@debbugs.gnu.org; Sat, 23 Dec 2017 06:21:35 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39821) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eShrx-0008M8-PG for bug-gnu-emacs@gnu.org; Sat, 23 Dec 2017 06:21:34 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eShrw-0004dG-NW for bug-gnu-emacs@gnu.org; Sat, 23 Dec 2017 06:21:33 -0500 Original-Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]:42566) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eShrw-0004cq-Ei for bug-gnu-emacs@gnu.org; Sat, 23 Dec 2017 06:21:32 -0500 Original-Received: by mail-wm0-x233.google.com with SMTP id b199so25920471wme.1 for ; Sat, 23 Dec 2017 03:21:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=sender:date:from:to:subject:message-id:mime-version :content-disposition:content-transfer-encoding:user-agent; bh=gCVisvE2DaRIiO0729dwXcjivm0uG8NfdMlLz9ooOhs=; b=lln3Tg8NI21cwau0oRWUxP3zE8ICCIeGXV3R0YZ+kLu/iSPycSWNmkZ5q+rzxK0gcz S0KLgrDT7+VDLEjXhxgcf5CqCnHpkGEvfE6B7fH/57hARKgGJTNIfIzBrYfeV9PlCcLk Ht7Qj4m7bLhrFwGEABBLtCGHwgAZGKXHcW1hl+KSI4RH6l4kYrO5sOCXzRnmPMgtm0RP 1qYNRZV3Op8sjcmWCzVSvbf/I2jP+GS8VC71rqo1Lh+DV/XrmLXKPwlyQZY7mJTjv6kn aaEFyMJixlIl3Z+0kv0q4KYedkycy+isAfz/FRwhNGDWhs2tsJj07rchYmtpN9JN8IZE pQhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:subject:message-id :mime-version:content-disposition:content-transfer-encoding :user-agent; bh=gCVisvE2DaRIiO0729dwXcjivm0uG8NfdMlLz9ooOhs=; b=sEXvmZLYJfEvDdRV16SE6LscPcl3Qz0USm2113hTLS1+XwVsCBE/fru1RRafF0Hu0h NDA1AtOVUfJKxCjut0Bl2HE6r7dBbyjBR9dLw8MRAEsRsThvIQZISx0HcLFxzAFV7sc0 w3PgGxrIVvUxSxKeUbdmb5vi66MDrlMd62eBjPtTz9qz/PM1EiwNfqTR3KrwbDhgyEp9 RbPp+SVr0CwIo6FjnsNbV2yaWKF7o0Qv7ZVn87Imqx3xU3NDYqmrNBJ2vsMB6w1gVdzk X6jFkbRuIJx1FKOiYQek8RtyAJHMAlGRR4z8vjTUHbNQ932/fs7j60uHuiKDiU4kUxqf Jwjg== X-Gm-Message-State: AKGB3mISxVMOWGLrgx0+vmT7ujlSq9Z7Vazt+D4Wl1rF+pxpxNKHolsV V94KWt9H6XWQWPDrT2UDbfAqZOhU X-Google-Smtp-Source: ACJfBosFvnXCX/+v82V+7BEtDce6ySkZ6WO/RwoV2mx2F+eKLAPkDj4paj/4gb1iChETfHjVxvKP7A== X-Received: by 10.28.52.207 with SMTP id b198mr16202027wma.154.1514028091088; Sat, 23 Dec 2017 03:21:31 -0800 (PST) Original-Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-2872-d519-1675-2de8.holly.idiocy.org. [2001:8b0:3f8:8129:2872:d519:1675:2de8]) by smtp.gmail.com with ESMTPSA id w91sm22223819wrc.79.2017.12.23.03.21.30 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 23 Dec 2017 03:21:30 -0800 (PST) Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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" Xref: news.gmane.org gmane.emacs.bugs:141418 Archived-At: --17pEHd4RhPHOinZp Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit The NS port doesn’t support customising tooltips as described in the Emacs manual. I’ve attached a patch that allows you to customise the background and foreground colours. It may be better to try using the existing frame code to generate the tooltips as they would then support all parameters, but I’m not sure how to go about doing that. -- Alan Third --17pEHd4RhPHOinZp Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-Allow-setting-tooltip-colors-in-NS-port.patch" >From fda76ad237ac01ce398796e02a2a9463027ce7c9 Mon Sep 17 00:00:00 2001 From: Alan Third Date: Sat, 23 Dec 2017 11:00:35 +0000 Subject: [PATCH] Allow setting tooltip colors in NS port * src/nsfns.m (Fx_show_tip): Get face colors and apply them to the tooltip. * src/nsmenu.m (EmacsTooltip::setBackgroundColor): (EmacsTooltip::setForegroundColor): New functions. * src/nsterm.h (EmacsTooltip::setBackgroundColor): (EmacsTooltip::setForegroundColor): New function prototypes. --- src/nsfns.m | 10 ++++++++++ src/nsmenu.m | 10 ++++++++++ src/nsterm.h | 2 ++ 3 files changed, 22 insertions(+) diff --git a/src/nsfns.m b/src/nsfns.m index 064b476fb4..05605bf657 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -2873,6 +2873,8 @@ with offset DY added (default is -10). struct frame *f; char *str; NSSize size; + NSColor *color; + Lisp_Object t; specbind (Qinhibit_redisplay, Qt); @@ -2900,6 +2902,14 @@ with offset DY added (default is -10). else Fx_hide_tip (); + t = x_get_arg (NULL, parms, Qbackground_color, NULL, NULL, RES_TYPE_STRING); + if (ns_lisp_to_color (t, &color) == 0) + [ns_tooltip setBackgroundColor: color]; + + t = x_get_arg (NULL, parms, Qforeground_color, NULL, NULL, RES_TYPE_STRING); + if (ns_lisp_to_color (t, &color) == 0) + [ns_tooltip setForegroundColor: color]; + [ns_tooltip setText: str]; size = [ns_tooltip frame].size; diff --git a/src/nsmenu.m b/src/nsmenu.m index d2e102a2a9..63ed4f5d1d 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -1373,6 +1373,16 @@ - (void) setText: (char *)text [textField setFrame: r]; } +- (void) setBackgroundColor: (NSColor *)col +{ + [textField setBackgroundColor: col]; +} + +- (void) setForegroundColor: (NSColor *)col +{ + [textField setTextColor: col]; +} + - (void) showAtX: (int)x Y: (int)y for: (int)seconds { NSRect wr = [win frame]; diff --git a/src/nsterm.h b/src/nsterm.h index e669c95931..184ada99ae 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -585,6 +585,8 @@ typedef id instancetype; } - (instancetype) init; - (void) setText: (char *)text; +- (void) setBackgroundColor: (NSColor *)col; +- (void) setForegroundColor: (NSColor *)col; - (void) showAtX: (int)x Y: (int)y for: (int)seconds; - (void) hide; - (BOOL) isActive; -- 2.14.3 --17pEHd4RhPHOinZp--