diff options
author | Vincent Sanders <vince@kyllikki.org> | 2014-11-21 11:48:43 +0000 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2014-11-21 11:48:43 +0000 |
commit | 3ff4846c1a7d1b85624f5c1ced2df8637b0bd1e3 (patch) | |
tree | 7ccaf71c89c158a9c1c7ce5bdceea6dcf4fc39ac /cocoa/BrowserView.m | |
parent | 0f0c3b02d7b3aa4687376d9c4e92312d77aa42c2 (diff) | |
download | netsurf-3ff4846c1a7d1b85624f5c1ced2df8637b0bd1e3.tar.gz netsurf-3ff4846c1a7d1b85624f5c1ced2df8637b0bd1e3.tar.bz2 |
Remove usage of browser private interfaces
The cocoa frontend was directly acessing browser internals instead of
using the API. In the case of gui.m there was a check for the browser
window not being root (browser->parent != NULL) . As gui windows can
only ever be associated with the root brower window (i.e. its parent
will always be NULL) this was completely redundant.
Diffstat (limited to 'cocoa/BrowserView.m')
-rw-r--r-- | cocoa/BrowserView.m | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/cocoa/BrowserView.m b/cocoa/BrowserView.m index e8567f056..e9d6ddd28 100644 --- a/cocoa/BrowserView.m +++ b/cocoa/BrowserView.m @@ -23,7 +23,7 @@ #import "cocoa/LocalHistoryController.h" #import "cocoa/BrowserWindowController.h" -#import "desktop/browser_private.h" +#import "desktop/browser.h" #import "desktop/plotters.h" #import "desktop/textinput.h" #import "utils/nsoption.h" @@ -94,9 +94,11 @@ static const NSTimeInterval CaretBlinkTime = 0.8; static inline NSRect cocoa_get_caret_rect( BrowserView *view ) { + float bscale = browser_window_get_scale(view->browser); + NSRect caretRect = { - .origin = NSMakePoint( view->caretPoint.x * view->browser->scale, view->caretPoint.y * view->browser->scale ), - .size = NSMakeSize( CaretWidth, view->caretHeight * view->browser->scale ) + .origin = NSMakePoint( view->caretPoint.x * bscale, view->caretPoint.y * bscale ), + .size = NSMakeSize( CaretWidth, view->caretHeight * bscale ) }; return caretRect; @@ -202,10 +204,11 @@ static browser_mouse_state cocoa_mouse_flags_for_event( NSEvent *evt ) - (NSPoint) convertMousePoint: (NSEvent *)event; { NSPoint location = [self convertPoint: [event locationInWindow] fromView: nil]; - if (NULL != browser) { - location.x /= browser->scale; - location.y /= browser->scale; - } + float bscale = browser_window_get_scale(browser); + + location.x /= bscale; + location.y /= bscale; + location.x = cocoa_pt_to_px( location.x ); location.y = cocoa_pt_to_px( location.y ); return location; @@ -485,8 +488,6 @@ static browser_mouse_state cocoa_mouse_flags_for_event( NSEvent *evt ) - (void) popUpContextMenuForEvent: (NSEvent *) event; { - if (content_get_type( browser->current_content ) != CONTENT_HTML) return; - NSMenu *popupMenu = [[NSMenu alloc] initWithTitle: @""]; NSPoint point = [self convertMousePoint: event]; |