minor edits

This commit is contained in:
anthony 2020-11-19 19:35:49 +00:00
parent 51f7304486
commit 4664d6a1d4
6 changed files with 22 additions and 11 deletions

View File

@ -42,12 +42,7 @@ static nserror set_defaults(struct nsoption_s *defaults)
struct nsurl *url; struct nsurl *url;
nserror error; nserror error;
if (nsoption_charp(homepage_url) != NULL) { error = nsurl_create("https://www.startpage.com", &url);
error = nsurl_create(nsoption_charp(homepage_url), &url);
} else {
NSLog(@"opening default page %s", NETSURF_HOMEPAGE);
error = nsurl_create(NETSURF_HOMEPAGE, &url);
}
if (error == NSERROR_OK) { if (error == NSERROR_OK) {
error = browser_window_create(BW_CREATE_HISTORY, url, NULL, NULL, NULL); error = browser_window_create(BW_CREATE_HISTORY, url, NULL, NULL, NULL);

View File

@ -9,6 +9,7 @@ struct browser_window;
id scrollView; id scrollView;
id urlBar; id urlBar;
struct browser_window *browser; struct browser_window *browser;
id plotView;
} }
-(id)initWithBrowser: (struct browser_window*)aBrowser; -(id)initWithBrowser: (struct browser_window*)aBrowser;

View File

@ -1,8 +1,10 @@
/* All Rights reserved */ /* All Rights reserved */
#include <AppKit/AppKit.h> #import <AppKit/AppKit.h>
#include "BrowserWindowController.h" #import "BrowserWindowController.h"
#include "PlotView.h" #import "PlotView.h"
#import "netsurf/browser_window.h"
#import "utils/nsurl.h"
@implementation BrowserWindowController @implementation BrowserWindowController
@ -14,7 +16,7 @@
} }
-(void)awakeFromNib { -(void)awakeFromNib {
PlotView *plotView = [[PlotView alloc] initWithFrame: NSMakeRect(0, 0, 1000, 1000)]; plotView = [[PlotView alloc] initWithFrame: NSMakeRect(0, 0, 1000, 1000)];
[plotView setBrowser: browser]; [plotView setBrowser: browser];
[[scrollView contentView] addSubview: plotView]; [[scrollView contentView] addSubview: plotView];
NSLog(@"Browser window loaded"); NSLog(@"Browser window loaded");
@ -22,6 +24,17 @@
-(id)back: (id)sender { -(id)back: (id)sender {
NSLog(@"Browser backward"); NSLog(@"Browser backward");
[plotView display];
bool ready = browser_window_redraw_ready(browser);
if (ready) {
NSLog(@"redraw ready!");
}
if (browser_window_has_content(browser)) {
NSLog(@"has content");
}
struct nsurl *url = browser_window_access_url(browser);
NSLog(@"url: '%s'", nsurl_access(url));
} }
-(id)forward: (id)sender { -(id)forward: (id)sender {

View File

@ -9,6 +9,7 @@
// Return the MIME type of the specified file. Returned string can be inval on next req. // Return the MIME type of the specified file. Returned string can be inval on next req.
static const char *gnustep_fetch_filetype(const char *unix_path) { static const char *gnustep_fetch_filetype(const char *unix_path) {
NSLog(@"gnustep_fetch_filetype");
static char filetype[100]; static char filetype[100];
filetype[0] = '\0'; filetype[0] = '\0';
return filetype; return filetype;

View File

@ -14,7 +14,7 @@ static nserror gnustep_misc_schedule(int t, void (*callback)(void *p), void *p)
NSLog(@"gnustep_misc_schedule in %dms", t); NSLog(@"gnustep_misc_schedule in %dms", t);
NetsurfCallback *nsCallback = [NetsurfCallback newOrScheduledWithFunctionPointer: NetsurfCallback *nsCallback = [NetsurfCallback newOrScheduledWithFunctionPointer:
callback parameter: p]; callback parameter: p];
if (t < 1) { if (t < 0) {
[nsCallback cancel]; [nsCallback cancel];
return NSERROR_OK; return NSERROR_OK;
} else { } else {

View File

@ -70,6 +70,7 @@ static nserror gnustep_window_event(struct gui_window *gw, enum gui_window_event
NSLog(@"GW_EVENT_STOP_THROBBER"); NSLog(@"GW_EVENT_STOP_THROBBER");
break; break;
default: default:
NSLog(@"Unknown window event.");
break; break;
} }
return NSERROR_OK; return NSERROR_OK;