68 HDC screendc = GetDC(0);
69 int dpi = GetDeviceCaps(screendc, LOGPIXELSY);
70 ReleaseDC(0, screendc);
76 NSLOG(netsurf, INFO,
"FIX DPI %d", dpi);
93 TCHAR adPath[MAX_PATH];
94 char nsdir[] =
"NetSurf";
97 hres = SHGetFolderPath(NULL,
98 CSIDL_APPDATA | CSIDL_FLAG_CREATE,
106 if (PathAppend(adPath, nsdir) ==
false) {
111 if (CreateDirectory(adPath, NULL) == 0) {
114 if (dw != ERROR_ALREADY_EXISTS) {
119 *config_home_out = strdup(adPath);
121 NSLOG(netsurf, INFO,
"using config path \"%s\"", *config_home_out);
134static void die(
const char *error)
149 if (_get_osfhandle(fileno(fptr)) == -1) {
151 freopen(
"CONOUT$",
"w", fptr);
170 DWORD buf_tchar_size =
PATH_MAX + 1;
171 DWORD buf_bytes_size =
sizeof(TCHAR) * buf_tchar_size;
176 char dldir[] =
"Downloads";
178 buf = malloc(buf_bytes_size);
185 res_len = SearchPathA(NULL,
209 hres = SHGetFolderPath(NULL,
210 CSIDL_PROFILE | CSIDL_FLAG_CREATE,
215 if (PathAppend(buf, dldir)) {
266 char *choices = NULL;
307 if (messages == NULL) {
334 argvw = CommandLineToArgvW(GetCommandLineW(), &argc);
339 argv = malloc(
sizeof(
char *) * argc);
344 for (cura = 0; cura < argc; cura++) {
346 len = wcstombs(NULL, argvw[cura], 0) + 1;
348 argv[cura] = malloc(len);
349 if (argv[cura] == NULL) {
358 wcstombs(argv[cura], argvw[cura], len);
360 if (argv[cura][0] ==
'/') {
381WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli,
int ncmd)
386 char *nsw32_config_home = NULL;
405 die(
"NetSurf operation table registration failed");
411 setbuf(stderr, NULL);
431 "Unable to locate a configuration directory.");
437 NSLOG(netsurf, ERROR,
"Options failed to initialise (%s)\n",
445 fprintf(stderr,
"Unable to load translated messages (%s)\n",
447 NSLOG(netsurf, INFO,
"Unable to load translated messages");
454 NSLOG(netsurf, INFO,
"NetSurf failed to initialise");
479 addr = NETSURF_HOMEPAGE;
482 NSLOG(netsurf, INFO,
"calling browser_window_create");
Browser window creation and manipulation interface.
nserror browser_window_create(enum browser_window_create_flags flags, struct nsurl *url, struct nsurl *referrer, struct browser_window *existing, struct browser_window **bw)
Create and open a new root browser window with the given page.
@ BW_CREATE_HISTORY
this will form a new history node (don't set for back/reload/etc)
Unified cookie database public interface.
void urldb_save_cookies(const char *filename)
Save persistent cookies to file.
void urldb_load_cookies(const char *filename)
Load a cookie file into the database.
nserror hotlist_init(const char *load_path, const char *save_path)
Initialise the hotlist.
nserror nsws_create_drawable_class(HINSTANCE hinstance)
Create the drawable window class.
nserror
Enumeration of error codes.
@ NSERROR_NOT_FOUND
Requested item not found.
@ NSERROR_NOT_DIRECTORY
Missing directory.
@ NSERROR_INVALID
Invalid data.
@ NSERROR_NOMEM
Memory exhaustion.
char * filepath_sfind(char **respathv, char *filepath, const char *filename)
Searches an array of resource paths for a file.
char * filepath_find(char **respathv, const char *filename)
Searches an array of resource paths for a file.
Utility routines to obtain paths to file resources.
struct gui_bitmap_table * win32_bitmap_table
struct gui_download_table * win32_download_table
nserror nsw32_get_resource_data(const char *path, const uint8_t **data_out, size_t *data_len_out)
Translate resource to win32 resource data.
struct gui_fetch_table * win32_fetch_table
win32 API fetch operation table
struct gui_file_table * win32_file_table
Windows file operation table interface.
struct gui_utf8_table * win32_utf8_table
struct gui_layout_table * win32_layout_table
The interface to the win32 font and utf8 handling.
Interface to win32 local history manager using nsw32 core window.
nserror browser_set_dpi(int dpi)
Set the DPI of the browser.
Interface to platform-specific fetcher operations.
Interface to platform-specific miscellaneous browser operation table.
nserror nslog_init(nslog_ensure_t *ensure, int *pargc, char **argv)
Initialise the logging system.
void nslog_finalise(void)
Shut down the logging system.
#define NSLOG(catname, level, logmsg, args...)
nserror messages_add_from_inline(const uint8_t *data, size_t size)
Read keys and values from inline message data into the standard Messages hash.
nserror messages_add_from_file(const char *path)
Read keys and values from messages file into the standard Messages hash.
const char * messages_get_errorcode(nserror code)
lookup of a message by errorcode from the standard Messages hash.
Localised message support (interface).
char ** respaths
resource search path vector
NetSurf core interface registration, construction and destruction.
void netsurf_exit(void)
Finalise NetSurf core.
nserror netsurf_init(const char *store_path)
Initialise netsurf core.
nserror netsurf_register(struct netsurf_table *table)
Register operation table.
NetSurf URL handling (interface).
nserror nsurl_create(const char *const url_s, nsurl **url)
Create a NetSurf URL object from a URL string.
void nsurl_unref(nsurl *url)
Drop a reference to a NetSurf URL object.
struct nsurl nsurl
NetSurf URL object.
void nsws_window_init_pointers(HINSTANCE hinstance)
initialise the list of mouse cursors
Windows mouse cursor interface.
Graphical user interface browser misc function table.
nserror(* schedule)(int t, void(*callback)(void *p), void *p)
Schedule a callback.
NetSurf operation function table.
struct gui_misc_table * misc
Browser table.
Unified URL information database public interface.
nserror urldb_save(const char *filename)
Export the current database to file.
nserror urldb_load(const char *filename)
Import an URL database from file, replacing any existing database.
nserror netsurf_mkpath(char **str, size_t *size, size_t nelm,...)
Generate a path from one or more component elemnts.
Default operations table for files.
struct nsoption_s * nsoptions_default
global default option table.
static struct nsoption_s defaults[]
The table of compiled in default options.
nserror nsoption_read(const char *path, struct nsoption_s *opts)
Read choices file and set them in the passed table.
struct nsoption_s * nsoptions
global active option table.
nserror nsoption_commandline(int *pargc, char **argv, struct nsoption_s *opts)
Process commandline and set options approriately.
nserror nsoption_init(nsoption_set_default_t *set_defaults, struct nsoption_s **popts, struct nsoption_s **pdefs)
Initialise option system.
nserror nsoption_finalise(struct nsoption_s *opts, struct nsoption_s *defs)
Finalise option system.
Option reading and saving interface.
#define nsoption_charp(OPTION)
Get the value of a string option.
#define nsoption_setnull_charp(OPTION, VALUE)
set string option in default table if currently unset
#define nsoption_set_bool(OPTION, VALUE)
set a boolean option in the default table
Interface to a number of general purpose functionality.
struct gui_clipboard_table * win32_clipboard_table
The clipboard operation function table for win32.
nserror nsw32_cookies_present(const char *search_term)
make the cookie window visible.
Interface to win32 cookie viewing using nsw32 core windows.
nserror nsw32_create_corewindow_class(HINSTANCE hInstance)
struct core_window_table * win32_core_window_table
char ** nsws_init_resource(const char *resource_path)
Create an array of valid paths to search for resources.
char ** G_resource_pathv
resource search path vector.
char * G_config_path
path to where all user config files are held.
nserror win32_warning(const char *warning, const char *detail)
Warn the user of an event.
void win32_run(void)
Run the win32 message loop with scheduling.
HINSTANCE hinst
win32 application instance handle.
static bool nslog_ensure(FILE *fptr)
Ensures output logging stream is available.
static nserror set_defaults(struct nsoption_s *defaults)
Set option defaults for windows frontend.
static nserror nsw32_option_init(int *pargc, char **argv, char **respaths, char *config_path)
Initialise user options location and contents.
static void die(const char *error)
Cause an abnormal program termination.
static struct gui_misc_table win32_misc_table
static nserror win32_to_unix_commandline(int *argc_out, char ***argv_out)
Construct a unix style argc/argv.
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
Entry point from windows.
static nserror nsw32_messages_init(char **respaths)
Initialise messages.
static int get_screen_dpi(void)
Obtain the DPI of the display.
static nserror get_config_home(char **config_home_out)
Get the path to the config directory.
nserror win32_schedule(int ival, void(*callback)(void *p), void *p)
Schedule a callback.
struct gui_window_table * win32_window_table
The window operation function table for win32.
nserror nsws_create_main_class(HINSTANCE hinstance)
Create the main browser window class.