GNU bug report logs - #9176
[PATCH] 24.0.50: Tooltip windows on NextStep are sized incorrectly

Previous Next

Package: emacs;

Reported by: Alp Aker <alptekin.aker <at> gmail.com>

Date: Wed, 27 Jul 2011 19:11:02 UTC

Severity: normal

Tags: patch

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 9176 in the body.
You can then email your comments to 9176 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9176; Package emacs. (Wed, 27 Jul 2011 19:11:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Alp Aker <alptekin.aker <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 27 Jul 2011 19:11:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Alp Aker <alptekin.aker <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] 24.0.50: Tooltip windows on NextStep are sized incorrectly
Date: Tue, 26 Jul 2011 16:13:04 -0400
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  <alp.tekin.aker <at> gmail.com>

	* 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




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9176; Package emacs. (Thu, 28 Jul 2011 18:32:01 GMT) Full text and rfc822 format available.

Message #8 received at 9176 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Alp Aker <alptekin.aker <at> gmail.com>
Cc: 9176 <at> debbugs.gnu.org
Subject: Re: bug#9176: [PATCH] 24.0.50: Tooltip windows on NextStep are sized
	incorrectly
Date: Thu, 28 Jul 2011 14:31:10 -0400
Alp Aker <alptekin.aker <at> gmail.com> writes:

> 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.

Thanks, applied.




bug closed, send any further explanations to 9176 <at> debbugs.gnu.org and Alp Aker <alptekin.aker <at> gmail.com> Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> debbugs.gnu.org. (Thu, 28 Jul 2011 18:32:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 26 Aug 2011 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 297 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.