From d092b9ca354f07a78f0e540ce7da00026f0e534a Mon Sep 17 00:00:00 2001 From: Sven Weidauer Date: Thu, 17 Feb 2011 17:23:58 +0000 Subject: Making sure history popup stays on screen. svn path=/trunk/netsurf/; revision=11708 --- cocoa/HistoryView.m | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'cocoa/HistoryView.m') diff --git a/cocoa/HistoryView.m b/cocoa/HistoryView.m index d18f1eb50..49982b393 100644 --- a/cocoa/HistoryView.m +++ b/cocoa/HistoryView.m @@ -25,13 +25,6 @@ #import "desktop/history_core.h" #import "desktop/plotters.h" -static NSRect cocoa_history_rect( struct browser_window *bw ) -{ - int width, height; - history_size( bw->history, &width, &height ); - return cocoa_rect( 0, 0, width, height ); -} - @implementation HistoryView @synthesize browser; @@ -42,9 +35,19 @@ static NSRect cocoa_history_rect( struct browser_window *bw ) [self updateHistory]; } +- (NSSize) size; +{ + const CGFloat padding = 10; + + int width, height; + history_size( browser->history, &width, &height ); + + return NSMakeSize( cocoa_px_to_pt( width ) + padding, cocoa_px_to_pt( height ) + padding ); +} + - (void) updateHistory; { - [self setFrameSize: cocoa_history_rect( browser ).size]; + [self setFrameSize: [self size]]; [self setNeedsDisplay: YES]; } -- cgit v1.2.3