mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-16 09:12:44 +03:00
improve cocoa frontend to use proper API for browser_window access
This commit is contained in:
parent
ea851ba788
commit
6b36990787
@ -23,7 +23,7 @@
|
||||
#import "cocoa/BrowserViewController.h"
|
||||
#import "cocoa/gui.h"
|
||||
|
||||
#import "desktop/browser_private.h"
|
||||
#import "desktop/browser.h"
|
||||
#import "desktop/hotlist.h"
|
||||
#import "desktop/tree.h"
|
||||
#import "utils/messages.h"
|
||||
@ -163,8 +163,8 @@ static const char *cocoa_hotlist_path( void )
|
||||
- (IBAction) addBookmark: (id) sender;
|
||||
{
|
||||
struct browser_window *bw = [[(NetSurfApp *)NSApp frontTab] browser];
|
||||
if (bw && bw->current_content) {
|
||||
hotlist_add_url( hlcache_handle_get_url( bw->current_content ) );
|
||||
if (bw != NULL) {
|
||||
hotlist_add_url(browser_window_get_url(bw));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
#import "cocoa/gui.h"
|
||||
#import "cocoa/BrowserViewController.h"
|
||||
|
||||
#import "desktop/browser_private.h"
|
||||
#import "desktop/browser.h"
|
||||
#import "content/content.h"
|
||||
#import "utils/nsoption.h"
|
||||
#import "content/hlcache.h"
|
||||
@ -39,7 +39,7 @@
|
||||
- (IBAction) useCurrentPageAsHomepage: (id) sender;
|
||||
{
|
||||
struct browser_window *bw = [[(NetSurfApp *)NSApp frontTab] browser];
|
||||
const char *url = nsurl_access(hlcache_handle_get_url( bw->current_content ));
|
||||
const char *url = nsurl_access(browser_window_get_url(bw));
|
||||
[self setHomepageURL: [NSString stringWithUTF8String: url]];
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
#ifndef COCOA_COORDINATES_H
|
||||
#define COCOA_COORDINATES_H
|
||||
|
||||
#import "desktop/browser_private.h"
|
||||
#import "desktop/browser.h"
|
||||
#import "render/box.h"
|
||||
|
||||
extern CGFloat cocoa_scale_factor;
|
||||
@ -108,7 +108,7 @@ static inline NSRect cocoa_rect_for_box( struct browser_window *bw, struct box *
|
||||
{
|
||||
struct rect r;
|
||||
box_bounds( box, &r );
|
||||
return cocoa_scaled_rect( bw->scale, r.x0, r.y0, r.x1, r.y1 );
|
||||
return cocoa_scaled_rect(browser_window_get_scale(bw), r.x0, r.y0, r.x1, r.y1 );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -33,7 +33,7 @@
|
||||
#import "desktop/mouse.h"
|
||||
#import "desktop/gui_window.h"
|
||||
#import "desktop/gui_misc.h"
|
||||
#import "desktop/browser_private.h"
|
||||
#import "desktop/browser.h"
|
||||
#import "desktop/textinput.h"
|
||||
#import "image/ico.h"
|
||||
#import "content/fetchers/resource.h"
|
||||
@ -59,11 +59,9 @@ gui_window_create(struct browser_window *bw,
|
||||
{
|
||||
BrowserWindowController *window = nil;
|
||||
|
||||
browser_window_set_scale(bw, (float)nsoption_int(scale) / 100, false);
|
||||
if (existing != NULL) {
|
||||
bw->scale = (float) nsoption_int(scale) / 100;
|
||||
window = [(BrowserViewController *)(existing) windowController];
|
||||
} else {
|
||||
bw->scale = (float) nsoption_int(scale) / 100;
|
||||
}
|
||||
|
||||
BrowserViewController *result = [[BrowserViewController alloc] initWithBrowser: bw];
|
||||
|
Loading…
Reference in New Issue
Block a user