From 65b9019f060b272ef8039057ec853c7b4a0e6654 Mon Sep 17 00:00:00 2001 From: anthony Date: Thu, 3 Dec 2020 20:24:15 +0000 Subject: [PATCH] Update url bar with nav url, send correct browser size to ns --- frontends/gnustep/BrowserWindowController.h | 2 ++ frontends/gnustep/BrowserWindowController.m | 16 +++++++++------- frontends/gnustep/tables/window.m | 15 ++++++++++++++- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/frontends/gnustep/BrowserWindowController.h b/frontends/gnustep/BrowserWindowController.h index d506885d2..c22f822ca 100644 --- a/frontends/gnustep/BrowserWindowController.h +++ b/frontends/gnustep/BrowserWindowController.h @@ -26,4 +26,6 @@ struct browser_window; -(void)newContent; -(void)startThrobber; -(void)stopThrobber; +-(void)setNavigationUrl: (NSString*)urlString; +-(void)setTitle: (NSString*)title; @end diff --git a/frontends/gnustep/BrowserWindowController.m b/frontends/gnustep/BrowserWindowController.m index 1f7d4d122..5bdf508dd 100644 --- a/frontends/gnustep/BrowserWindowController.m +++ b/frontends/gnustep/BrowserWindowController.m @@ -31,7 +31,7 @@ } -(NSSize)getBrowserSize { - return [plotView frame].size; + return [[plotView superview] frame].size; } -(NSPoint)getBrowserScroll { return [plotView visibleRect].origin; @@ -56,19 +56,21 @@ } -(void)newContent { NSLog(@"New content"); - struct nsurl *url = browser_window_access_url(browser); - const char *urlcstr = nsurl_access(url); - [urlBar setStringValue: [NSString stringWithUTF8String: urlcstr]]; } -(void)startThrobber { - struct nsurl *url = browser_window_access_url(browser); - const char *urlcstr = nsurl_access(url); - [urlBar setStringValue: [NSString stringWithUTF8String: urlcstr]]; + } -(void)stopThrobber { } +-(void)setNavigationUrl: (NSString*)urlString { + [urlBar setStringValue: urlString]; +} +-(void)setTitle: (NSString*)title { + [[self window] setTitle: title]; +} + -(BOOL)control: (NSControl*)control textShouldEndEditing: (NSText*)fieldEditor { NSLog(@"textShouldEndEditing"); diff --git a/frontends/gnustep/tables/window.m b/frontends/gnustep/tables/window.m index 466c21d8a..acd83f226 100644 --- a/frontends/gnustep/tables/window.m +++ b/frontends/gnustep/tables/window.m @@ -4,6 +4,7 @@ #import "netsurf/netsurf.h" #import "netsurf/window.h" #import "netsurf/types.h" +#import "utils/nsurl.h" /********************/ /****** Window ******/ @@ -95,6 +96,16 @@ static nserror gnustep_window_event(struct gui_window *gw, enum gui_window_event return NSERROR_OK; } +static void gnustep_window_set_title(struct gui_window *gw, const char *title) { + [(id)gw setTitle: [NSString stringWithUTF8String: title]]; +} + +static nserror gnustep_window_set_url(struct gui_window *gw, struct nsurl *url) { + NSString *urlStr = [NSString stringWithUTF8String: nsurl_access(url)]; + [(id)gw setNavigationUrl: urlStr]; + return NSERROR_OK; +} + struct gui_window_table gnustep_window_table = { .create = gnustep_window_create, .destroy = gnustep_window_destroy, @@ -102,5 +113,7 @@ struct gui_window_table gnustep_window_table = { .get_scroll = gnustep_window_get_scroll, .set_scroll = gnustep_window_set_scroll, .get_dimensions = gnustep_window_get_dimensions, - .event = gnustep_window_event + .event = gnustep_window_event, + .set_title = gnustep_window_set_title, + .set_url = gnustep_window_set_url };