split browser and browser_window operations

This commit is contained in:
Vincent Sanders 2019-08-01 17:22:17 +01:00
parent f4f67698eb
commit 5742762070
16 changed files with 3579 additions and 3521 deletions

View File

@ -12,7 +12,8 @@ desktop/version.c: testament $(OBJROOT)/testament.h
# S_BROWSER are sources related to full browsers but are common
# between RISC OS, GTK, BeOS and AmigaOS builds
S_BROWSER := browser.c browser_history.c download.c frames.c netsurf.c \
S_BROWSER := browser.c browser_window.c browser_history.c \
download.c frames.c netsurf.c \
save_complete.c save_text.c selection.c textinput.c gui_factory.c \
save_pdf.c font_haru.c

File diff suppressed because it is too large Load Diff

View File

@ -33,13 +33,14 @@
#include "netsurf/layout.h"
#include "netsurf/content.h"
#include "netsurf/window.h"
#include "netsurf/browser_window.h"
#include "content/hlcache.h"
#include "content/urldb.h"
#include "netsurf/bitmap.h"
#include "desktop/gui_internal.h"
#include "desktop/browser_history.h"
#include "desktop/browser_private.h"
#include "desktop/browser_history.h"
#define WIDTH 100
#define HEIGHT 86

View File

@ -22,13 +22,8 @@
* Browser window private structure.
*/
#ifndef _NETSURF_DESKTOP_BROWSER_PRIVATE_H_
#define _NETSURF_DESKTOP_BROWSER_PRIVATE_H_
#include <libwapcaplet/libwapcaplet.h>
#include "netsurf/types.h"
#include "netsurf/browser_window.h"
#ifndef NETSURF_DESKTOP_BROWSER_PRIVATE_H_
#define NETSURF_DESKTOP_BROWSER_PRIVATE_H_
#include "desktop/frame_types.h"

3490
desktop/browser_window.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -28,6 +28,7 @@
#include "utils/nsurl.h"
#include "netsurf/types.h"
#include "netsurf/layout.h"
#include "netsurf/browser_window.h"
#include "netsurf/core_window.h"
#include "netsurf/plotters.h"

View File

@ -18,11 +18,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/** \file
/**
* \file
* Free text search (core)
*/
#include "content/content.h"
#include "netsurf/types.h"
#include "netsurf/browser_window.h"
#include "desktop/browser_private.h"
#include "desktop/search.h"

View File

@ -36,6 +36,7 @@
#include "html/html_internal.h"
#include "html/font.h"
#include "text/textplain.h"
#include "netsurf/browser_window.h"
#include "netsurf/mouse.h"
#include "desktop/browser_private.h"

View File

@ -36,6 +36,7 @@
#include "netsurf/mouse.h"
#include "netsurf/form.h"
#include "netsurf/window.h"
#include "netsurf/browser_window.h"
#include "netsurf/keypress.h"
#include "html/box.h"
#include "html/html_internal.h"

View File

@ -24,7 +24,7 @@
#include "utils/log.h"
#include "utils/nsoption.h"
#include "netsurf/browser_window.h"
#include "netsurf/browser.h"
#include "netsurf/layout.h"
#include "amiga/font.h"

View File

@ -29,7 +29,7 @@
#include "utils/nsoption.h"
#include "netsurf/utf8.h"
#include "netsurf/layout.h"
#include "netsurf/browser_window.h"
#include "netsurf/browser.h"
#include "netsurf/plot_style.h"
#include "framebuffer/gui.h"

View File

@ -41,6 +41,7 @@
#include "netsurf/keypress.h"
#include "netsurf/url_db.h"
#include "netsurf/cookie_db.h"
#include "netsurf/browser.h"
#include "netsurf/browser_window.h"
#include "netsurf/misc.h"
#include "netsurf/netsurf.h"

View File

@ -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"
@ -61,6 +62,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.
*
@ -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),

View File

@ -71,29 +71,6 @@ static const char windowclassname_main[] = "nswsmainwindow";
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
*
@ -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) &&

42
include/netsurf/browser.h Normal file
View File

@ -0,0 +1,42 @@
/*
* Copyright 2003 Phil Mellor <monkeyson@users.sourceforge.net>
* Copyright 2006 James Bursa <bursa@users.sourceforge.net>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
* NetSurf is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* NetSurf is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file
* Browser interfaces.
*/
#ifndef NETSURF_BROWSER_H_
#define NETSURF_BROWSER_H_
/**
* Set the DPI of the browser.
*
* \param dpi The DPI to set.
*/
nserror browser_set_dpi(int dpi);
/**
* Get the browser DPI.
*
* \return The DPI in use.
*/
int browser_get_dpi(void);
#endif

View File

@ -22,8 +22,8 @@
* Browser window creation and manipulation interface.
*/
#ifndef _NETSURF_BROWSER_WINDOW_H_
#define _NETSURF_BROWSER_WINDOW_H_
#ifndef NETSURF_BROWSER_WINDOW_H_
#define NETSURF_BROWSER_WINDOW_H_
#include <stdbool.h>
#include <stdio.h>
@ -666,19 +666,6 @@ bool browser_window_is_frameset(struct browser_window *bw);
nserror browser_window_get_scrollbar_type(struct browser_window *bw,
browser_scrolling *h, browser_scrolling *v);
/**
* Set the DPI of the browser.
*
* \param dpi The DPI to set.
*/
nserror browser_set_dpi(int dpi);
/**
* Get the browser DPI.
*
* \return The DPI in use.
*/
int browser_get_dpi(void);
/**
* Dump debug info concerning the browser window's contents to file