summaryrefslogtreecommitdiff
path: root/frontends/windows
diff options
context:
space:
mode:
Diffstat (limited to 'frontends/windows')
-rw-r--r--frontends/windows/main.c23
-rw-r--r--frontends/windows/window.c25
2 files changed, 23 insertions, 25 deletions
diff --git a/frontends/windows/main.c b/frontends/windows/main.c
index b021751c9..6592e1626 100644
--- a/frontends/windows/main.c
+++ b/frontends/windows/main.c
@@ -34,6 +34,7 @@
#include "utils/nsoption.h"
#include "netsurf/url_db.h"
#include "netsurf/cookie_db.h"
+#include "netsurf/browser.h"
#include "netsurf/browser_window.h"
#include "netsurf/fetch.h"
#include "netsurf/misc.h"
@@ -62,6 +63,26 @@ char **respaths; /** exported global defined in windows/gui.h */
char *nsw32_config_home; /* exported global defined in windows/gui.h */
/**
+ * Obtain the DPI of the display.
+ *
+ * \return The DPI of the device the window is displayed on.
+ */
+static int get_screen_dpi(void)
+{
+ HDC screendc = GetDC(0);
+ int dpi = GetDeviceCaps(screendc, LOGPIXELSY);
+ ReleaseDC(0, screendc);
+
+ if (dpi <= 10) {
+ dpi = 96; /* 96DPI is the default */
+ }
+
+ NSLOG(netsurf, INFO, "FIX DPI %d", dpi);
+
+ return dpi;
+}
+
+/**
* Get the path to the config directory.
*
* This ought to use SHGetKnownFolderPath(FOLDERID_RoamingAppData) and
@@ -393,6 +414,8 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
return 1;
}
+ browser_set_dpi(get_screen_dpi());
+
urldb_load(nsoption_charp(url_file));
urldb_load_cookies(nsoption_charp(cookie_file));
hotlist_init(nsoption_charp(hotlist_path),
diff --git a/frontends/windows/window.c b/frontends/windows/window.c
index 575d089a3..689e78d8c 100644
--- a/frontends/windows/window.c
+++ b/frontends/windows/window.c
@@ -72,29 +72,6 @@ static int open_windows = 0;
/**
- * Obtain the DPI of the display.
- *
- * \param hwnd A win32 window handle to get the DPI for
- * \return The DPI of the device the window is displayed on.
- */
-static int get_window_dpi(HWND hwnd)
-{
- HDC hdc = GetDC(hwnd);
- int dpi = GetDeviceCaps(hdc, LOGPIXELSY);
-
- if (dpi <= 10) {
- dpi = 96; /* 96DPI is the default */
- }
-
- ReleaseDC(hwnd, hdc);
-
- NSLOG(netsurf, INFO, "FIX DPI %d", dpi);
-
- return dpi;
-}
-
-
-/**
* create and attach accelerator table to main window
*
* \param gw gui window context.
@@ -190,8 +167,6 @@ static HWND nsws_window_create(HINSTANCE hInstance, struct gui_window *gw)
/* set the gui window associated with this browser */
SetProp(hwnd, TEXT("GuiWnd"), (HANDLE)gw);
- browser_set_dpi(get_window_dpi(hwnd));
-
if ((nsoption_int(window_width) >= 100) &&
(nsoption_int(window_height) >= 100) &&
(nsoption_int(window_x) >= 0) &&