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#9176: [PATCH] 24.0.50: Tooltip windows on NextStep are sized incorrectly Date: Tue, 26 Jul 2011 16:13:04 -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 1311818186 22695 80.91.229.12 (28 Jul 2011 01:56:26 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 28 Jul 2011 01:56:26 +0000 (UTC) To: 9176@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jul 28 03:56:22 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 1QmFpl-0001yp-NP for geb-bug-gnu-emacs@m.gmane.org; Thu, 28 Jul 2011 03:56:22 +0200 Original-Received: from localhost ([::1]:48377 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QmFpl-0000xx-5P for geb-bug-gnu-emacs@m.gmane.org; Wed, 27 Jul 2011 21:56:21 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:51329) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qm9VX-0003qW-Ou 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-0001JV-U0 for bug-gnu-emacs@gnu.org; Wed, 27 Jul 2011 15:11:03 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:39931) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qm9VW-0001JQ-R3 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-00073R-N5; 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:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 9176 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.131179382527054 (code B ref -1); Wed, 27 Jul 2011 19:11:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 27 Jul 2011 19:10:25 +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 1Qm9Uv-00072D-4i for submit@debbugs.gnu.org; Wed, 27 Jul 2011 15:10:25 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qlo09-0006iH-Hx for submit@debbugs.gnu.org; Tue, 26 Jul 2011 16:13:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qlo03-0002i4-6R for submit@debbugs.gnu.org; Tue, 26 Jul 2011 16:13:08 -0400 Original-Received: from lists.gnu.org ([140.186.70.17]:59909) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qlo03-0002i0-4x for submit@debbugs.gnu.org; Tue, 26 Jul 2011 16:13:07 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:42343) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qlo02-0005wn-6M for bug-gnu-emacs@gnu.org; Tue, 26 Jul 2011 16:13:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qlo00-0002hi-V2 for bug-gnu-emacs@gnu.org; Tue, 26 Jul 2011 16:13:06 -0400 Original-Received: from mail-qw0-f41.google.com ([209.85.216.41]:36193) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qlo00-0002hX-KU for bug-gnu-emacs@gnu.org; Tue, 26 Jul 2011 16:13:04 -0400 Original-Received: by qwa26 with SMTP id 26so620062qwa.0 for ; Tue, 26 Jul 2011 13:13:04 -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=/fu4q3oF8CJvXn4Fx1RUQU1RS5mqZEwNX1pPwXHqE1c=; b=Tb8/ouDJy1Ak7VvRVADTSE4LyVxJSJdlTn8nmNEdkIp7zZpNSc2sGtkKK5JBitiwF5 4dQRraCXGSEunm6qvCOmT3NpJo4SQkxBpce/TNzngp0mww1TxKAng7hPwA+4HNdo6h0v yVKUB9d8eEPru2vU0isIMpc6QZUsYQP3cCZ5A= Original-Received: by 10.229.2.160 with SMTP id 32mr4543856qcj.280.1311711184254; Tue, 26 Jul 2011 13:13:04 -0700 (PDT) Original-Received: by 10.229.250.132 with HTTP; Tue, 26 Jul 2011 13:13:04 -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:49639 Archived-At: A small aesthetic issue: Currently on NS the dimensions of tooltip windows are determined by a small hack that introduces superfluous padding at the bottom and left (typically 10 pixels or more). The patch below sizes tooltip windows precisely. I also took the liberty of making another purely aesthetic change. Currently on NS tooltip windows have bezels and no shadows. The standard appearance on Mac is to have shadows and no bezels. So I changed the implementation to use the default appearance as well. 2011-07-26 Alp Aker * nsmenu.m (EmacsTooltip -init): Remove bezels and add shadows to tooltip windows. (-setText): Size tooltip dimensions precisely to contents. === modified file 'src/nsmenu.m' --- src/nsmenu.m 2011-07-08 10:04:23 +0000 +++ src/nsmenu.m 2011-07-26 19:50:47 +0000 @@ -1228,8 +1228,8 @@ [textField setEditable: NO]; [textField setSelectable: NO]; - [textField setBordered: YES]; - [textField setBezeled: YES]; + [textField setBordered: NO]; + [textField setBezeled: NO]; [textField setDrawsBackground: YES]; win = [[NSWindow alloc] @@ -1237,6 +1237,7 @@ styleMask: 0 backing: NSBackingStoreBuffered defer: YES]; + [win setHasShadow: YES]; [win setReleasedWhenClosed: NO]; [win setDelegate: self]; [[win contentView] addSubview: textField]; @@ -1257,17 +1258,15 @@ - (void) setText: (char *)text { NSString *str = [NSString stringWithUTF8String: text]; - NSRect r = [textField frame]; - NSSize textSize = [str sizeWithAttributes: - [NSDictionary dictionaryWithObject: [[textField font] screenFont] - forKey: NSFontAttributeName]]; - NSSize padSize = [[[textField font] screenFont] - boundingRectForFont].size; - - r.size.width = textSize.width + padSize.width/2; - r.size.height = textSize.height + padSize.height/2; + NSRect r = [textField frame]; + NSSize tooltipDims; + + [textField setStringValue: str]; + tooltipDims = [[textField cell] cellSize]; + + r.size.width = tooltipDims.width; + r.size.height = tooltipDims.height; [textField setFrame: r]; - [textField setStringValue: str]; } - (void) showAtX: (int)x Y: (int)y for: (int)seconds