diff options
| author | Alp Aker | 2011-07-28 14:30:59 -0400 |
|---|---|---|
| committer | Chong Yidong | 2011-07-28 14:30:59 -0400 |
| commit | ffe57a7a0e3d4fc66625d6931e6dc925f5bfa9d9 (patch) | |
| tree | 42920ea6f2b36463d789cdb7600fde371ef5e1a1 /src | |
| parent | d8c2fa787973fc6d0d8c3693b97ddbba622ca41f (diff) | |
| download | emacs-ffe57a7a0e3d4fc66625d6931e6dc925f5bfa9d9.tar.gz emacs-ffe57a7a0e3d4fc66625d6931e6dc925f5bfa9d9.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/nsmenu.m | 23 |
2 files changed, 16 insertions, 12 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 259ccb90cfe..2bd3cf8ec35 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -4,6 +4,11 @@ | |||
| 4 | setting frame foreground color (Bug#9175). | 4 | setting frame foreground color (Bug#9175). |
| 5 | (x_set_background_color): Likewise. | 5 | (x_set_background_color): Likewise. |
| 6 | 6 | ||
| 7 | * nsmenu.m (-setText): Size tooltip dimensions precisely to | ||
| 8 | contents (Bug#9176). | ||
| 9 | (EmacsTooltip -init): Remove bezels and add shadows to | ||
| 10 | tooltip windows. | ||
| 11 | |||
| 7 | 2011-07-28 Alp Aker <alp.tekin.aker@gmail.com> | 12 | 2011-07-28 Alp Aker <alp.tekin.aker@gmail.com> |
| 8 | 13 | ||
| 9 | Implement strike-through and overline on NextStep (Bug#8863). | 14 | Implement strike-through and overline on NextStep (Bug#8863). |
diff --git a/src/nsmenu.m b/src/nsmenu.m index 6931b7a3c01..6bde229ed4d 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m | |||
| @@ -1228,8 +1228,8 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 1228 | 1228 | ||
| 1229 | [textField setEditable: NO]; | 1229 | [textField setEditable: NO]; |
| 1230 | [textField setSelectable: NO]; | 1230 | [textField setSelectable: NO]; |
| 1231 | [textField setBordered: YES]; | 1231 | [textField setBordered: NO]; |
| 1232 | [textField setBezeled: YES]; | 1232 | [textField setBezeled: NO]; |
| 1233 | [textField setDrawsBackground: YES]; | 1233 | [textField setDrawsBackground: YES]; |
| 1234 | 1234 | ||
| 1235 | win = [[NSWindow alloc] | 1235 | win = [[NSWindow alloc] |
| @@ -1237,6 +1237,7 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 1237 | styleMask: 0 | 1237 | styleMask: 0 |
| 1238 | backing: NSBackingStoreBuffered | 1238 | backing: NSBackingStoreBuffered |
| 1239 | defer: YES]; | 1239 | defer: YES]; |
| 1240 | [win setHasShadow: YES]; | ||
| 1240 | [win setReleasedWhenClosed: NO]; | 1241 | [win setReleasedWhenClosed: NO]; |
| 1241 | [win setDelegate: self]; | 1242 | [win setDelegate: self]; |
| 1242 | [[win contentView] addSubview: textField]; | 1243 | [[win contentView] addSubview: textField]; |
| @@ -1257,17 +1258,15 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 1257 | - (void) setText: (char *)text | 1258 | - (void) setText: (char *)text |
| 1258 | { | 1259 | { |
| 1259 | NSString *str = [NSString stringWithUTF8String: text]; | 1260 | NSString *str = [NSString stringWithUTF8String: text]; |
| 1260 | NSRect r = [textField frame]; | 1261 | NSRect r = [textField frame]; |
| 1261 | NSSize textSize = [str sizeWithAttributes: | 1262 | NSSize tooltipDims; |
| 1262 | [NSDictionary dictionaryWithObject: [[textField font] screenFont] | 1263 | |
| 1263 | forKey: NSFontAttributeName]]; | ||
| 1264 | NSSize padSize = [[[textField font] screenFont] | ||
| 1265 | boundingRectForFont].size; | ||
| 1266 | |||
| 1267 | r.size.width = textSize.width + padSize.width/2; | ||
| 1268 | r.size.height = textSize.height + padSize.height/2; | ||
| 1269 | [textField setFrame: r]; | ||
| 1270 | [textField setStringValue: str]; | 1264 | [textField setStringValue: str]; |
| 1265 | tooltipDims = [[textField cell] cellSize]; | ||
| 1266 | |||
| 1267 | r.size.width = tooltipDims.width; | ||
| 1268 | r.size.height = tooltipDims.height; | ||
| 1269 | [textField setFrame: r]; | ||
| 1271 | } | 1270 | } |
| 1272 | 1271 | ||
| 1273 | - (void) showAtX: (int)x Y: (int)y for: (int)seconds | 1272 | - (void) showAtX: (int)x Y: (int)y for: (int)seconds |