all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alp Aker <alptekin.aker@gmail.com>
To: 9176@debbugs.gnu.org
Subject: bug#9176: [PATCH] 24.0.50: Tooltip windows on NextStep are sized incorrectly
Date: Tue, 26 Jul 2011 16:13:04 -0400	[thread overview]
Message-ID: <CACxch4rH6i48iDXpcfOCMVRKDDFDO1vmVgwUX7WV3k_w-p+b4A@mail.gmail.com> (raw)

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





             reply	other threads:[~2011-07-26 20:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-26 20:13 Alp Aker [this message]
2011-07-28 18:31 ` bug#9176: [PATCH] 24.0.50: Tooltip windows on NextStep are sized incorrectly Chong Yidong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACxch4rH6i48iDXpcfOCMVRKDDFDO1vmVgwUX7WV3k_w-p+b4A@mail.gmail.com \
    --to=alptekin.aker@gmail.com \
    --cc=9176@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.