emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r105345: Fix tooltip dimensions on NS


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r105345: Fix tooltip dimensions on NS (Bug#9176).
Date: Thu, 28 Jul 2011 14:30:59 -0400
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 105345
author: Alp Aker <address@hidden>
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Thu 2011-07-28 14:30:59 -0400
message:
  Fix tooltip dimensions on NS (Bug#9176).
  
  * src/nsmenu.m (-setText): Size tooltip dimensions precisely to
  contents.
  (EmacsTooltip -init): Remove bezels and add shadows to
  tooltip windows.
modified:
  src/ChangeLog
  src/nsmenu.m
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-07-28 18:29:09 +0000
+++ b/src/ChangeLog     2011-07-28 18:30:59 +0000
@@ -4,6 +4,11 @@
        setting frame foreground color (Bug#9175).
        (x_set_background_color): Likewise.
 
+       * nsmenu.m (-setText): Size tooltip dimensions precisely to
+       contents (Bug#9176).
+       (EmacsTooltip -init): Remove bezels and add shadows to
+       tooltip windows.
+
 2011-07-28  Alp Aker  <address@hidden>
 
        Implement strike-through and overline on NextStep (Bug#8863).

=== modified file 'src/nsmenu.m'
--- a/src/nsmenu.m      2011-07-25 21:49:42 +0000
+++ b/src/nsmenu.m      2011-07-28 18:30:59 +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 via email to

[Prev in Thread] Current Thread [Next in Thread]