netsurf: branch master updated. release/3.9-401-g5632c9c
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/5632c9c8c0e8ddf3b5945...
...commit http://git.netsurf-browser.org/netsurf.git/commit/5632c9c8c0e8ddf3b5945fd...
...tree http://git.netsurf-browser.org/netsurf.git/tree/5632c9c8c0e8ddf3b5945fd36...
The branch, master has been updated
via 5632c9c8c0e8ddf3b5945fd36b19dff7367851c5 (commit)
from bcc64cf263cd730ba8c13d31870528c160403e88 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=5632c9c8c0e8ddf3b59...
commit 5632c9c8c0e8ddf3b5945fd36b19dff7367851c5
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
stop bad unicode data from crashing teh test harness
instead of exploding if monkey returns a bad unicode string instead
a warning will be reported and the unicode decode performed with
character replacemnt instead
diff --git a/test/monkeyfarmer.py b/test/monkeyfarmer.py
index cbdda0c..4dfc41a 100644
--- a/test/monkeyfarmer.py
+++ b/test/monkeyfarmer.py
@@ -115,7 +115,11 @@ class MonkeyFarmer(asyncore.dispatcher):
self.buffer += cmd.encode('utf-8')
def monkey_says(self, line):
- line = line.decode('utf-8')
+ try:
+ line = line.decode('utf-8')
+ except UnicodeDecodeError:
+ print("WARNING: Unicode decode error")
+ line = line.decode('utf-8', 'replace')
if not self.quiet:
print("<<< {}".format(line))
self.discussion.append(("<", line))
-----------------------------------------------------------------------
Summary of changes:
test/monkeyfarmer.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/test/monkeyfarmer.py b/test/monkeyfarmer.py
index cbdda0c..4dfc41a 100644
--- a/test/monkeyfarmer.py
+++ b/test/monkeyfarmer.py
@@ -115,7 +115,11 @@ class MonkeyFarmer(asyncore.dispatcher):
self.buffer += cmd.encode('utf-8')
def monkey_says(self, line):
- line = line.decode('utf-8')
+ try:
+ line = line.decode('utf-8')
+ except UnicodeDecodeError:
+ print("WARNING: Unicode decode error")
+ line = line.decode('utf-8', 'replace')
if not self.quiet:
print("<<< {}".format(line))
self.discussion.append(("<", line))
--
NetSurf Browser
3 years, 8 months
netsurf: branch master updated. release/3.9-400-gbcc64cf
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/bcc64cf263cd730ba8c13...
...commit http://git.netsurf-browser.org/netsurf.git/commit/bcc64cf263cd730ba8c13d3...
...tree http://git.netsurf-browser.org/netsurf.git/tree/bcc64cf263cd730ba8c13d318...
The branch, master has been updated
via bcc64cf263cd730ba8c13d31870528c160403e88 (commit)
from fb4f1d28ba4d2b0935ac56a3d37ea9fa52c5de51 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=bcc64cf263cd730ba8c...
commit bcc64cf263cd730ba8c13d31870528c160403e88
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
split up mainpage docs and add section on testing
diff --git a/docs/development.md b/docs/development.md
new file mode 100644
index 0000000..773cf6b
--- /dev/null
+++ b/docs/development.md
@@ -0,0 +1,153 @@
+Development
+===========
+
+# Working with the team
+
+Generally it is sensible to check with the other developers if you are
+planning to make a change to NetSurf intended to be merged.
+
+We are often about on the IRC channel but failing that the developer
+mailing list is a good place to try.
+
+All the project sources are held in [public git repositories](http://source.netsurf-browser.org/)
+
+# Compilation environment
+
+Compiling a development edition of NetSurf requires a POSIX style
+environment. Typically this means a Linux based system although Free
+BSD, Open BSD, Mac OS X and Haiku all known to work.
+
+## Toolchains
+
+Compilation for non POSIX toolkits/frontends (e.g. RISC OS) generally
+relies upon a cross compilation environment which is generated using
+the makefiles found in our
+[toolchains](http://source.netsurf-browser.org/toolchains.git/)
+repository. These toolchains are built by the Continuous Integration
+(CI) system and the
+[results of the system](http://ci.netsurf-browser.org/builds/toolchains/)
+are published as a convenience.
+
+## Quick setup
+
+The [quick start guide](docs/quick-start.md) can be used to get a
+development environment setup quickly and uses the
+[env.sh](env_8sh_source.html) script the core team utilises.
+
+## Manual setup
+
+The Manual environment setup and compilation method is covered by the
+details in the [netsurf libraries](docs/netsurf-libraries.md) document
+for the core libraries and then one of the building documents for the
+specific frontend.
+
+- [Amiga Os cross](docs/building-AmigaCross.md) and [Amiga OS](docs/building-AmigaOS.md)
+- [Framebuffer](docs/building-Framebuffer.md)
+- [GTK](docs/building-GTK.md)
+- [Haiku (BeOS)](docs/building-Haiku.md)
+- [Windows Win32](docs/building-Windows.md)
+
+These documents are sometimes not completely up to
+date and the env.sh script should be considered canonical.
+
+# Logging
+
+The [logging](docs/logging.md) interface controls debug and error
+messages not output through the GUI.
+
+# Unit testing
+
+NetSurf [unit tests](docs/unit-testing.md) provide basic test coverage
+of many core parts of the browser code such as url parsing and utility
+functions.
+
+# Integration testing
+
+The monkey frontend is used to perform complex tests involving
+operating the browser as a user might (opening windows, navigating to
+websites and rendering the contents etc.)
+
+A test is written as a set of operations in a yaml file. A test can be
+run using the monkey_driver.py python script
+
+ $ ./test/monkey_driver.py -m ./nsmonkey -t test/monkey-tests/start-stop.yaml
+
+There are very few tests within the netsurf repository. The large
+majority of integration tests are held within the
+[netsurf-test](http://source.netsurf-browser.org/netsurf-test.git/)
+repository.
+
+To allow more effective use of these tests additional infrastructure
+has been constructed to allow groupings of tests to be run. This is
+used extensively by the CI system to perform integration testing on
+every commit.
+
+Each test is a member of a group and the tests within each group are
+run together. Groups are listed within division index files. To run
+the integration tests the monkey-see-monkey-do python script is
+used. It downloads the test plan for a division from the netsurf test
+infrastructrure and executes it.
+
+ $ ./test/monkey-see-monkey-do
+ Fetching tests...
+ Parsing tests...
+ Running tests...
+ Start group: initial
+ [ Basic checks that the browser can start and stop ]
+ => Run test: start-stop-no-js.yaml
+ => Run test: basic-navigation.yaml
+ => Run test: start-stop.yaml
+ Start group: no-networking
+ [ Tests that require no networking ]
+ => Run test: resource-scheme.yaml
+ Start group: ecmascript
+ [ ECMAScript tests ]
+ PASS
+
+
+# Documented API
+
+The NetSurf code makes use of Doxygen for code documentation.
+
+There are several documents which detail specific aspects of the
+codebase and APIs.
+
+## Core window
+
+The [core window API](docs/core-window-interface.md) allows frontends
+to use generic core code for user interface elements beyond the
+browser render.
+
+## Source object caching
+
+The [source object caching](docs/source-object-backing-store.md)
+provides a way for downloaded content to be kept on a persistent
+storage medium such as hard disc to make future retrieval of that
+content quickly.
+
+# Javascript
+
+Javascript provision is split into four parts:
+- An engine that takes source code and executes it.
+- Interfaces between the program and the web page.
+- Browser support to retrieve and manage the source code to be executed.
+- Browser support for the dispatch of events from user interface.
+
+## Library
+
+JavaScript is provided by integrating the duktape library. There are
+[instructions](docs/updating-duktape.md) on how to update the library.
+
+## Interface binding
+
+In order for javascript programs to to interact with the page contents
+it must use the Document Object Model (DOM) and Cascading Style Sheet
+Object Model (CSSOM) API.
+
+These interfaces are described using web Interface Description
+Language (IDL) within the relevant specifications
+(e.g. https://dom.spec.whatwg.org/).
+
+Each interface described by the webIDL must be bound (connected) to
+the browsers internal representation for the DOM or CSS, etc. The
+process of [writing bindings](docs/jsbinding.md) is ongoing.
diff --git a/docs/mainpage.md b/docs/mainpage.md
index 0700137..de5de73 100644
--- a/docs/mainpage.md
+++ b/docs/mainpage.md
@@ -3,163 +3,6 @@ NetSurf web browser
 some frontends are named for their OS instead of the
-toolkit e.g. RISC OS WIMP frontend is named riscos and the Windows
-win32 frontend is named windows.
-
-### amiga
-
-Frontend specific to the amiga
-
-### atari
-
-Frontend specific to the atari
-
-### beos
-
-Frontend specific to the Haiku OS
-
-### framebuffer
-
-There is a basic user guide for the[framebuffer](docs/using-framebuffer.md)
-
-### gtk
-
-Frontend that uses the GTK+2 or GTK+3 toolkit
-
-### monkey
-
-This is the internal unit test frontend.
-
-There is a basic user guide [monkey](docs/using-monkey.md)
-
-### riscos
-
-Frontend for the RISC OS WIMP toolkit.
-
-### windows
-
-Frontend which uses the Microsodt win32 GDI toolkit.
-
-## User configuration
-
-The behaviour of the browser can be changed from the defaults with a
-configuration file. The [core user options](docs/netsurf-options.md)
-of the browser are common to all versions and are augmented by each
-frontend in a specific manner.
-
-
-# Development
-
-## Working with the team
-
-Generally it is sensible to check with the other developers if you are
-planning to make a change to NetSurf intended to be merged.
-
-We are often about on the IRC channel but failing that the developer
-mailing list is a good place to try.
-
-All the project sources are held in [public git repositories](http://source.netsurf-browser.org/)
-
-## Compilation environment
-
-Compiling a development edition of NetSurf requires a POSIX style
-environment. Typically this means a Linux based system although Free
-BSD, Open BSD, Mac OS X and Haiku all known to work.
-
-## Toolchains
-
-Compilation for non POSIX toolkits/frontends (e.g. RISC OS) generally
-relies upon a cross compilation environment which is generated using
-the makefiles found in our
-[toolchains](http://source.netsurf-browser.org/toolchains.git/)
-repository. These toolchains are built by the Continuous Integration
-(CI) system and the
-[results of the system](http://ci.netsurf-browser.org/builds/toolchains/)
-are published as a convenience.
-
-## Quick setup
-
-The [quick start guide](docs/quick-start.md) can be used to get a
-development environment setup quickly and uses the
-[env.sh](env_8sh_source.html) script the core team utilises.
-
-## Manual setup
-
-The Manual environment setup and compilation method is covered by the
-details in the [netsurf libraries](docs/netsurf-libraries.md) document
-for the core libraries and then one of the building documents for the
-specific frontend.
-
-- [Amiga Os cross](docs/building-AmigaCross.md) and [Amiga OS](docs/building-AmigaOS.md)
-- [Framebuffer](docs/building-Framebuffer.md)
-- [GTK](docs/building-GTK.md)
-- [Haiku (BeOS)](docs/building-Haiku.md)
-- [Windows Win32](docs/building-Windows.md)
-
-These documents are sometimes not completely up to
-date and the env.sh script should be considered canonical.
-
-## Logging
-
-The [logging](docs/logging.md) interface controls debug and error
-messages not output through the GUI.
-
-## Documented API
-
-The NetSurf code makes use of Doxygen for code documentation.
-
-There are several documents which detail specific aspects of the
-codebase and APIs.
-
-### Core window
-
-The [core window API](docs/core-window-interface.md) allows frontends
-to use generic core code for user interface elements beyond the
-browser render.
-
-### Source object caching
-
-The [source object caching](docs/source-object-backing-store.md)
-provides a way for downloaded content to be kept on a persistent
-storage medium such as hard disc to make future retrieval of that
-content quickly.
-
-## Javascript
-
-Javascript provision is split into four parts:
-- An engine that takes source code and executes it.
-- Interfaces between the program and the web page.
-- Browser support to retrive and manage the source code to be executed.
-- Browser support for the dispatch of events from user interface.
-
-### Library
-
-JavaScript is provided by integrating the duktape library. There are
-[instructions](docs/updating-duktape.md) on how to update the library.
-
-### Interface binding
-
-In order for javascript programs to to interact with the page contents
-it must use the Document Object Model (DOM) and Cascading Style Sheet
-Object Model (CSSOM) API.
-
-These interfaces are described using web Interface Description
-Language (IDL) within the relevant specifications
-(e.g. https://dom.spec.whatwg.org/).
-
-Each interface described by the webIDL must be bound (connected) to
-the browsers internal representation for the DOM or CSS, etc. The
-process of [writing bindings](docs/jsbinding.md) is ongoing.
+# [Project](docs/project.md)
+# [User Interface](docs/user-interface.md)
+# [Development](docs/development.md)
diff --git a/docs/project.md b/docs/project.md
new file mode 100644
index 0000000..7fa76d9
--- /dev/null
+++ b/docs/project.md
@@ -0,0 +1,17 @@
+NetSurf Project
+===============
+
+The NetSurf project is developing a document browser for the World
+Wide Web. It was started in 2002 on the RISC OS platform and has
+support for numerous operating systems and graphical toolkits.
+
+NetSurf is very modular and built from many component libraries which
+provide functionality from GIF image format decoding (libnsgif) to
+HTML document object model handling (libdom).
+
+NetSurf browser is open source and is licensed under the GPLv2 (with
+OpenSSL exception). Many of the supporting libraries are under a MIT
+licence.
+
+The [main website](http://www.netsurf-browser.org/) contains links to
+other resources and additional information.
diff --git a/docs/unit-testing b/docs/unit-testing
deleted file mode 100644
index 49d82ed..0000000
--- a/docs/unit-testing
+++ /dev/null
@@ -1,166 +0,0 @@
-NetSurf Unit Testing
-====================
-
-Overview
---------
-
-NetSurf has unit tests integrated in the test directory. These tests
-use the check unit test framework for C [1].
-
-The tests are in a logical hierachy of "suite", "case" and individual
-"test". Historicaly we have split suites of tests into separate test
-programs although the framework does not madate this and some test
-programs contain more than one suite.
-
-
-Execution
----------
-
-The test programs are executed by using the standard "test" target
-from the top level make invocation. The "coverage" target additionally
-generates code coverage reports allowing visibility on how much of a
-code module is being exercised.
-
-The check library must be installed to run the tests and the CI system
-automatically executes all enabled tests and generates coverage
-reports for each commit.
-
-Adding tests
-------------
-
-The test/Makefile defines each indiviadual test program that should be
-built and executed in the TESTS variable.
-
-The test program source files are defined in a xxx_SRCS variable and
-the make rules will then ensure the target program is built and
-executed.
-
-Each individual test program requires a main function which creates
-one (or more) suites. The suites are added to a test runner and then
-executed and the results reported.
-
-int main(int argc, char **argv)
-{
- int number_failed;
- SRunner *sr;
-
- sr = srunner_create(foo_suite_create());
- //srunner_add_suite(sr, bar_suite_create());
-
- srunner_run_all(sr, CK_ENV);
-
- number_failed = srunner_ntests_failed(sr);
- srunner_free(sr);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
-
-Suite creation is done with a sub function to logically split suite
-code into sub modules. Each suite has test cases added to it.
-
-Suite *foo_suite_create(void)
-{
- Suite *s;
- s = suite_create("foo");
-
- suite_add_tcase(s, baz_case_create());
- suite_add_tcase(s, qux_case_create());
-
- return s;
-}
-
-Test cases include the actual tests to be performed within each case.
-
-TCase *baz_case_create(void)
-{
- TCase *tc;
- tc = tcase_create("Baz");
-
- tcase_add_test(tc, xxyz_test);
- tcase_add_test(tc, zzyx_test);
-
- return tc;
-}
-
-A test case may optionally have a fixture which is code that is
-executed before and after each test case. Unchecked fixtures are
-executed once before the test process forks for each test whereas
-checked fixtures are executed for each and every test.
-
-static void fixture_setup(void)
-{
-}
-
-static void fixture_teardown(void)
-{
-}
-
-TCase *qux_case_create(void)
-{
- TCase *tc;
-
- /* Matching entry tests */
- tc = tcase_create("Match");
-
- tcase_add_checked_fixture(tc,
- fixture_setup,
- fixture_teardown);
-
- tcase_add_test(tc, zzz_test);
-
- return tc;
-}
-
-Additionally test cases can contain tests executed in a loop. The test
-recives a single integer as a parameter named _i which iterates
-between values specified in the case setup.
-
-TCase *baz_case_create(void)
-{
- TCase *tc;
- tc = tcase_create("Baz");
-
- tcase_add_loop_test(tc, looping_test, 0, 5);
-
- return tc;
-}
-
-It is also possible to create tests which will generate a signal. The
-most commonly used of these is to check asserts in API calls.
-
-TCase *baz_case_create(void)
-{
- TCase *tc;
- tc = tcase_create("Baz");
-
- tcase_add_test_raise_signal(tc, assert_test, 6);
-
- return tc;
-}
-
-
-Actual test code is self contained in a function which uses the
-ck_assert macros to test results. The check framework requires each
-test to use the START_TEST and END_TEST macros when definig them.
-
-/**
- * url access leaf test
- */
-START_TEST(nsurl_access_leaf_test)
-{
- nserror err;
- nsurl *res_url;
- const struct test_triplets *tst = &access_tests[_i];
-
- /* not testing create, this should always succeed */
- err = nsurl_create(tst->test1, &res_url);
- ck_assert(err == NSERROR_OK);
-
- ck_assert_str_eq(nsurl_access_leaf(res_url), tst->res);
-
- nsurl_unref(res_url);
-}
-END_TEST
-
-
-[1] https://libcheck.github.io/check/
diff --git a/docs/unit-testing.md b/docs/unit-testing.md
new file mode 100644
index 0000000..49d82ed
--- /dev/null
+++ b/docs/unit-testing.md
@@ -0,0 +1,166 @@
+NetSurf Unit Testing
+====================
+
+Overview
+--------
+
+NetSurf has unit tests integrated in the test directory. These tests
+use the check unit test framework for C [1].
+
+The tests are in a logical hierachy of "suite", "case" and individual
+"test". Historicaly we have split suites of tests into separate test
+programs although the framework does not madate this and some test
+programs contain more than one suite.
+
+
+Execution
+---------
+
+The test programs are executed by using the standard "test" target
+from the top level make invocation. The "coverage" target additionally
+generates code coverage reports allowing visibility on how much of a
+code module is being exercised.
+
+The check library must be installed to run the tests and the CI system
+automatically executes all enabled tests and generates coverage
+reports for each commit.
+
+Adding tests
+------------
+
+The test/Makefile defines each indiviadual test program that should be
+built and executed in the TESTS variable.
+
+The test program source files are defined in a xxx_SRCS variable and
+the make rules will then ensure the target program is built and
+executed.
+
+Each individual test program requires a main function which creates
+one (or more) suites. The suites are added to a test runner and then
+executed and the results reported.
+
+int main(int argc, char **argv)
+{
+ int number_failed;
+ SRunner *sr;
+
+ sr = srunner_create(foo_suite_create());
+ //srunner_add_suite(sr, bar_suite_create());
+
+ srunner_run_all(sr, CK_ENV);
+
+ number_failed = srunner_ntests_failed(sr);
+ srunner_free(sr);
+
+ return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
+}
+
+Suite creation is done with a sub function to logically split suite
+code into sub modules. Each suite has test cases added to it.
+
+Suite *foo_suite_create(void)
+{
+ Suite *s;
+ s = suite_create("foo");
+
+ suite_add_tcase(s, baz_case_create());
+ suite_add_tcase(s, qux_case_create());
+
+ return s;
+}
+
+Test cases include the actual tests to be performed within each case.
+
+TCase *baz_case_create(void)
+{
+ TCase *tc;
+ tc = tcase_create("Baz");
+
+ tcase_add_test(tc, xxyz_test);
+ tcase_add_test(tc, zzyx_test);
+
+ return tc;
+}
+
+A test case may optionally have a fixture which is code that is
+executed before and after each test case. Unchecked fixtures are
+executed once before the test process forks for each test whereas
+checked fixtures are executed for each and every test.
+
+static void fixture_setup(void)
+{
+}
+
+static void fixture_teardown(void)
+{
+}
+
+TCase *qux_case_create(void)
+{
+ TCase *tc;
+
+ /* Matching entry tests */
+ tc = tcase_create("Match");
+
+ tcase_add_checked_fixture(tc,
+ fixture_setup,
+ fixture_teardown);
+
+ tcase_add_test(tc, zzz_test);
+
+ return tc;
+}
+
+Additionally test cases can contain tests executed in a loop. The test
+recives a single integer as a parameter named _i which iterates
+between values specified in the case setup.
+
+TCase *baz_case_create(void)
+{
+ TCase *tc;
+ tc = tcase_create("Baz");
+
+ tcase_add_loop_test(tc, looping_test, 0, 5);
+
+ return tc;
+}
+
+It is also possible to create tests which will generate a signal. The
+most commonly used of these is to check asserts in API calls.
+
+TCase *baz_case_create(void)
+{
+ TCase *tc;
+ tc = tcase_create("Baz");
+
+ tcase_add_test_raise_signal(tc, assert_test, 6);
+
+ return tc;
+}
+
+
+Actual test code is self contained in a function which uses the
+ck_assert macros to test results. The check framework requires each
+test to use the START_TEST and END_TEST macros when definig them.
+
+/**
+ * url access leaf test
+ */
+START_TEST(nsurl_access_leaf_test)
+{
+ nserror err;
+ nsurl *res_url;
+ const struct test_triplets *tst = &access_tests[_i];
+
+ /* not testing create, this should always succeed */
+ err = nsurl_create(tst->test1, &res_url);
+ ck_assert(err == NSERROR_OK);
+
+ ck_assert_str_eq(nsurl_access_leaf(res_url), tst->res);
+
+ nsurl_unref(res_url);
+}
+END_TEST
+
+
+[1] https://libcheck.github.io/check/
diff --git a/docs/user-interface.md b/docs/user-interface.md
new file mode 100644
index 0000000..5d7673f
--- /dev/null
+++ b/docs/user-interface.md
@@ -0,0 +1,59 @@
+User Interface
+==============
+
+Netsurf is divided into a series of frontends which provide a user
+interface around common core functionality. Each frontend is a
+distinct implementation for a specific GUI toolkit.
+
+Because of this the user interface has different features in
+each frontend allowing the browser to be a native application.
+
+# Frontends
+
+As GUI toolkits are often applicable to a single Operating
+System (OS) some frontends are named for their OS instead of the
+toolkit e.g. RISC OS WIMP frontend is named riscos and the Windows
+win32 frontend is named windows.
+
+## amiga
+
+Frontend specific to the amiga
+
+## atari
+
+Frontend specific to the atari
+
+## beos
+
+Frontend specific to the Haiku OS
+
+## framebuffer
+
+There is a basic user guide for the[framebuffer](docs/using-framebuffer.md)
+
+## gtk
+
+Frontend that uses the GTK+2 or GTK+3 toolkit
+
+## monkey
+
+This is the internal unit test frontend.
+
+There is a basic user guide [monkey](docs/using-monkey.md)
+
+## riscos
+
+Frontend for the RISC OS WIMP toolkit.
+
+## windows
+
+Frontend which uses the Microsodt win32 GDI toolkit.
+
+# User configuration
+
+The behaviour of the browser can be changed from the defaults with a
+configuration file. The [core user options](docs/netsurf-options.md)
+of the browser are common to all versions and are augmented by each
+frontend in a specific manner.
+
+
-----------------------------------------------------------------------
Summary of changes:
docs/{mainpage.md => development.md} | 136 ++++++++++++--------------
docs/mainpage.md | 163 +-------------------------------
docs/project.md | 17 ++++
docs/{unit-testing => unit-testing.md} | 0
docs/user-interface.md | 59 ++++++++++++
5 files changed, 141 insertions(+), 234 deletions(-)
copy docs/{mainpage.md => development.md} (61%)
create mode 100644 docs/project.md
rename docs/{unit-testing => unit-testing.md} (100%)
create mode 100644 docs/user-interface.md
diff --git a/docs/mainpage.md b/docs/development.md
similarity index 61%
copy from docs/mainpage.md
copy to docs/development.md
index 0700137..773cf6b 100644
--- a/docs/mainpage.md
+++ b/docs/development.md
@@ -1,69 +1,7 @@
-NetSurf web browser
-===================
+Development
+===========
- some frontends are named for their OS instead of the
-toolkit e.g. RISC OS WIMP frontend is named riscos and the Windows
-win32 frontend is named windows.
-
-### amiga
-
-Frontend specific to the amiga
-
-### atari
-
-Frontend specific to the atari
-
-### beos
-
-Frontend specific to the Haiku OS
-
-### framebuffer
-
-There is a basic user guide for the[framebuffer](docs/using-framebuffer.md)
-
-### gtk
-
-Frontend that uses the GTK+2 or GTK+3 toolkit
-
-### monkey
-
-This is the internal unit test frontend.
-
-There is a basic user guide [monkey](docs/using-monkey.md)
-
-### riscos
-
-Frontend for the RISC OS WIMP toolkit.
-
-### windows
-
-Frontend which uses the Microsodt win32 GDI toolkit.
-
-## User configuration
-
-The behaviour of the browser can be changed from the defaults with a
-configuration file. The [core user options](docs/netsurf-options.md)
-of the browser are common to all versions and are augmented by each
-frontend in a specific manner.
-
-
-# Development
-
-## Working with the team
+# Working with the team
Generally it is sensible to check with the other developers if you are
planning to make a change to NetSurf intended to be merged.
@@ -73,7 +11,7 @@ mailing list is a good place to try.
All the project sources are held in [public git repositories](http://source.netsurf-browser.org/)
-## Compilation environment
+# Compilation environment
Compiling a development edition of NetSurf requires a POSIX style
environment. Typically this means a Linux based system although Free
@@ -112,45 +50,95 @@ specific frontend.
These documents are sometimes not completely up to
date and the env.sh script should be considered canonical.
-## Logging
+# Logging
The [logging](docs/logging.md) interface controls debug and error
messages not output through the GUI.
-## Documented API
+# Unit testing
+
+NetSurf [unit tests](docs/unit-testing.md) provide basic test coverage
+of many core parts of the browser code such as url parsing and utility
+functions.
+
+# Integration testing
+
+The monkey frontend is used to perform complex tests involving
+operating the browser as a user might (opening windows, navigating to
+websites and rendering the contents etc.)
+
+A test is written as a set of operations in a yaml file. A test can be
+run using the monkey_driver.py python script
+
+ $ ./test/monkey_driver.py -m ./nsmonkey -t test/monkey-tests/start-stop.yaml
+
+There are very few tests within the netsurf repository. The large
+majority of integration tests are held within the
+[netsurf-test](http://source.netsurf-browser.org/netsurf-test.git/)
+repository.
+
+To allow more effective use of these tests additional infrastructure
+has been constructed to allow groupings of tests to be run. This is
+used extensively by the CI system to perform integration testing on
+every commit.
+
+Each test is a member of a group and the tests within each group are
+run together. Groups are listed within division index files. To run
+the integration tests the monkey-see-monkey-do python script is
+used. It downloads the test plan for a division from the netsurf test
+infrastructrure and executes it.
+
+ $ ./test/monkey-see-monkey-do
+ Fetching tests...
+ Parsing tests...
+ Running tests...
+ Start group: initial
+ [ Basic checks that the browser can start and stop ]
+ => Run test: start-stop-no-js.yaml
+ => Run test: basic-navigation.yaml
+ => Run test: start-stop.yaml
+ Start group: no-networking
+ [ Tests that require no networking ]
+ => Run test: resource-scheme.yaml
+ Start group: ecmascript
+ [ ECMAScript tests ]
+ PASS
+
+
+# Documented API
The NetSurf code makes use of Doxygen for code documentation.
There are several documents which detail specific aspects of the
codebase and APIs.
-### Core window
+## Core window
The [core window API](docs/core-window-interface.md) allows frontends
to use generic core code for user interface elements beyond the
browser render.
-### Source object caching
+## Source object caching
The [source object caching](docs/source-object-backing-store.md)
provides a way for downloaded content to be kept on a persistent
storage medium such as hard disc to make future retrieval of that
content quickly.
-## Javascript
+# Javascript
Javascript provision is split into four parts:
- An engine that takes source code and executes it.
- Interfaces between the program and the web page.
-- Browser support to retrive and manage the source code to be executed.
+- Browser support to retrieve and manage the source code to be executed.
- Browser support for the dispatch of events from user interface.
-### Library
+## Library
JavaScript is provided by integrating the duktape library. There are
[instructions](docs/updating-duktape.md) on how to update the library.
-### Interface binding
+## Interface binding
In order for javascript programs to to interact with the page contents
it must use the Document Object Model (DOM) and Cascading Style Sheet
diff --git a/docs/mainpage.md b/docs/mainpage.md
index 0700137..de5de73 100644
--- a/docs/mainpage.md
+++ b/docs/mainpage.md
@@ -3,163 +3,6 @@ NetSurf web browser
 some frontends are named for their OS instead of the
-toolkit e.g. RISC OS WIMP frontend is named riscos and the Windows
-win32 frontend is named windows.
-
-### amiga
-
-Frontend specific to the amiga
-
-### atari
-
-Frontend specific to the atari
-
-### beos
-
-Frontend specific to the Haiku OS
-
-### framebuffer
-
-There is a basic user guide for the[framebuffer](docs/using-framebuffer.md)
-
-### gtk
-
-Frontend that uses the GTK+2 or GTK+3 toolkit
-
-### monkey
-
-This is the internal unit test frontend.
-
-There is a basic user guide [monkey](docs/using-monkey.md)
-
-### riscos
-
-Frontend for the RISC OS WIMP toolkit.
-
-### windows
-
-Frontend which uses the Microsodt win32 GDI toolkit.
-
-## User configuration
-
-The behaviour of the browser can be changed from the defaults with a
-configuration file. The [core user options](docs/netsurf-options.md)
-of the browser are common to all versions and are augmented by each
-frontend in a specific manner.
-
-
-# Development
-
-## Working with the team
-
-Generally it is sensible to check with the other developers if you are
-planning to make a change to NetSurf intended to be merged.
-
-We are often about on the IRC channel but failing that the developer
-mailing list is a good place to try.
-
-All the project sources are held in [public git repositories](http://source.netsurf-browser.org/)
-
-## Compilation environment
-
-Compiling a development edition of NetSurf requires a POSIX style
-environment. Typically this means a Linux based system although Free
-BSD, Open BSD, Mac OS X and Haiku all known to work.
-
-## Toolchains
-
-Compilation for non POSIX toolkits/frontends (e.g. RISC OS) generally
-relies upon a cross compilation environment which is generated using
-the makefiles found in our
-[toolchains](http://source.netsurf-browser.org/toolchains.git/)
-repository. These toolchains are built by the Continuous Integration
-(CI) system and the
-[results of the system](http://ci.netsurf-browser.org/builds/toolchains/)
-are published as a convenience.
-
-## Quick setup
-
-The [quick start guide](docs/quick-start.md) can be used to get a
-development environment setup quickly and uses the
-[env.sh](env_8sh_source.html) script the core team utilises.
-
-## Manual setup
-
-The Manual environment setup and compilation method is covered by the
-details in the [netsurf libraries](docs/netsurf-libraries.md) document
-for the core libraries and then one of the building documents for the
-specific frontend.
-
-- [Amiga Os cross](docs/building-AmigaCross.md) and [Amiga OS](docs/building-AmigaOS.md)
-- [Framebuffer](docs/building-Framebuffer.md)
-- [GTK](docs/building-GTK.md)
-- [Haiku (BeOS)](docs/building-Haiku.md)
-- [Windows Win32](docs/building-Windows.md)
-
-These documents are sometimes not completely up to
-date and the env.sh script should be considered canonical.
-
-## Logging
-
-The [logging](docs/logging.md) interface controls debug and error
-messages not output through the GUI.
-
-## Documented API
-
-The NetSurf code makes use of Doxygen for code documentation.
-
-There are several documents which detail specific aspects of the
-codebase and APIs.
-
-### Core window
-
-The [core window API](docs/core-window-interface.md) allows frontends
-to use generic core code for user interface elements beyond the
-browser render.
-
-### Source object caching
-
-The [source object caching](docs/source-object-backing-store.md)
-provides a way for downloaded content to be kept on a persistent
-storage medium such as hard disc to make future retrieval of that
-content quickly.
-
-## Javascript
-
-Javascript provision is split into four parts:
-- An engine that takes source code and executes it.
-- Interfaces between the program and the web page.
-- Browser support to retrive and manage the source code to be executed.
-- Browser support for the dispatch of events from user interface.
-
-### Library
-
-JavaScript is provided by integrating the duktape library. There are
-[instructions](docs/updating-duktape.md) on how to update the library.
-
-### Interface binding
-
-In order for javascript programs to to interact with the page contents
-it must use the Document Object Model (DOM) and Cascading Style Sheet
-Object Model (CSSOM) API.
-
-These interfaces are described using web Interface Description
-Language (IDL) within the relevant specifications
-(e.g. https://dom.spec.whatwg.org/).
-
-Each interface described by the webIDL must be bound (connected) to
-the browsers internal representation for the DOM or CSS, etc. The
-process of [writing bindings](docs/jsbinding.md) is ongoing.
+# [Project](docs/project.md)
+# [User Interface](docs/user-interface.md)
+# [Development](docs/development.md)
diff --git a/docs/project.md b/docs/project.md
new file mode 100644
index 0000000..7fa76d9
--- /dev/null
+++ b/docs/project.md
@@ -0,0 +1,17 @@
+NetSurf Project
+===============
+
+The NetSurf project is developing a document browser for the World
+Wide Web. It was started in 2002 on the RISC OS platform and has
+support for numerous operating systems and graphical toolkits.
+
+NetSurf is very modular and built from many component libraries which
+provide functionality from GIF image format decoding (libnsgif) to
+HTML document object model handling (libdom).
+
+NetSurf browser is open source and is licensed under the GPLv2 (with
+OpenSSL exception). Many of the supporting libraries are under a MIT
+licence.
+
+The [main website](http://www.netsurf-browser.org/) contains links to
+other resources and additional information.
diff --git a/docs/unit-testing b/docs/unit-testing.md
similarity index 100%
rename from docs/unit-testing
rename to docs/unit-testing.md
diff --git a/docs/user-interface.md b/docs/user-interface.md
new file mode 100644
index 0000000..5d7673f
--- /dev/null
+++ b/docs/user-interface.md
@@ -0,0 +1,59 @@
+User Interface
+==============
+
+Netsurf is divided into a series of frontends which provide a user
+interface around common core functionality. Each frontend is a
+distinct implementation for a specific GUI toolkit.
+
+Because of this the user interface has different features in
+each frontend allowing the browser to be a native application.
+
+# Frontends
+
+As GUI toolkits are often applicable to a single Operating
+System (OS) some frontends are named for their OS instead of the
+toolkit e.g. RISC OS WIMP frontend is named riscos and the Windows
+win32 frontend is named windows.
+
+## amiga
+
+Frontend specific to the amiga
+
+## atari
+
+Frontend specific to the atari
+
+## beos
+
+Frontend specific to the Haiku OS
+
+## framebuffer
+
+There is a basic user guide for the[framebuffer](docs/using-framebuffer.md)
+
+## gtk
+
+Frontend that uses the GTK+2 or GTK+3 toolkit
+
+## monkey
+
+This is the internal unit test frontend.
+
+There is a basic user guide [monkey](docs/using-monkey.md)
+
+## riscos
+
+Frontend for the RISC OS WIMP toolkit.
+
+## windows
+
+Frontend which uses the Microsodt win32 GDI toolkit.
+
+# User configuration
+
+The behaviour of the browser can be changed from the defaults with a
+configuration file. The [core user options](docs/netsurf-options.md)
+of the browser are common to all versions and are augmented by each
+frontend in a specific manner.
+
+
--
NetSurf Browser
3 years, 8 months
netsurf: branch master updated. release/3.9-399-gfb4f1d2
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/fb4f1d28ba4d2b0935ac5...
...commit http://git.netsurf-browser.org/netsurf.git/commit/fb4f1d28ba4d2b0935ac56a...
...tree http://git.netsurf-browser.org/netsurf.git/tree/fb4f1d28ba4d2b0935ac56a3d...
The branch, master has been updated
via fb4f1d28ba4d2b0935ac56a3d37ea9fa52c5de51 (commit)
via 55ba27c68f1664e8a6a356e45c6c9ce9c7bdded9 (commit)
via 3fdbef0566a4310dc2567c101b38e9c1667d883e (commit)
from fd510b27eee7d8d146ddf1a54a0a98b2ba61f27f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=fb4f1d28ba4d2b0935a...
commit fb4f1d28ba4d2b0935ac56a3d37ea9fa52c5de51
Author: John-Mark Bell <jmb(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
fix parent pointer use after free in RISC OS dialog handling
diff --git a/frontends/riscos/dialog.c b/frontends/riscos/dialog.c
index 8a907eb..f0bcb59 100644
--- a/frontends/riscos/dialog.c
+++ b/frontends/riscos/dialog.c
@@ -335,12 +335,16 @@ void ro_gui_dialog_close(wimp_w close)
{
int i;
wimp_caret caret;
+ wimp_w parent = -1;
os_error *error;
/* Check if we're a persistent window */
for (i = 0; i < MAX_PERSISTENT; i++) {
if (persistent_dialog[i].dialog == close) {
/* We are => invalidate record */
+ if (persistent_dialog[i].parent != NULL) {
+ parent = persistent_dialog[i].parent;
+ }
persistent_dialog[i].parent = NULL;
persistent_dialog[i].dialog = NULL;
break;
@@ -363,7 +367,7 @@ void ro_gui_dialog_close(wimp_w close)
/* Check if we are a persistent window */
if (i < MAX_PERSISTENT) {
error = xwimp_set_caret_position(
- persistent_dialog[i].parent,
+ parent,
wimp_ICON_WINDOW, -100, -100,
32, -1);
/* parent may have been closed first */
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=55ba27c68f1664e8a6a...
commit 55ba27c68f1664e8a6a356e45c6c9ce9c7bdded9
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
re-order config include so strcasecmp is correctly detected on RISC OS/win32
diff --git a/content/handlers/html/html_css.c b/content/handlers/html/html_css.c
index 5d9987d..23d51f1 100644
--- a/content/handlers/html/html_css.c
+++ b/content/handlers/html/html_css.c
@@ -21,6 +21,8 @@
* Processing for html content css operations.
*/
+#include "utils/config.h"
+
#define _GNU_SOURCE /* strcasestr needs this for string.h */
#include <assert.h>
@@ -30,7 +32,6 @@
#include <strings.h>
#include <stdlib.h>
-#include "utils/config.h"
#include "utils/nsoption.h"
#include "utils/corestrings.h"
#include "utils/log.h"
diff --git a/desktop/treeview.c b/desktop/treeview.c
index e8b4a14..cb4ca80 100644
--- a/desktop/treeview.c
+++ b/desktop/treeview.c
@@ -22,11 +22,11 @@
* Treeview handling implementation.
*/
-#define _GNU_SOURCE /* strcasestr needs this for string.h */
+#include "utils/config.h"
+#define _GNU_SOURCE /* strcasestr needs this for string.h */
#include <string.h>
-#include "utils/config.h"
#include "utils/utils.h"
#include "utils/log.h"
#include "utils/nsurl.h"
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=3fdbef0566a4310dc25...
commit 3fdbef0566a4310dc2567c101b38e9c1667d883e
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
remove unused render_resample option from beos, gtk and monkey frontends
diff --git a/docs/netsurf-fb.1 b/docs/netsurf-fb.1
index e9d721c..aa30ab3 100644
--- a/docs/netsurf-fb.1
+++ b/docs/netsurf-fb.1
@@ -302,9 +302,6 @@ Override CSS sys_colour_WindowFrame colour.
.B \-\-sys_colour_WindowText
Override CSS sys_colour_WindowText colour.
.TP
-.B \-\-render_resample
-render resample
-.TP
.B \-\-downloads_clear
downloads clear
.TP
diff --git a/docs/netsurf-gtk.1 b/docs/netsurf-gtk.1
index daa0148..10f0ae5 100644
--- a/docs/netsurf-gtk.1
+++ b/docs/netsurf-gtk.1
@@ -205,8 +205,6 @@ Override CSS sys_colour_Window colour.
Override CSS sys_colour_WindowFrame colour.
.It Fl -sys_colour_WindowText
Override CSS sys_colour_WindowText colour.
-.It Fl -render_resample
-render resample
.It Fl -downloads_clear
downloads clear
.It Fl -request_overwrite
diff --git a/frontends/beos/options.h b/frontends/beos/options.h
index 40d23a3..f959442 100644
--- a/frontends/beos/options.h
+++ b/frontends/beos/options.h
@@ -18,13 +18,12 @@
*/
-#ifndef _NETSURF_BEOS_OPTIONS_H_
-#define _NETSURF_BEOS_OPTIONS_H_
+#ifndef NETSURF_BEOS_OPTIONS_H_
+#define NETSURF_BEOS_OPTIONS_H_
/* currently nothing here */
#endif
-NSOPTION_BOOL(render_resample, false)
NSOPTION_STRING(url_file, NULL)
diff --git a/frontends/gtk/options.h b/frontends/gtk/options.h
index 81457ef..7fd79d7 100644
--- a/frontends/gtk/options.h
+++ b/frontends/gtk/options.h
@@ -23,9 +23,6 @@
#endif
-/* High quality image scaling */
-NSOPTION_BOOL(render_resample, true)
-
/* clear downloads */
NSOPTION_BOOL(downloads_clear, false)
diff --git a/frontends/gtk/preferences.c b/frontends/gtk/preferences.c
index 5fe9450..8ec41ca 100644
--- a/frontends/gtk/preferences.c
+++ b/frontends/gtk/preferences.c
@@ -412,9 +412,6 @@ TOGGLEBUTTON_SIGNALS(checkHideAdverts, block_advertisements)
/* enable javascript */
TOGGLEBUTTON_SIGNALS(checkEnableJavascript, enable_javascript)
-/* high quality image scaling */
-TOGGLEBUTTON_SIGNALS(checkResampleImages, render_resample)
-
/* load and display of images */
G_MODULE_EXPORT void
nsgtk_preferences_comboboxLoadImages_changed(GtkComboBox *combo,
diff --git a/frontends/gtk/res/options.gtk2.ui b/frontends/gtk/res/options.gtk2.ui
index f30abeb..ed596c0 100644
--- a/frontends/gtk/res/options.gtk2.ui
+++ b/frontends/gtk/res/options.gtk2.ui
@@ -1143,22 +1143,6 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="checkResampleImages">
- <property name="label" translatable="yes">preferencesControlHigh</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="nsgtk_preferences_checkResampleImages_toggled" swapped="no"/>
- <signal name="realize" handler="nsgtk_preferences_checkResampleImages_realize" swapped="no"/>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">3</property>
- </packing>
- </child>
- <child>
<object class="GtkHBox" id="hbox8">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -1199,7 +1183,7 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">4</property>
+ <property name="position">3</property>
</packing>
</child>
</object>
diff --git a/frontends/gtk/res/options.gtk3.ui b/frontends/gtk/res/options.gtk3.ui
index b74846c..af0dd5c 100644
--- a/frontends/gtk/res/options.gtk3.ui
+++ b/frontends/gtk/res/options.gtk3.ui
@@ -983,26 +983,6 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="checkResampleImages">
- <property name="label" translatable="yes">preferencesControlHigh</property>
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="halign">start</property>
- <property name="use_action_appearance">False</property>
- <property name="xalign">0.5</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="nsgtk_preferences_checkResampleImages_toggled" swapped="no"/>
- <signal name="realize" handler="nsgtk_preferences_checkResampleImages_realize" swapped="no"/>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">3</property>
- </packing>
- </child>
- <child>
<object class="GtkHBox" id="hbox8">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -1044,7 +1024,7 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">4</property>
+ <property name="position">3</property>
</packing>
</child>
</object>
diff --git a/frontends/monkey/options.h b/frontends/monkey/options.h
index a39e54b..8f6dd8b 100644
--- a/frontends/monkey/options.h
+++ b/frontends/monkey/options.h
@@ -16,14 +16,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _NETSURF_MONKEY_OPTIONS_H_
-#define _NETSURF_MONKEY_OPTIONS_H_
+#ifndef NETSURF_MONKEY_OPTIONS_H_
+#define NETSURF_MONKEY_OPTIONS_H_
/* currently nothing here */
#endif
-NSOPTION_BOOL(render_resample, true)
NSOPTION_BOOL(downloads_clear, false)
NSOPTION_BOOL(request_overwrite, true)
NSOPTION_STRING(downloads_directory, NULL)
diff --git a/test/data/Choices b/test/data/Choices
index 8ca4bec..a1fc15b 100644
--- a/test/data/Choices
+++ b/test/data/Choices
@@ -99,7 +99,6 @@ sys_colour_ThreeDShadow:000000
sys_colour_Window:000000
sys_colour_WindowFrame:000000
sys_colour_WindowText:000000
-render_resample:1
downloads_clear:0
request_overwrite:1
downloads_directory:/home/vince
diff --git a/test/data/Choices-all b/test/data/Choices-all
index 2742339..b430db5 100644
--- a/test/data/Choices-all
+++ b/test/data/Choices-all
@@ -95,7 +95,6 @@ sys_colour_WindowFrame:4e4e4e
sys_colour_WindowText:000000
log_filter:level:WARNING
verbose_filter:level:DEBUG
-render_resample:1
downloads_clear:0
request_overwrite:1
downloads_directory:/home/vince
-----------------------------------------------------------------------
Summary of changes:
content/handlers/html/html_css.c | 3 ++-
desktop/treeview.c | 4 ++--
docs/netsurf-fb.1 | 3 ---
docs/netsurf-gtk.1 | 2 --
frontends/beos/options.h | 5 ++---
frontends/gtk/options.h | 3 ---
frontends/gtk/preferences.c | 3 ---
frontends/gtk/res/options.gtk2.ui | 18 +-----------------
frontends/gtk/res/options.gtk3.ui | 22 +---------------------
frontends/monkey/options.h | 5 ++---
frontends/riscos/dialog.c | 6 +++++-
test/data/Choices | 1 -
test/data/Choices-all | 1 -
13 files changed, 15 insertions(+), 61 deletions(-)
diff --git a/content/handlers/html/html_css.c b/content/handlers/html/html_css.c
index 5d9987d..23d51f1 100644
--- a/content/handlers/html/html_css.c
+++ b/content/handlers/html/html_css.c
@@ -21,6 +21,8 @@
* Processing for html content css operations.
*/
+#include "utils/config.h"
+
#define _GNU_SOURCE /* strcasestr needs this for string.h */
#include <assert.h>
@@ -30,7 +32,6 @@
#include <strings.h>
#include <stdlib.h>
-#include "utils/config.h"
#include "utils/nsoption.h"
#include "utils/corestrings.h"
#include "utils/log.h"
diff --git a/desktop/treeview.c b/desktop/treeview.c
index e8b4a14..cb4ca80 100644
--- a/desktop/treeview.c
+++ b/desktop/treeview.c
@@ -22,11 +22,11 @@
* Treeview handling implementation.
*/
-#define _GNU_SOURCE /* strcasestr needs this for string.h */
+#include "utils/config.h"
+#define _GNU_SOURCE /* strcasestr needs this for string.h */
#include <string.h>
-#include "utils/config.h"
#include "utils/utils.h"
#include "utils/log.h"
#include "utils/nsurl.h"
diff --git a/docs/netsurf-fb.1 b/docs/netsurf-fb.1
index e9d721c..aa30ab3 100644
--- a/docs/netsurf-fb.1
+++ b/docs/netsurf-fb.1
@@ -302,9 +302,6 @@ Override CSS sys_colour_WindowFrame colour.
.B \-\-sys_colour_WindowText
Override CSS sys_colour_WindowText colour.
.TP
-.B \-\-render_resample
-render resample
-.TP
.B \-\-downloads_clear
downloads clear
.TP
diff --git a/docs/netsurf-gtk.1 b/docs/netsurf-gtk.1
index daa0148..10f0ae5 100644
--- a/docs/netsurf-gtk.1
+++ b/docs/netsurf-gtk.1
@@ -205,8 +205,6 @@ Override CSS sys_colour_Window colour.
Override CSS sys_colour_WindowFrame colour.
.It Fl -sys_colour_WindowText
Override CSS sys_colour_WindowText colour.
-.It Fl -render_resample
-render resample
.It Fl -downloads_clear
downloads clear
.It Fl -request_overwrite
diff --git a/frontends/beos/options.h b/frontends/beos/options.h
index 40d23a3..f959442 100644
--- a/frontends/beos/options.h
+++ b/frontends/beos/options.h
@@ -18,13 +18,12 @@
*/
-#ifndef _NETSURF_BEOS_OPTIONS_H_
-#define _NETSURF_BEOS_OPTIONS_H_
+#ifndef NETSURF_BEOS_OPTIONS_H_
+#define NETSURF_BEOS_OPTIONS_H_
/* currently nothing here */
#endif
-NSOPTION_BOOL(render_resample, false)
NSOPTION_STRING(url_file, NULL)
diff --git a/frontends/gtk/options.h b/frontends/gtk/options.h
index 81457ef..7fd79d7 100644
--- a/frontends/gtk/options.h
+++ b/frontends/gtk/options.h
@@ -23,9 +23,6 @@
#endif
-/* High quality image scaling */
-NSOPTION_BOOL(render_resample, true)
-
/* clear downloads */
NSOPTION_BOOL(downloads_clear, false)
diff --git a/frontends/gtk/preferences.c b/frontends/gtk/preferences.c
index 5fe9450..8ec41ca 100644
--- a/frontends/gtk/preferences.c
+++ b/frontends/gtk/preferences.c
@@ -412,9 +412,6 @@ TOGGLEBUTTON_SIGNALS(checkHideAdverts, block_advertisements)
/* enable javascript */
TOGGLEBUTTON_SIGNALS(checkEnableJavascript, enable_javascript)
-/* high quality image scaling */
-TOGGLEBUTTON_SIGNALS(checkResampleImages, render_resample)
-
/* load and display of images */
G_MODULE_EXPORT void
nsgtk_preferences_comboboxLoadImages_changed(GtkComboBox *combo,
diff --git a/frontends/gtk/res/options.gtk2.ui b/frontends/gtk/res/options.gtk2.ui
index f30abeb..ed596c0 100644
--- a/frontends/gtk/res/options.gtk2.ui
+++ b/frontends/gtk/res/options.gtk2.ui
@@ -1143,22 +1143,6 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="checkResampleImages">
- <property name="label" translatable="yes">preferencesControlHigh</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="nsgtk_preferences_checkResampleImages_toggled" swapped="no"/>
- <signal name="realize" handler="nsgtk_preferences_checkResampleImages_realize" swapped="no"/>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">3</property>
- </packing>
- </child>
- <child>
<object class="GtkHBox" id="hbox8">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -1199,7 +1183,7 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">4</property>
+ <property name="position">3</property>
</packing>
</child>
</object>
diff --git a/frontends/gtk/res/options.gtk3.ui b/frontends/gtk/res/options.gtk3.ui
index b74846c..af0dd5c 100644
--- a/frontends/gtk/res/options.gtk3.ui
+++ b/frontends/gtk/res/options.gtk3.ui
@@ -983,26 +983,6 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="checkResampleImages">
- <property name="label" translatable="yes">preferencesControlHigh</property>
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="halign">start</property>
- <property name="use_action_appearance">False</property>
- <property name="xalign">0.5</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="nsgtk_preferences_checkResampleImages_toggled" swapped="no"/>
- <signal name="realize" handler="nsgtk_preferences_checkResampleImages_realize" swapped="no"/>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">3</property>
- </packing>
- </child>
- <child>
<object class="GtkHBox" id="hbox8">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -1044,7 +1024,7 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">4</property>
+ <property name="position">3</property>
</packing>
</child>
</object>
diff --git a/frontends/monkey/options.h b/frontends/monkey/options.h
index a39e54b..8f6dd8b 100644
--- a/frontends/monkey/options.h
+++ b/frontends/monkey/options.h
@@ -16,14 +16,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _NETSURF_MONKEY_OPTIONS_H_
-#define _NETSURF_MONKEY_OPTIONS_H_
+#ifndef NETSURF_MONKEY_OPTIONS_H_
+#define NETSURF_MONKEY_OPTIONS_H_
/* currently nothing here */
#endif
-NSOPTION_BOOL(render_resample, true)
NSOPTION_BOOL(downloads_clear, false)
NSOPTION_BOOL(request_overwrite, true)
NSOPTION_STRING(downloads_directory, NULL)
diff --git a/frontends/riscos/dialog.c b/frontends/riscos/dialog.c
index 8a907eb..f0bcb59 100644
--- a/frontends/riscos/dialog.c
+++ b/frontends/riscos/dialog.c
@@ -335,12 +335,16 @@ void ro_gui_dialog_close(wimp_w close)
{
int i;
wimp_caret caret;
+ wimp_w parent = -1;
os_error *error;
/* Check if we're a persistent window */
for (i = 0; i < MAX_PERSISTENT; i++) {
if (persistent_dialog[i].dialog == close) {
/* We are => invalidate record */
+ if (persistent_dialog[i].parent != NULL) {
+ parent = persistent_dialog[i].parent;
+ }
persistent_dialog[i].parent = NULL;
persistent_dialog[i].dialog = NULL;
break;
@@ -363,7 +367,7 @@ void ro_gui_dialog_close(wimp_w close)
/* Check if we are a persistent window */
if (i < MAX_PERSISTENT) {
error = xwimp_set_caret_position(
- persistent_dialog[i].parent,
+ parent,
wimp_ICON_WINDOW, -100, -100,
32, -1);
/* parent may have been closed first */
diff --git a/test/data/Choices b/test/data/Choices
index 8ca4bec..a1fc15b 100644
--- a/test/data/Choices
+++ b/test/data/Choices
@@ -99,7 +99,6 @@ sys_colour_ThreeDShadow:000000
sys_colour_Window:000000
sys_colour_WindowFrame:000000
sys_colour_WindowText:000000
-render_resample:1
downloads_clear:0
request_overwrite:1
downloads_directory:/home/vince
diff --git a/test/data/Choices-all b/test/data/Choices-all
index 2742339..b430db5 100644
--- a/test/data/Choices-all
+++ b/test/data/Choices-all
@@ -95,7 +95,6 @@ sys_colour_WindowFrame:4e4e4e
sys_colour_WindowText:000000
log_filter:level:WARNING
verbose_filter:level:DEBUG
-render_resample:1
downloads_clear:0
request_overwrite:1
downloads_directory:/home/vince
--
NetSurf Browser
3 years, 9 months
netsurf: branch master updated. release/3.9-396-gfd510b2
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/fd510b27eee7d8d146ddf...
...commit http://git.netsurf-browser.org/netsurf.git/commit/fd510b27eee7d8d146ddf1a...
...tree http://git.netsurf-browser.org/netsurf.git/tree/fd510b27eee7d8d146ddf1a54...
The branch, master has been updated
via fd510b27eee7d8d146ddf1a54a0a98b2ba61f27f (commit)
from bacd8d229c478918f477026bbef2e752d5d67647 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=fd510b27eee7d8d146d...
commit fd510b27eee7d8d146ddf1a54a0a98b2ba61f27f
Author: John-Mark Bell <jmb(a)netsurf-browser.org>
Commit: John-Mark Bell <jmb(a)netsurf-browser.org>
GTK: fix missing includes
diff --git a/frontends/gtk/completion.c b/frontends/gtk/completion.c
index 1a76541..585a9e5 100644
--- a/frontends/gtk/completion.c
+++ b/frontends/gtk/completion.c
@@ -21,6 +21,8 @@
* Implementation of url entry completion.
*/
+#include <stdlib.h>
+
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/nsoption.h"
diff --git a/frontends/gtk/scaffolding.c b/frontends/gtk/scaffolding.c
index ccf3fcb..03d7160 100644
--- a/frontends/gtk/scaffolding.c
+++ b/frontends/gtk/scaffolding.c
@@ -18,6 +18,7 @@
#include <gtk/gtk.h>
#include <stdbool.h>
+#include <string.h>
#include "utils/utils.h"
#include "utils/log.h"
-----------------------------------------------------------------------
Summary of changes:
frontends/gtk/completion.c | 2 ++
frontends/gtk/scaffolding.c | 1 +
2 files changed, 3 insertions(+)
diff --git a/frontends/gtk/completion.c b/frontends/gtk/completion.c
index 1a76541..585a9e5 100644
--- a/frontends/gtk/completion.c
+++ b/frontends/gtk/completion.c
@@ -21,6 +21,8 @@
* Implementation of url entry completion.
*/
+#include <stdlib.h>
+
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/nsoption.h"
diff --git a/frontends/gtk/scaffolding.c b/frontends/gtk/scaffolding.c
index ccf3fcb..03d7160 100644
--- a/frontends/gtk/scaffolding.c
+++ b/frontends/gtk/scaffolding.c
@@ -18,6 +18,7 @@
#include <gtk/gtk.h>
#include <stdbool.h>
+#include <string.h>
#include "utils/utils.h"
#include "utils/log.h"
--
NetSurf Browser
3 years, 9 months
netsurf: branch master updated. release/3.9-395-gbacd8d2
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/bacd8d229c478918f4770...
...commit http://git.netsurf-browser.org/netsurf.git/commit/bacd8d229c478918f477026...
...tree http://git.netsurf-browser.org/netsurf.git/tree/bacd8d229c478918f477026bb...
The branch, master has been updated
via bacd8d229c478918f477026bbef2e752d5d67647 (commit)
from eba05b0d389a83d09798099e8894e297c973ac6e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=bacd8d229c478918f47...
commit bacd8d229c478918f477026bbef2e752d5d67647
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
make RISC OS specific window_screen_ options limited to that frontend
diff --git a/desktop/options.h b/desktop/options.h
index 9ae2b5e..0e56ad3 100644
--- a/desktop/options.h
+++ b/desktop/options.h
@@ -16,7 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
+/**
+ * \file
* Option available on all platforms
*
* Non-platform specific options can be added by editing this file
@@ -27,8 +28,8 @@
* with different macro definitions so there is no guard
*/
-#ifndef _NETSURF_DESKTOP_OPTIONS_H_
-#define _NETSURF_DESKTOP_OPTIONS_H_
+#ifndef NETSURF_DESKTOP_OPTIONS_H_
+#define NETSURF_DESKTOP_OPTIONS_H_
#include "netsurf/types.h"
@@ -167,12 +168,6 @@ NSOPTION_INTEGER(window_width, 0)
/** default height of new windows */
NSOPTION_INTEGER(window_height, 0)
-/** width of screen when above options were saved */
-NSOPTION_INTEGER(window_screen_width, 0)
-
-/** height of screen when above options were saved */
-NSOPTION_INTEGER(window_screen_height, 0)
-
/** default size of status bar vs. h scroll bar */
NSOPTION_INTEGER(toolbar_status_size, 6667)
diff --git a/docs/netsurf-fb.1 b/docs/netsurf-fb.1
index a196fcf..e9d721c 100644
--- a/docs/netsurf-fb.1
+++ b/docs/netsurf-fb.1
@@ -146,12 +146,6 @@ The width of the initial window.
.B \-\-window_height
The height of the initial window.
.TP
-.B \-\-window_screen_width
-window screen width
-.TP
-.B \-\-window_screen_height
-window screen height
-.TP
.B \-\-toolbar_status_size
toolbar status size
.TP
diff --git a/docs/netsurf-gtk.1 b/docs/netsurf-gtk.1
index b2b97f7..daa0148 100644
--- a/docs/netsurf-gtk.1
+++ b/docs/netsurf-gtk.1
@@ -101,10 +101,6 @@ The Y co-ordinate of the initial window.
The width of the initial window.
.It Fl -window_height
The height of the initial window.
-.It Fl -window_screen_width
-window screen width
-.It Fl -window_screen_height
-window screen height
.It Fl -toolbar_status_size
toolbar status size
.It Fl -scale
diff --git a/frontends/riscos/options.h b/frontends/riscos/options.h
index cb2b78b..bf85f07 100644
--- a/frontends/riscos/options.h
+++ b/frontends/riscos/options.h
@@ -16,12 +16,20 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
- * RISC OS specific options.
+/**
+ * \file
+ * Option specific to RISC OS
+ *
+ * Platform specific options for RISC OS can be added by editing this file
+ *
+ * Global optionsshould be added in the desktop options.h.
+ *
+ * This header is specificaly intented to be included multiple times
+ * with different macro definitions so there is no guard
*/
-#ifndef _NETSURF_RISCOS_OPTIONS_H_
-#define _NETSURF_RISCOS_OPTIONS_H_
+#ifndef NETSURF_RISCOS_OPTIONS_H_
+#define NETSURF_RISCOS_OPTIONS_H_
#include "riscos/tinct.h"
@@ -66,3 +74,13 @@ NSOPTION_BOOL(thumbnail_iconise, true)
NSOPTION_BOOL(interactive_help, true)
NSOPTION_BOOL(external_hotlists, false)
NSOPTION_STRING(external_hotlist_app, NULL)
+
+/**
+ * width of screen when window_width option was saved
+ */
+NSOPTION_INTEGER(window_screen_width, 0)
+
+/**
+ * height of screen when window_heigh option was saved
+ */
+NSOPTION_INTEGER(window_screen_height, 0)
diff --git a/test/data/Choices b/test/data/Choices
index 439a67f..8ca4bec 100644
--- a/test/data/Choices
+++ b/test/data/Choices
@@ -50,8 +50,6 @@ window_x:0
window_y:0
window_width:0
window_height:0
-window_screen_width:0
-window_screen_height:0
toolbar_status_size:6667
scale:100
incremental_reflow:1
diff --git a/test/data/Choices-all b/test/data/Choices-all
index 492cd3e..2742339 100644
--- a/test/data/Choices-all
+++ b/test/data/Choices-all
@@ -41,8 +41,6 @@ window_x:0
window_y:0
window_width:0
window_height:0
-window_screen_width:0
-window_screen_height:0
toolbar_status_size:6667
scale:100
incremental_reflow:1
-----------------------------------------------------------------------
Summary of changes:
desktop/options.h | 13 ++++---------
docs/netsurf-fb.1 | 6 ------
docs/netsurf-gtk.1 | 4 ----
frontends/riscos/options.h | 26 ++++++++++++++++++++++----
test/data/Choices | 2 --
test/data/Choices-all | 2 --
6 files changed, 26 insertions(+), 27 deletions(-)
diff --git a/desktop/options.h b/desktop/options.h
index 9ae2b5e..0e56ad3 100644
--- a/desktop/options.h
+++ b/desktop/options.h
@@ -16,7 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
+/**
+ * \file
* Option available on all platforms
*
* Non-platform specific options can be added by editing this file
@@ -27,8 +28,8 @@
* with different macro definitions so there is no guard
*/
-#ifndef _NETSURF_DESKTOP_OPTIONS_H_
-#define _NETSURF_DESKTOP_OPTIONS_H_
+#ifndef NETSURF_DESKTOP_OPTIONS_H_
+#define NETSURF_DESKTOP_OPTIONS_H_
#include "netsurf/types.h"
@@ -167,12 +168,6 @@ NSOPTION_INTEGER(window_width, 0)
/** default height of new windows */
NSOPTION_INTEGER(window_height, 0)
-/** width of screen when above options were saved */
-NSOPTION_INTEGER(window_screen_width, 0)
-
-/** height of screen when above options were saved */
-NSOPTION_INTEGER(window_screen_height, 0)
-
/** default size of status bar vs. h scroll bar */
NSOPTION_INTEGER(toolbar_status_size, 6667)
diff --git a/docs/netsurf-fb.1 b/docs/netsurf-fb.1
index a196fcf..e9d721c 100644
--- a/docs/netsurf-fb.1
+++ b/docs/netsurf-fb.1
@@ -146,12 +146,6 @@ The width of the initial window.
.B \-\-window_height
The height of the initial window.
.TP
-.B \-\-window_screen_width
-window screen width
-.TP
-.B \-\-window_screen_height
-window screen height
-.TP
.B \-\-toolbar_status_size
toolbar status size
.TP
diff --git a/docs/netsurf-gtk.1 b/docs/netsurf-gtk.1
index b2b97f7..daa0148 100644
--- a/docs/netsurf-gtk.1
+++ b/docs/netsurf-gtk.1
@@ -101,10 +101,6 @@ The Y co-ordinate of the initial window.
The width of the initial window.
.It Fl -window_height
The height of the initial window.
-.It Fl -window_screen_width
-window screen width
-.It Fl -window_screen_height
-window screen height
.It Fl -toolbar_status_size
toolbar status size
.It Fl -scale
diff --git a/frontends/riscos/options.h b/frontends/riscos/options.h
index cb2b78b..bf85f07 100644
--- a/frontends/riscos/options.h
+++ b/frontends/riscos/options.h
@@ -16,12 +16,20 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
- * RISC OS specific options.
+/**
+ * \file
+ * Option specific to RISC OS
+ *
+ * Platform specific options for RISC OS can be added by editing this file
+ *
+ * Global optionsshould be added in the desktop options.h.
+ *
+ * This header is specificaly intented to be included multiple times
+ * with different macro definitions so there is no guard
*/
-#ifndef _NETSURF_RISCOS_OPTIONS_H_
-#define _NETSURF_RISCOS_OPTIONS_H_
+#ifndef NETSURF_RISCOS_OPTIONS_H_
+#define NETSURF_RISCOS_OPTIONS_H_
#include "riscos/tinct.h"
@@ -66,3 +74,13 @@ NSOPTION_BOOL(thumbnail_iconise, true)
NSOPTION_BOOL(interactive_help, true)
NSOPTION_BOOL(external_hotlists, false)
NSOPTION_STRING(external_hotlist_app, NULL)
+
+/**
+ * width of screen when window_width option was saved
+ */
+NSOPTION_INTEGER(window_screen_width, 0)
+
+/**
+ * height of screen when window_heigh option was saved
+ */
+NSOPTION_INTEGER(window_screen_height, 0)
diff --git a/test/data/Choices b/test/data/Choices
index 439a67f..8ca4bec 100644
--- a/test/data/Choices
+++ b/test/data/Choices
@@ -50,8 +50,6 @@ window_x:0
window_y:0
window_width:0
window_height:0
-window_screen_width:0
-window_screen_height:0
toolbar_status_size:6667
scale:100
incremental_reflow:1
diff --git a/test/data/Choices-all b/test/data/Choices-all
index 492cd3e..2742339 100644
--- a/test/data/Choices-all
+++ b/test/data/Choices-all
@@ -41,8 +41,6 @@ window_x:0
window_y:0
window_width:0
window_height:0
-window_screen_width:0
-window_screen_height:0
toolbar_status_size:6667
scale:100
incremental_reflow:1
--
NetSurf Browser
3 years, 9 months
netsurf: branch master updated. release/3.9-394-geba05b0
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/eba05b0d389a83d097980...
...commit http://git.netsurf-browser.org/netsurf.git/commit/eba05b0d389a83d09798099...
...tree http://git.netsurf-browser.org/netsurf.git/tree/eba05b0d389a83d09798099e8...
The branch, master has been updated
via eba05b0d389a83d09798099e8894e297c973ac6e (commit)
from 918b1d0fed158fdb48a61536ff7aec7495916298 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=eba05b0d389a83d0979...
commit eba05b0d389a83d09798099e8894e297c973ac6e
Author: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Commit: Daniel Silverstone <dsilvers(a)digital-scurf.org>
html_script: Count sync scripts to prevent unpausing early
If there is more than one incomplete sync script then it's
important that we don't unpause hubbub too early. This commit
adds a counter so that if there're unfinished sync scripts in
the set, we don't unpause until the last one completes.
Signed-off-by: Daniel Silverstone <dsilvers(a)digital-scurf.org>
diff --git a/content/handlers/html/html_script.c b/content/handlers/html/html_script.c
index f4754fe..e11e47c 100644
--- a/content/handlers/html/html_script.c
+++ b/content/handlers/html/html_script.c
@@ -284,6 +284,15 @@ convert_script_sync_cb(hlcache_handle *script,
struct html_script *s;
script_handler_t *script_handler;
dom_hubbub_error err;
+ unsigned int active_sync_scripts = 0;
+
+ /* Count sync scripts which have yet to complete (other than us) */
+ for (i = 0, s = parent->scripts; i != parent->scripts_count; i++, s++) {
+ if (s->type == HTML_SCRIPT_SYNC &&
+ s->data.handle != script && s->already_started == false) {
+ active_sync_scripts++;
+ }
+ }
/* Find script */
for (i = 0, s = parent->scripts; i != parent->scripts_count; i++, s++) {
@@ -314,7 +323,7 @@ convert_script_sync_cb(hlcache_handle *script,
}
/* continue parse */
- if (parent->parser != NULL) {
+ if (parent->parser != NULL && active_sync_scripts == 0) {
err = dom_hubbub_parser_pause(parent->parser, false);
if (err != DOM_HUBBUB_OK) {
NSLOG(netsurf, INFO, "unpause returned 0x%x", err);
@@ -338,7 +347,7 @@ convert_script_sync_cb(hlcache_handle *script,
s->already_started = true;
/* continue parse */
- if (parent->parser != NULL) {
+ if (parent->parser != NULL && active_sync_scripts == 0) {
err = dom_hubbub_parser_pause(parent->parser, false);
if (err != DOM_HUBBUB_OK) {
NSLOG(netsurf, INFO, "unpause returned 0x%x", err);
-----------------------------------------------------------------------
Summary of changes:
content/handlers/html/html_script.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/content/handlers/html/html_script.c b/content/handlers/html/html_script.c
index f4754fe..e11e47c 100644
--- a/content/handlers/html/html_script.c
+++ b/content/handlers/html/html_script.c
@@ -284,6 +284,15 @@ convert_script_sync_cb(hlcache_handle *script,
struct html_script *s;
script_handler_t *script_handler;
dom_hubbub_error err;
+ unsigned int active_sync_scripts = 0;
+
+ /* Count sync scripts which have yet to complete (other than us) */
+ for (i = 0, s = parent->scripts; i != parent->scripts_count; i++, s++) {
+ if (s->type == HTML_SCRIPT_SYNC &&
+ s->data.handle != script && s->already_started == false) {
+ active_sync_scripts++;
+ }
+ }
/* Find script */
for (i = 0, s = parent->scripts; i != parent->scripts_count; i++, s++) {
@@ -314,7 +323,7 @@ convert_script_sync_cb(hlcache_handle *script,
}
/* continue parse */
- if (parent->parser != NULL) {
+ if (parent->parser != NULL && active_sync_scripts == 0) {
err = dom_hubbub_parser_pause(parent->parser, false);
if (err != DOM_HUBBUB_OK) {
NSLOG(netsurf, INFO, "unpause returned 0x%x", err);
@@ -338,7 +347,7 @@ convert_script_sync_cb(hlcache_handle *script,
s->already_started = true;
/* continue parse */
- if (parent->parser != NULL) {
+ if (parent->parser != NULL && active_sync_scripts == 0) {
err = dom_hubbub_parser_pause(parent->parser, false);
if (err != DOM_HUBBUB_OK) {
NSLOG(netsurf, INFO, "unpause returned 0x%x", err);
--
NetSurf Browser
3 years, 9 months
netsurf: branch master updated. release/3.9-393-g918b1d0
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/918b1d0fed158fdb48a61...
...commit http://git.netsurf-browser.org/netsurf.git/commit/918b1d0fed158fdb48a6153...
...tree http://git.netsurf-browser.org/netsurf.git/tree/918b1d0fed158fdb48a61536f...
The branch, master has been updated
via 918b1d0fed158fdb48a61536ff7aec7495916298 (commit)
from 0e304aba42ca904c49ea9190fa0313f858b12385 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=918b1d0fed158fdb48a...
commit 918b1d0fed158fdb48a61536ff7aec7495916298
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
remove long unused plugin option from gtk and monkey
diff --git a/docs/netsurf-fb.1 b/docs/netsurf-fb.1
index e4c3100..a196fcf 100644
--- a/docs/netsurf-fb.1
+++ b/docs/netsurf-fb.1
@@ -332,9 +332,6 @@ button type
.B \-\-disable_popups
disable popups
.TP
-.B \-\-disable_plugins
-disable plugins
-.TP
.B \-\-history_age
history age
.TP
diff --git a/docs/netsurf-gtk.1 b/docs/netsurf-gtk.1
index 7b2f4f4..b2b97f7 100644
--- a/docs/netsurf-gtk.1
+++ b/docs/netsurf-gtk.1
@@ -225,8 +225,6 @@ Force tabs to always be show.
button type
.It Fl -disable_popups
disable popups
-.It Fl -disable_plugins
-disable plugins
.It Fl -history_age
history age
.It Fl -hover_urls
diff --git a/frontends/gtk/options.h b/frontends/gtk/options.h
index dad17f0..81457ef 100644
--- a/frontends/gtk/options.h
+++ b/frontends/gtk/options.h
@@ -47,9 +47,6 @@ NSOPTION_INTEGER(button_type, 0)
/* disallow popup windows */
NSOPTION_BOOL(disable_popups, false)
-/* disable content plugins */
-NSOPTION_BOOL(disable_plugins, false)
-
/* number of days to keep history data */
NSOPTION_INTEGER(history_age, 0)
diff --git a/frontends/gtk/preferences.c b/frontends/gtk/preferences.c
index 3aaaa90..5fe9450 100644
--- a/frontends/gtk/preferences.c
+++ b/frontends/gtk/preferences.c
@@ -412,9 +412,6 @@ TOGGLEBUTTON_SIGNALS(checkHideAdverts, block_advertisements)
/* enable javascript */
TOGGLEBUTTON_SIGNALS(checkEnableJavascript, enable_javascript)
-/* disable plugins */
-TOGGLEBUTTON_SIGNALS(checkDisablePlugins, disable_plugins)
-
/* high quality image scaling */
TOGGLEBUTTON_SIGNALS(checkResampleImages, render_resample)
diff --git a/frontends/gtk/res/options.gtk2.ui b/frontends/gtk/res/options.gtk2.ui
index a116258..f30abeb 100644
--- a/frontends/gtk/res/options.gtk2.ui
+++ b/frontends/gtk/res/options.gtk2.ui
@@ -1143,22 +1143,6 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="checkDisablePlugins">
- <property name="label" translatable="yes">preferencesControlDisable</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="nsgtk_preferences_checkDisablePlugins_toggled" swapped="no"/>
- <signal name="realize" handler="nsgtk_preferences_checkDisablePlugins_realize" swapped="no"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">3</property>
- </packing>
- </child>
- <child>
<object class="GtkCheckButton" id="checkResampleImages">
<property name="label" translatable="yes">preferencesControlHigh</property>
<property name="visible">True</property>
@@ -1171,7 +1155,7 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">4</property>
+ <property name="position">3</property>
</packing>
</child>
<child>
@@ -1215,7 +1199,7 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">5</property>
+ <property name="position">4</property>
</packing>
</child>
</object>
diff --git a/frontends/gtk/res/options.gtk3.ui b/frontends/gtk/res/options.gtk3.ui
index 2a3516f..b74846c 100644
--- a/frontends/gtk/res/options.gtk3.ui
+++ b/frontends/gtk/res/options.gtk3.ui
@@ -983,26 +983,6 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="checkDisablePlugins">
- <property name="label" translatable="yes">preferencesControlDisable</property>
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="halign">start</property>
- <property name="use_action_appearance">False</property>
- <property name="xalign">0.5</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="nsgtk_preferences_checkDisablePlugins_toggled" swapped="no"/>
- <signal name="realize" handler="nsgtk_preferences_checkDisablePlugins_realize" swapped="no"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">3</property>
- </packing>
- </child>
- <child>
<object class="GtkCheckButton" id="checkResampleImages">
<property name="label" translatable="yes">preferencesControlHigh</property>
<property name="use_action_appearance">False</property>
@@ -1019,7 +999,7 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">4</property>
+ <property name="position">3</property>
</packing>
</child>
<child>
@@ -1064,7 +1044,7 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">5</property>
+ <property name="position">4</property>
</packing>
</child>
</object>
diff --git a/frontends/monkey/options.h b/frontends/monkey/options.h
index 57cce7e..a39e54b 100644
--- a/frontends/monkey/options.h
+++ b/frontends/monkey/options.h
@@ -31,7 +31,6 @@ NSOPTION_STRING(url_file, NULL)
NSOPTION_BOOL(show_single_tab, false)
NSOPTION_INTEGER(button_type, 0)
NSOPTION_BOOL(disable_popups, false)
-NSOPTION_BOOL(disable_plugins, false)
NSOPTION_INTEGER(history_age, 0)
NSOPTION_BOOL(hover_urls, false)
NSOPTION_BOOL(focus_new, false)
diff --git a/test/data/Choices b/test/data/Choices
index bd946f7..439a67f 100644
--- a/test/data/Choices
+++ b/test/data/Choices
@@ -109,7 +109,6 @@ url_file:/home/vince/.netsurf/URLs
show_single_tab:1
button_type:1
disable_popups:0
-disable_plugins:0
history_age:0
hover_urls:0
focus_new:0
diff --git a/test/data/Choices-all b/test/data/Choices-all
index f2a6188..492cd3e 100644
--- a/test/data/Choices-all
+++ b/test/data/Choices-all
@@ -105,7 +105,6 @@ url_file:/home/vince/.netsurf/URLs
show_single_tab:1
button_type:1
disable_popups:0
-disable_plugins:0
history_age:0
hover_urls:0
focus_new:0
-----------------------------------------------------------------------
Summary of changes:
docs/netsurf-fb.1 | 3 ---
docs/netsurf-gtk.1 | 2 --
frontends/gtk/options.h | 3 ---
frontends/gtk/preferences.c | 3 ---
frontends/gtk/res/options.gtk2.ui | 20 ++------------------
frontends/gtk/res/options.gtk3.ui | 24 ++----------------------
frontends/monkey/options.h | 1 -
test/data/Choices | 1 -
test/data/Choices-all | 1 -
9 files changed, 4 insertions(+), 54 deletions(-)
diff --git a/docs/netsurf-fb.1 b/docs/netsurf-fb.1
index e4c3100..a196fcf 100644
--- a/docs/netsurf-fb.1
+++ b/docs/netsurf-fb.1
@@ -332,9 +332,6 @@ button type
.B \-\-disable_popups
disable popups
.TP
-.B \-\-disable_plugins
-disable plugins
-.TP
.B \-\-history_age
history age
.TP
diff --git a/docs/netsurf-gtk.1 b/docs/netsurf-gtk.1
index 7b2f4f4..b2b97f7 100644
--- a/docs/netsurf-gtk.1
+++ b/docs/netsurf-gtk.1
@@ -225,8 +225,6 @@ Force tabs to always be show.
button type
.It Fl -disable_popups
disable popups
-.It Fl -disable_plugins
-disable plugins
.It Fl -history_age
history age
.It Fl -hover_urls
diff --git a/frontends/gtk/options.h b/frontends/gtk/options.h
index dad17f0..81457ef 100644
--- a/frontends/gtk/options.h
+++ b/frontends/gtk/options.h
@@ -47,9 +47,6 @@ NSOPTION_INTEGER(button_type, 0)
/* disallow popup windows */
NSOPTION_BOOL(disable_popups, false)
-/* disable content plugins */
-NSOPTION_BOOL(disable_plugins, false)
-
/* number of days to keep history data */
NSOPTION_INTEGER(history_age, 0)
diff --git a/frontends/gtk/preferences.c b/frontends/gtk/preferences.c
index 3aaaa90..5fe9450 100644
--- a/frontends/gtk/preferences.c
+++ b/frontends/gtk/preferences.c
@@ -412,9 +412,6 @@ TOGGLEBUTTON_SIGNALS(checkHideAdverts, block_advertisements)
/* enable javascript */
TOGGLEBUTTON_SIGNALS(checkEnableJavascript, enable_javascript)
-/* disable plugins */
-TOGGLEBUTTON_SIGNALS(checkDisablePlugins, disable_plugins)
-
/* high quality image scaling */
TOGGLEBUTTON_SIGNALS(checkResampleImages, render_resample)
diff --git a/frontends/gtk/res/options.gtk2.ui b/frontends/gtk/res/options.gtk2.ui
index a116258..f30abeb 100644
--- a/frontends/gtk/res/options.gtk2.ui
+++ b/frontends/gtk/res/options.gtk2.ui
@@ -1143,22 +1143,6 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="checkDisablePlugins">
- <property name="label" translatable="yes">preferencesControlDisable</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="nsgtk_preferences_checkDisablePlugins_toggled" swapped="no"/>
- <signal name="realize" handler="nsgtk_preferences_checkDisablePlugins_realize" swapped="no"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">3</property>
- </packing>
- </child>
- <child>
<object class="GtkCheckButton" id="checkResampleImages">
<property name="label" translatable="yes">preferencesControlHigh</property>
<property name="visible">True</property>
@@ -1171,7 +1155,7 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">4</property>
+ <property name="position">3</property>
</packing>
</child>
<child>
@@ -1215,7 +1199,7 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">5</property>
+ <property name="position">4</property>
</packing>
</child>
</object>
diff --git a/frontends/gtk/res/options.gtk3.ui b/frontends/gtk/res/options.gtk3.ui
index 2a3516f..b74846c 100644
--- a/frontends/gtk/res/options.gtk3.ui
+++ b/frontends/gtk/res/options.gtk3.ui
@@ -983,26 +983,6 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="checkDisablePlugins">
- <property name="label" translatable="yes">preferencesControlDisable</property>
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="halign">start</property>
- <property name="use_action_appearance">False</property>
- <property name="xalign">0.5</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="nsgtk_preferences_checkDisablePlugins_toggled" swapped="no"/>
- <signal name="realize" handler="nsgtk_preferences_checkDisablePlugins_realize" swapped="no"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">3</property>
- </packing>
- </child>
- <child>
<object class="GtkCheckButton" id="checkResampleImages">
<property name="label" translatable="yes">preferencesControlHigh</property>
<property name="use_action_appearance">False</property>
@@ -1019,7 +999,7 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">4</property>
+ <property name="position">3</property>
</packing>
</child>
<child>
@@ -1064,7 +1044,7 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">5</property>
+ <property name="position">4</property>
</packing>
</child>
</object>
diff --git a/frontends/monkey/options.h b/frontends/monkey/options.h
index 57cce7e..a39e54b 100644
--- a/frontends/monkey/options.h
+++ b/frontends/monkey/options.h
@@ -31,7 +31,6 @@ NSOPTION_STRING(url_file, NULL)
NSOPTION_BOOL(show_single_tab, false)
NSOPTION_INTEGER(button_type, 0)
NSOPTION_BOOL(disable_popups, false)
-NSOPTION_BOOL(disable_plugins, false)
NSOPTION_INTEGER(history_age, 0)
NSOPTION_BOOL(hover_urls, false)
NSOPTION_BOOL(focus_new, false)
diff --git a/test/data/Choices b/test/data/Choices
index bd946f7..439a67f 100644
--- a/test/data/Choices
+++ b/test/data/Choices
@@ -109,7 +109,6 @@ url_file:/home/vince/.netsurf/URLs
show_single_tab:1
button_type:1
disable_popups:0
-disable_plugins:0
history_age:0
hover_urls:0
focus_new:0
diff --git a/test/data/Choices-all b/test/data/Choices-all
index f2a6188..492cd3e 100644
--- a/test/data/Choices-all
+++ b/test/data/Choices-all
@@ -105,7 +105,6 @@ url_file:/home/vince/.netsurf/URLs
show_single_tab:1
button_type:1
disable_popups:0
-disable_plugins:0
history_age:0
hover_urls:0
focus_new:0
--
NetSurf Browser
3 years, 9 months
netsurf: branch master updated. release/3.9-392-g0e304ab
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/0e304aba42ca904c49ea9...
...commit http://git.netsurf-browser.org/netsurf.git/commit/0e304aba42ca904c49ea919...
...tree http://git.netsurf-browser.org/netsurf.git/tree/0e304aba42ca904c49ea9190f...
The branch, master has been updated
via 0e304aba42ca904c49ea9190fa0313f858b12385 (commit)
via dba2df4b9aeb21b4c62f9a0e1443852995821e5d (commit)
from f081ffb7e8f9533cc74bacc7e836a79ae9b0808d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=0e304aba42ca904c49e...
commit 0e304aba42ca904c49ea9190fa0313f858b12385
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
add page info button to url entry and update on change for win32
diff --git a/frontends/windows/window.c b/frontends/windows/window.c
index 2748080..572e412 100644
--- a/frontends/windows/window.c
+++ b/frontends/windows/window.c
@@ -55,19 +55,34 @@
#include "windows/global_history.h"
#include "windows/window.h"
-/** List of all our gui windows */
+/**
+ * List of all gui windows
+ */
static struct gui_window *window_list = NULL;
-/** The main window class name */
+/**
+ * The main window class name
+ */
static const LPCWSTR windowclassname_main = L"nswsmainwindow";
-/** width of the throbber element */
+/**
+ * width of the throbber element
+ */
#define NSWS_THROBBER_WIDTH 24
-/** height of the url entry box */
+/**
+ * height of the url entry box
+ */
#define NSWS_URLBAR_HEIGHT 23
-/** Number of open windows */
+/**
+ * height of the Page Information bitmap button
+ */
+#define NSW32_PGIBUTTON_HEIGHT 16
+
+/**
+ * Number of open windows
+ */
static int open_windows = 0;
@@ -129,6 +144,23 @@ static HWND nsws_window_create(HINSTANCE hInstance, struct gui_window *gw)
{
HWND hwnd;
INITCOMMONCONTROLSEX icc;
+ int xpos = CW_USEDEFAULT;
+ int ypos = CW_USEDEFAULT;
+ int width = CW_USEDEFAULT;
+ int height = CW_USEDEFAULT;
+
+ if ((nsoption_int(window_width) >= 100) &&
+ (nsoption_int(window_height) >= 100) &&
+ (nsoption_int(window_x) >= 0) &&
+ (nsoption_int(window_y) >= 0)) {
+ xpos = nsoption_int(window_x);
+ ypos = nsoption_int(window_y);
+ width = nsoption_int(window_width);
+ height = nsoption_int(window_height);
+
+ NSLOG(netsurf, DEBUG, "Setting Window position %d,%d %d,%d",
+ xpos, ypos, width, height);
+ }
icc.dwSize = sizeof(icc);
icc.dwICC = ICC_BAR_CLASSES | ICC_WIN95_CLASSES;
@@ -140,51 +172,28 @@ static HWND nsws_window_create(HINSTANCE hInstance, struct gui_window *gw)
gw->mainmenu = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MENU_MAIN));
gw->rclick = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MENU_CONTEXT));
- NSLOG(netsurf, INFO,
- "creating hInstance %p GUI window %p",
- hInstance, gw);
hwnd = CreateWindowExW(0,
- windowclassname_main,
- L"NetSurf Browser",
- WS_OVERLAPPEDWINDOW |
- WS_CLIPCHILDREN |
- WS_CLIPSIBLINGS |
- CS_DBLCLKS,
- CW_USEDEFAULT,
- CW_USEDEFAULT,
- gw->width,
- gw->height,
- NULL,
- gw->mainmenu,
- hInstance,
- NULL);
+ windowclassname_main,
+ L"NetSurf Browser",
+ WS_OVERLAPPEDWINDOW |
+ WS_CLIPCHILDREN |
+ WS_CLIPSIBLINGS |
+ CS_DBLCLKS,
+ xpos,
+ ypos,
+ width,
+ height,
+ NULL,
+ gw->mainmenu,
+ hInstance,
+ (LPVOID)gw);
if (hwnd == NULL) {
NSLOG(netsurf, INFO, "Window create failed");
- return NULL;
- }
-
- /* set the gui window associated with this browser */
- SetProp(hwnd, TEXT("GuiWnd"), (HANDLE)gw);
-
- if ((nsoption_int(window_width) >= 100) &&
- (nsoption_int(window_height) >= 100) &&
- (nsoption_int(window_x) >= 0) &&
- (nsoption_int(window_y) >= 0)) {
- NSLOG(netsurf, INFO,
- "Setting Window position %d,%d %d,%d",
- nsoption_int(window_x), nsoption_int(window_y),
- nsoption_int(window_width), nsoption_int(window_height));
- SetWindowPos(hwnd, HWND_TOP,
- nsoption_int(window_x),
- nsoption_int(window_y),
- nsoption_int(window_width),
- nsoption_int(window_height),
- SWP_SHOWWINDOW);
+ } else {
+ nsws_window_set_accels(gw);
}
- nsws_window_set_accels(gw);
-
return hwnd;
}
@@ -295,7 +304,7 @@ urlbar_dimensions(HWND hWndParent,
/**
* callback for toolbar events
*
- * message handler for toolbar window
+ * subclass message handler for toolbar window
*
* \param hwnd win32 window handle message arrived for
* \param msg The message ID
@@ -311,7 +320,11 @@ nsws_window_toolbar_callback(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
LOG_WIN_MSG(hwnd, msg, wparam, lparam);
+ toolproc = (WNDPROC)GetProp(hwnd, TEXT("OrigMsgProc"));
+ assert(toolproc != NULL);
+
gw = nsws_get_gui_window(hwnd);
+ assert(gw != NULL);
switch (msg) {
case WM_SIZE:
@@ -347,19 +360,15 @@ nsws_window_toolbar_callback(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
return 0;
}
break;
- }
- /* remove properties if window is being destroyed */
- if (msg == WM_NCDESTROY) {
+ case WM_NCDESTROY:
+ /* remove properties if window is being destroyed */
RemoveProp(hwnd, TEXT("GuiWnd"));
- toolproc = (WNDPROC)RemoveProp(hwnd, TEXT("OrigMsgProc"));
- } else {
- toolproc = (WNDPROC)GetProp(hwnd, TEXT("OrigMsgProc"));
- }
+ RemoveProp(hwnd, TEXT("OrigMsgProc"));
+ /* put the original message handler back */
+ SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)toolproc);
+ break;
- if (toolproc == NULL) {
- /* the original toolbar procedure is not available */
- return DefWindowProc(hwnd, msg, wparam, lparam);
}
/* chain to the next handler */
@@ -367,10 +376,21 @@ nsws_window_toolbar_callback(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
}
+static void set_urlbar_edit_size(HWND hwnd)
+{
+ RECT rc;
+ GetClientRect(hwnd, &rc);
+ rc.left += NSW32_PGIBUTTON_HEIGHT;
+ SendMessage(hwnd, EM_SETRECT, 0, (LPARAM)&rc);
+ NSLOG(netsurf, DEBUG, "left:%ld right:%ld top:%ld bot:%ld",
+ rc.left,rc.right,rc.top,rc.bottom);
+}
+
+
/**
* callback for url bar events
*
- * message handler for urlbar window
+ * subclass message handler for urlbar window
*
* \param hwnd win32 window handle message arrived for
* \param msg The message ID
@@ -383,12 +403,15 @@ nsws_window_urlbar_callback(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
struct gui_window *gw;
WNDPROC urlproc;
HFONT hFont;
+ LRESULT result;
LOG_WIN_MSG(hwnd, msg, wparam, lparam);
- gw = nsws_get_gui_window(hwnd);
-
urlproc = (WNDPROC)GetProp(hwnd, TEXT("OrigMsgProc"));
+ assert(urlproc != NULL);
+
+ gw = nsws_get_gui_window(hwnd);
+ assert(gw != NULL);
/* override messages */
switch (msg) {
@@ -411,19 +434,21 @@ nsws_window_urlbar_callback(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
/* remove properties if window is being destroyed */
RemoveProp(hwnd, TEXT("GuiWnd"));
RemoveProp(hwnd, TEXT("OrigMsgProc"));
+ /* put the original message handler back */
+ SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)urlproc);
break;
- }
- if (urlproc == NULL) {
- /* the original toolbar procedure is not available */
- return DefWindowProc(hwnd, msg, wparam, lparam);
+ case WM_SIZE:
+ result = CallWindowProc(urlproc, hwnd, msg, wparam, lparam);
+ set_urlbar_edit_size(hwnd);
+ return result;
+
}
/* chain to the next handler */
return CallWindowProc(urlproc, hwnd, msg, wparam, lparam);
}
-
/**
* create a urlbar and message handler
*
@@ -441,6 +466,7 @@ nsws_window_urlbar_create(HINSTANCE hInstance,
{
int urlx, urly, urlwidth, urlheight;
HWND hwnd;
+ HWND hbutton;
WNDPROC urlproc;
HFONT hFont;
@@ -453,7 +479,8 @@ nsws_window_urlbar_create(HINSTANCE hInstance,
hwnd = CreateWindowEx(0L,
TEXT("Edit"),
NULL,
- WS_CHILD | WS_BORDER | WS_VISIBLE | ES_LEFT | ES_AUTOHSCROLL,
+ WS_CHILD | WS_BORDER | WS_VISIBLE |
+ ES_LEFT | ES_AUTOHSCROLL | ES_MULTILINE,
urlx,
urly,
urlwidth,
@@ -461,7 +488,7 @@ nsws_window_urlbar_create(HINSTANCE hInstance,
hWndParent,
(HMENU)IDC_MAIN_URLBAR,
hInstance,
- 0);
+ NULL);
if (hwnd == NULL) {
return NULL;
@@ -487,6 +514,28 @@ nsws_window_urlbar_create(HINSTANCE hInstance,
SendMessage(hwnd, WM_SETFONT, (WPARAM)hFont, 0);
}
+
+ /* Create the page info button */
+ hbutton = CreateWindowEx(0L,
+ TEXT("BUTTON"),
+ NULL,
+ WS_CHILD | WS_VISIBLE | BS_BITMAP | BS_FLAT,
+ (NSWS_URLBAR_HEIGHT - NSW32_PGIBUTTON_HEIGHT) /2,
+ (NSWS_URLBAR_HEIGHT - NSW32_PGIBUTTON_HEIGHT) /2,
+ NSW32_PGIBUTTON_HEIGHT,
+ NSW32_PGIBUTTON_HEIGHT,
+ hwnd,
+ (HMENU)IDC_PAGEINFO,
+ hInstance,
+ NULL);
+
+ /* put a property on the parent toolbar so it can set the page info */
+ SetProp(hWndParent, TEXT("hPGIbutton"), (HANDLE)hbutton);
+
+ SendMessageW(hbutton, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)gw->hPageInfo[PAGE_STATE_UNKNOWN]);
+
+ set_urlbar_edit_size(hwnd);
+
NSLOG(netsurf, INFO,
"Created url bar hwnd:%p, x:%d, y:%d, w:%d, h:%d", hwnd, urlx,
urly, urlwidth, urlheight);
@@ -620,7 +669,7 @@ nsws_window_create_toolbar(HINSTANCE hInstance,
hWndToolbar = CreateWindowEx(0,
TOOLBARCLASSNAME,
"Toolbar",
- WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT,
+ WS_CHILD | TBSTYLE_FLAT,
0, 0, 0, 0,
hWndParent,
NULL,
@@ -685,15 +734,21 @@ nsws_window_create_toolbar(HINSTANCE hInstance,
TB_BUTTONSTRUCTSIZE,
(WPARAM)sizeof(TBBUTTON),
0);
+
SendMessage(hWndToolbar,
TB_ADDBUTTONS,
(WPARAM)gw->toolbuttonc,
(LPARAM)&tbButtons);
+ /* create url widget */
gw->urlbar = nsws_window_urlbar_create(hInstance, hWndToolbar, gw);
+ /* create throbber widget */
gw->throbber = nsws_window_throbber_create(hInstance, hWndToolbar, gw);
+ SendMessage(hWndToolbar, TB_AUTOSIZE, 0, 0);
+ ShowWindow(hWndToolbar, TRUE);
+
return hWndToolbar;
}
@@ -1330,12 +1385,30 @@ nsws_window_event_callback(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
struct gui_window *gw;
RECT rmain;
+ LPCREATESTRUCTW createstruct;
LOG_WIN_MSG(hwnd, msg, wparam, lparam);
- /* deal with window creation as a special case */
- if (msg == WM_CREATE) {
- /* To cause all the component child windows to be
+ gw = nsws_get_gui_window(hwnd);
+
+ switch (msg) {
+ case WM_NCCREATE: /* non client area create */
+ /* gw is passed as the lpParam from createwindowex() */
+ createstruct = (LPCREATESTRUCTW)lparam;
+ gw = (struct gui_window *)createstruct->lpCreateParams;
+
+ /* set the gui window associated with this window handle */
+ SetProp(hwnd, TEXT("GuiWnd"), (HANDLE)gw);
+
+ NSLOG(netsurf, INFO,
+ "created hWnd:%p hInstance %p GUI window %p",
+ hwnd, createstruct->hInstance, gw);
+
+ break;
+
+ case WM_CREATE:
+ /*
+ * To cause all the component child windows to be
* re-sized correctly a WM_SIZE message of the actual
* created size must be sent.
*
@@ -1344,19 +1417,9 @@ nsws_window_event_callback(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
* until after the WM_CREATE message is dispatched.
*/
GetClientRect(hwnd, &rmain);
- PostMessage(hwnd, WM_SIZE, 0, MAKELPARAM(rmain.right, rmain.bottom));
- return DefWindowProcW(hwnd, msg, wparam, lparam);
- }
-
-
- gw = nsws_get_gui_window(hwnd);
- if (gw == NULL) {
- NSLOG(netsurf, INFO,
- "Unable to find gui window structure for hwnd %p", hwnd);
- return DefWindowProcW(hwnd, msg, wparam, lparam);
- }
-
- switch (msg) {
+ PostMessage(hwnd, WM_SIZE, 0,
+ MAKELPARAM(rmain.right, rmain.bottom));
+ break;
case WM_CONTEXTMENU:
if (nsws_ctx_menu(gw, hwnd, GET_X_LPARAM(lparam),
@@ -1389,6 +1452,63 @@ nsws_window_event_callback(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
return DefWindowProcW(hwnd, msg, wparam, lparam);
}
+static void destroy_page_info_bitmaps(struct gui_window *gw)
+{
+ DeleteObject(gw->hPageInfo[PAGE_STATE_UNKNOWN]);
+ DeleteObject(gw->hPageInfo[PAGE_STATE_INTERNAL]);
+ DeleteObject(gw->hPageInfo[PAGE_STATE_LOCAL]);
+ DeleteObject(gw->hPageInfo[PAGE_STATE_INSECURE]);
+ DeleteObject(gw->hPageInfo[PAGE_STATE_SECURE_OVERRIDE]);
+ DeleteObject(gw->hPageInfo[PAGE_STATE_SECURE_ISSUES]);
+ DeleteObject(gw->hPageInfo[PAGE_STATE_SECURE]);
+}
+
+static void load_page_info_bitmaps(HINSTANCE hInstance, struct gui_window *gw)
+{
+ gw->hPageInfo[PAGE_STATE_UNKNOWN] = LoadImage(hInstance,
+ MAKEINTRESOURCE(IDB_PAGEINFO_INTERNAL),
+ IMAGE_BITMAP,
+ 0,
+ 0,
+ LR_DEFAULTCOLOR);
+ gw->hPageInfo[PAGE_STATE_INTERNAL] = LoadImage(hInstance,
+ MAKEINTRESOURCE(IDB_PAGEINFO_INTERNAL),
+ IMAGE_BITMAP,
+ 0,
+ 0,
+ LR_DEFAULTCOLOR);
+ gw->hPageInfo[PAGE_STATE_LOCAL] = LoadImage(hInstance,
+ MAKEINTRESOURCE(IDB_PAGEINFO_LOCAL),
+ IMAGE_BITMAP,
+ 0,
+ 0,
+ LR_DEFAULTCOLOR);
+ gw->hPageInfo[PAGE_STATE_INSECURE] = LoadImage(hInstance,
+ MAKEINTRESOURCE(IDB_PAGEINFO_INSECURE),
+ IMAGE_BITMAP,
+ 0,
+ 0,
+ LR_DEFAULTCOLOR);
+ gw->hPageInfo[PAGE_STATE_SECURE_OVERRIDE] = LoadImage(hInstance,
+ MAKEINTRESOURCE(IDB_PAGEINFO_WARNING),
+ IMAGE_BITMAP,
+ 0,
+ 0,
+ LR_DEFAULTCOLOR);
+ gw->hPageInfo[PAGE_STATE_SECURE_ISSUES] = LoadImage(hInstance,
+ MAKEINTRESOURCE(IDB_PAGEINFO_WARNING),
+ IMAGE_BITMAP,
+ 0,
+ 0,
+ LR_DEFAULTCOLOR);
+ gw->hPageInfo[PAGE_STATE_SECURE] = LoadImage(hInstance,
+ MAKEINTRESOURCE(IDB_PAGEINFO_SECURE),
+ IMAGE_BITMAP,
+ 0,
+ 0,
+ LR_DEFAULTCOLOR);
+}
+
/**
* create a new gui_window to contain a browser_window.
@@ -1422,6 +1542,8 @@ win32_window_create(struct browser_window *bw,
gw->requestscrolly = 0;
gw->localhistory = NULL;
+ load_page_info_bitmaps(hinst, gw);
+
gw->mouse = malloc(sizeof(struct browser_mouse));
if (gw->mouse == NULL) {
free(gw);
@@ -1480,6 +1602,8 @@ static void win32_window_destroy(struct gui_window *w)
DestroyAcceleratorTable(w->acceltable);
+ destroy_page_info_bitmaps(w);
+
free(w);
w = NULL;
}
@@ -1714,6 +1838,25 @@ static void win32_window_stop_throbber(struct gui_window *w)
/**
+ * win32 page info change.
+ *
+ * \param gw window to chnage info on
+ */
+static void win32_window_page_info_change(struct gui_window *gw)
+{
+ HWND hbutton;
+ browser_window_page_info_state pistate;
+
+ hbutton = GetProp(gw->toolbar, TEXT("hPGIbutton"));
+
+ pistate = browser_window_get_page_info_state(gw->bw);
+
+ SendMessageW(hbutton, BM_SETIMAGE, IMAGE_BITMAP,
+ (LPARAM)gw->hPageInfo[pistate]);
+}
+
+
+/**
* process miscellaneous window events
*
* \param gw The window receiving the event.
@@ -1740,6 +1883,10 @@ win32_window_event(struct gui_window *gw, enum gui_window_event event)
win32_window_stop_throbber(gw);
break;
+ case GW_EVENT_PAGE_INFO_CHANGE:
+ win32_window_page_info_change(gw);
+ break;
+
default:
break;
}
diff --git a/frontends/windows/window.h b/frontends/windows/window.h
index 80f5f27..5f43494 100644
--- a/frontends/windows/window.h
+++ b/frontends/windows/window.h
@@ -27,7 +27,7 @@ extern struct gui_window_table *win32_window_table;
struct browser_mouse {
struct gui_window *gui;
struct box *box;
-
+
double pressed_x;
double pressed_y;
bool waiting;
@@ -62,6 +62,8 @@ struct gui_window {
HACCEL acceltable; /**< accelerators */
+ HBITMAP hPageInfo[8]; /**< page info handles */
+
int scrollx; /**< current scroll location */
int scrolly; /**< current scroll location */
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=dba2df4b9aeb21b4c62...
commit dba2df4b9aeb21b4c62f9a0e1443852995821e5d
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
add page info resources to win32 frontend
diff --git a/frontends/windows/res/page-info-insecure.bmp b/frontends/windows/res/page-info-insecure.bmp
new file mode 100644
index 0000000..d8e15c3
Binary files /dev/null and b/frontends/windows/res/page-info-insecure.bmp differ
diff --git a/frontends/windows/res/page-info-internal.bmp b/frontends/windows/res/page-info-internal.bmp
new file mode 100644
index 0000000..b9b4eab
Binary files /dev/null and b/frontends/windows/res/page-info-internal.bmp differ
diff --git a/frontends/windows/res/page-info-local.bmp b/frontends/windows/res/page-info-local.bmp
new file mode 100644
index 0000000..51cd596
Binary files /dev/null and b/frontends/windows/res/page-info-local.bmp differ
diff --git a/frontends/windows/res/page-info-secure.bmp b/frontends/windows/res/page-info-secure.bmp
new file mode 100644
index 0000000..b08809c
Binary files /dev/null and b/frontends/windows/res/page-info-secure.bmp differ
diff --git a/frontends/windows/res/page-info-warning.bmp b/frontends/windows/res/page-info-warning.bmp
new file mode 100644
index 0000000..8e6b3af
Binary files /dev/null and b/frontends/windows/res/page-info-warning.bmp differ
diff --git a/frontends/windows/res/resource.rc b/frontends/windows/res/resource.rc
index e41a705..2d9e6cf 100644
--- a/frontends/windows/res/resource.rc
+++ b/frontends/windows/res/resource.rc
@@ -28,9 +28,31 @@ IDR_TOOLBAR_BITMAP_GREY BITMAP "toolbarg.bmp"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDR_TOOLBAR_BITMAP_HOT BITMAP "toolbarh.bmp"
+
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDR_THROBBER_AVI AVI "throbber.avi"
+
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+IDB_PAGEINFO_INSECURE BITMAP "page-info-insecure.bmp"
+
+
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+IDB_PAGEINFO_SECURE BITMAP "page-info-secure.bmp"
+
+
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+IDB_PAGEINFO_INTERNAL BITMAP "page-info-internal.bmp"
+
+
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+IDB_PAGEINFO_WARNING BITMAP "page-info-warning.bmp"
+
+
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+IDB_PAGEINFO_LOCAL BITMAP "page-info-local.bmp"
+
+
//
// Menu resources
//
diff --git a/frontends/windows/resourceid.h b/frontends/windows/resourceid.h
index e86d8ee..a0642b1 100644
--- a/frontends/windows/resourceid.h
+++ b/frontends/windows/resourceid.h
@@ -30,7 +30,12 @@
#define IDR_TOOLBAR_BITMAP_HOT 104
#define IDR_NETSURF_BANNER 105
#define IDR_HOME_BITMAP 106
-
+#define IDC_PAGEINFO 107
+#define IDB_PAGEINFO_INSECURE 108
+#define IDB_PAGEINFO_SECURE 109
+#define IDB_PAGEINFO_INTERNAL 110
+#define IDB_PAGEINFO_WARNING 111
+#define IDB_PAGEINFO_LOCAL 112
#define IDD_ABOUT 1000
#define IDC_IMG1 1001
-----------------------------------------------------------------------
Summary of changes:
frontends/windows/res/page-info-insecure.bmp | Bin 0 -> 890 bytes
frontends/windows/res/page-info-internal.bmp | Bin 0 -> 890 bytes
frontends/windows/res/page-info-local.bmp | Bin 0 -> 890 bytes
frontends/windows/res/page-info-secure.bmp | Bin 0 -> 890 bytes
frontends/windows/res/page-info-warning.bmp | Bin 0 -> 890 bytes
frontends/windows/res/resource.rc | 22 ++
frontends/windows/resourceid.h | 7 +-
frontends/windows/window.c | 311 +++++++++++++++++++-------
frontends/windows/window.h | 4 +-
9 files changed, 260 insertions(+), 84 deletions(-)
create mode 100644 frontends/windows/res/page-info-insecure.bmp
create mode 100644 frontends/windows/res/page-info-internal.bmp
create mode 100644 frontends/windows/res/page-info-local.bmp
create mode 100644 frontends/windows/res/page-info-secure.bmp
create mode 100644 frontends/windows/res/page-info-warning.bmp
diff --git a/frontends/windows/res/page-info-insecure.bmp b/frontends/windows/res/page-info-insecure.bmp
new file mode 100644
index 0000000..d8e15c3
Binary files /dev/null and b/frontends/windows/res/page-info-insecure.bmp differ
diff --git a/frontends/windows/res/page-info-internal.bmp b/frontends/windows/res/page-info-internal.bmp
new file mode 100644
index 0000000..b9b4eab
Binary files /dev/null and b/frontends/windows/res/page-info-internal.bmp differ
diff --git a/frontends/windows/res/page-info-local.bmp b/frontends/windows/res/page-info-local.bmp
new file mode 100644
index 0000000..51cd596
Binary files /dev/null and b/frontends/windows/res/page-info-local.bmp differ
diff --git a/frontends/windows/res/page-info-secure.bmp b/frontends/windows/res/page-info-secure.bmp
new file mode 100644
index 0000000..b08809c
Binary files /dev/null and b/frontends/windows/res/page-info-secure.bmp differ
diff --git a/frontends/windows/res/page-info-warning.bmp b/frontends/windows/res/page-info-warning.bmp
new file mode 100644
index 0000000..8e6b3af
Binary files /dev/null and b/frontends/windows/res/page-info-warning.bmp differ
diff --git a/frontends/windows/res/resource.rc b/frontends/windows/res/resource.rc
index e41a705..2d9e6cf 100644
--- a/frontends/windows/res/resource.rc
+++ b/frontends/windows/res/resource.rc
@@ -28,9 +28,31 @@ IDR_TOOLBAR_BITMAP_GREY BITMAP "toolbarg.bmp"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDR_TOOLBAR_BITMAP_HOT BITMAP "toolbarh.bmp"
+
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDR_THROBBER_AVI AVI "throbber.avi"
+
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+IDB_PAGEINFO_INSECURE BITMAP "page-info-insecure.bmp"
+
+
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+IDB_PAGEINFO_SECURE BITMAP "page-info-secure.bmp"
+
+
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+IDB_PAGEINFO_INTERNAL BITMAP "page-info-internal.bmp"
+
+
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+IDB_PAGEINFO_WARNING BITMAP "page-info-warning.bmp"
+
+
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+IDB_PAGEINFO_LOCAL BITMAP "page-info-local.bmp"
+
+
//
// Menu resources
//
diff --git a/frontends/windows/resourceid.h b/frontends/windows/resourceid.h
index e86d8ee..a0642b1 100644
--- a/frontends/windows/resourceid.h
+++ b/frontends/windows/resourceid.h
@@ -30,7 +30,12 @@
#define IDR_TOOLBAR_BITMAP_HOT 104
#define IDR_NETSURF_BANNER 105
#define IDR_HOME_BITMAP 106
-
+#define IDC_PAGEINFO 107
+#define IDB_PAGEINFO_INSECURE 108
+#define IDB_PAGEINFO_SECURE 109
+#define IDB_PAGEINFO_INTERNAL 110
+#define IDB_PAGEINFO_WARNING 111
+#define IDB_PAGEINFO_LOCAL 112
#define IDD_ABOUT 1000
#define IDC_IMG1 1001
diff --git a/frontends/windows/window.c b/frontends/windows/window.c
index 2748080..572e412 100644
--- a/frontends/windows/window.c
+++ b/frontends/windows/window.c
@@ -55,19 +55,34 @@
#include "windows/global_history.h"
#include "windows/window.h"
-/** List of all our gui windows */
+/**
+ * List of all gui windows
+ */
static struct gui_window *window_list = NULL;
-/** The main window class name */
+/**
+ * The main window class name
+ */
static const LPCWSTR windowclassname_main = L"nswsmainwindow";
-/** width of the throbber element */
+/**
+ * width of the throbber element
+ */
#define NSWS_THROBBER_WIDTH 24
-/** height of the url entry box */
+/**
+ * height of the url entry box
+ */
#define NSWS_URLBAR_HEIGHT 23
-/** Number of open windows */
+/**
+ * height of the Page Information bitmap button
+ */
+#define NSW32_PGIBUTTON_HEIGHT 16
+
+/**
+ * Number of open windows
+ */
static int open_windows = 0;
@@ -129,6 +144,23 @@ static HWND nsws_window_create(HINSTANCE hInstance, struct gui_window *gw)
{
HWND hwnd;
INITCOMMONCONTROLSEX icc;
+ int xpos = CW_USEDEFAULT;
+ int ypos = CW_USEDEFAULT;
+ int width = CW_USEDEFAULT;
+ int height = CW_USEDEFAULT;
+
+ if ((nsoption_int(window_width) >= 100) &&
+ (nsoption_int(window_height) >= 100) &&
+ (nsoption_int(window_x) >= 0) &&
+ (nsoption_int(window_y) >= 0)) {
+ xpos = nsoption_int(window_x);
+ ypos = nsoption_int(window_y);
+ width = nsoption_int(window_width);
+ height = nsoption_int(window_height);
+
+ NSLOG(netsurf, DEBUG, "Setting Window position %d,%d %d,%d",
+ xpos, ypos, width, height);
+ }
icc.dwSize = sizeof(icc);
icc.dwICC = ICC_BAR_CLASSES | ICC_WIN95_CLASSES;
@@ -140,51 +172,28 @@ static HWND nsws_window_create(HINSTANCE hInstance, struct gui_window *gw)
gw->mainmenu = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MENU_MAIN));
gw->rclick = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MENU_CONTEXT));
- NSLOG(netsurf, INFO,
- "creating hInstance %p GUI window %p",
- hInstance, gw);
hwnd = CreateWindowExW(0,
- windowclassname_main,
- L"NetSurf Browser",
- WS_OVERLAPPEDWINDOW |
- WS_CLIPCHILDREN |
- WS_CLIPSIBLINGS |
- CS_DBLCLKS,
- CW_USEDEFAULT,
- CW_USEDEFAULT,
- gw->width,
- gw->height,
- NULL,
- gw->mainmenu,
- hInstance,
- NULL);
+ windowclassname_main,
+ L"NetSurf Browser",
+ WS_OVERLAPPEDWINDOW |
+ WS_CLIPCHILDREN |
+ WS_CLIPSIBLINGS |
+ CS_DBLCLKS,
+ xpos,
+ ypos,
+ width,
+ height,
+ NULL,
+ gw->mainmenu,
+ hInstance,
+ (LPVOID)gw);
if (hwnd == NULL) {
NSLOG(netsurf, INFO, "Window create failed");
- return NULL;
- }
-
- /* set the gui window associated with this browser */
- SetProp(hwnd, TEXT("GuiWnd"), (HANDLE)gw);
-
- if ((nsoption_int(window_width) >= 100) &&
- (nsoption_int(window_height) >= 100) &&
- (nsoption_int(window_x) >= 0) &&
- (nsoption_int(window_y) >= 0)) {
- NSLOG(netsurf, INFO,
- "Setting Window position %d,%d %d,%d",
- nsoption_int(window_x), nsoption_int(window_y),
- nsoption_int(window_width), nsoption_int(window_height));
- SetWindowPos(hwnd, HWND_TOP,
- nsoption_int(window_x),
- nsoption_int(window_y),
- nsoption_int(window_width),
- nsoption_int(window_height),
- SWP_SHOWWINDOW);
+ } else {
+ nsws_window_set_accels(gw);
}
- nsws_window_set_accels(gw);
-
return hwnd;
}
@@ -295,7 +304,7 @@ urlbar_dimensions(HWND hWndParent,
/**
* callback for toolbar events
*
- * message handler for toolbar window
+ * subclass message handler for toolbar window
*
* \param hwnd win32 window handle message arrived for
* \param msg The message ID
@@ -311,7 +320,11 @@ nsws_window_toolbar_callback(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
LOG_WIN_MSG(hwnd, msg, wparam, lparam);
+ toolproc = (WNDPROC)GetProp(hwnd, TEXT("OrigMsgProc"));
+ assert(toolproc != NULL);
+
gw = nsws_get_gui_window(hwnd);
+ assert(gw != NULL);
switch (msg) {
case WM_SIZE:
@@ -347,19 +360,15 @@ nsws_window_toolbar_callback(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
return 0;
}
break;
- }
- /* remove properties if window is being destroyed */
- if (msg == WM_NCDESTROY) {
+ case WM_NCDESTROY:
+ /* remove properties if window is being destroyed */
RemoveProp(hwnd, TEXT("GuiWnd"));
- toolproc = (WNDPROC)RemoveProp(hwnd, TEXT("OrigMsgProc"));
- } else {
- toolproc = (WNDPROC)GetProp(hwnd, TEXT("OrigMsgProc"));
- }
+ RemoveProp(hwnd, TEXT("OrigMsgProc"));
+ /* put the original message handler back */
+ SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)toolproc);
+ break;
- if (toolproc == NULL) {
- /* the original toolbar procedure is not available */
- return DefWindowProc(hwnd, msg, wparam, lparam);
}
/* chain to the next handler */
@@ -367,10 +376,21 @@ nsws_window_toolbar_callback(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
}
+static void set_urlbar_edit_size(HWND hwnd)
+{
+ RECT rc;
+ GetClientRect(hwnd, &rc);
+ rc.left += NSW32_PGIBUTTON_HEIGHT;
+ SendMessage(hwnd, EM_SETRECT, 0, (LPARAM)&rc);
+ NSLOG(netsurf, DEBUG, "left:%ld right:%ld top:%ld bot:%ld",
+ rc.left,rc.right,rc.top,rc.bottom);
+}
+
+
/**
* callback for url bar events
*
- * message handler for urlbar window
+ * subclass message handler for urlbar window
*
* \param hwnd win32 window handle message arrived for
* \param msg The message ID
@@ -383,12 +403,15 @@ nsws_window_urlbar_callback(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
struct gui_window *gw;
WNDPROC urlproc;
HFONT hFont;
+ LRESULT result;
LOG_WIN_MSG(hwnd, msg, wparam, lparam);
- gw = nsws_get_gui_window(hwnd);
-
urlproc = (WNDPROC)GetProp(hwnd, TEXT("OrigMsgProc"));
+ assert(urlproc != NULL);
+
+ gw = nsws_get_gui_window(hwnd);
+ assert(gw != NULL);
/* override messages */
switch (msg) {
@@ -411,19 +434,21 @@ nsws_window_urlbar_callback(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
/* remove properties if window is being destroyed */
RemoveProp(hwnd, TEXT("GuiWnd"));
RemoveProp(hwnd, TEXT("OrigMsgProc"));
+ /* put the original message handler back */
+ SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)urlproc);
break;
- }
- if (urlproc == NULL) {
- /* the original toolbar procedure is not available */
- return DefWindowProc(hwnd, msg, wparam, lparam);
+ case WM_SIZE:
+ result = CallWindowProc(urlproc, hwnd, msg, wparam, lparam);
+ set_urlbar_edit_size(hwnd);
+ return result;
+
}
/* chain to the next handler */
return CallWindowProc(urlproc, hwnd, msg, wparam, lparam);
}
-
/**
* create a urlbar and message handler
*
@@ -441,6 +466,7 @@ nsws_window_urlbar_create(HINSTANCE hInstance,
{
int urlx, urly, urlwidth, urlheight;
HWND hwnd;
+ HWND hbutton;
WNDPROC urlproc;
HFONT hFont;
@@ -453,7 +479,8 @@ nsws_window_urlbar_create(HINSTANCE hInstance,
hwnd = CreateWindowEx(0L,
TEXT("Edit"),
NULL,
- WS_CHILD | WS_BORDER | WS_VISIBLE | ES_LEFT | ES_AUTOHSCROLL,
+ WS_CHILD | WS_BORDER | WS_VISIBLE |
+ ES_LEFT | ES_AUTOHSCROLL | ES_MULTILINE,
urlx,
urly,
urlwidth,
@@ -461,7 +488,7 @@ nsws_window_urlbar_create(HINSTANCE hInstance,
hWndParent,
(HMENU)IDC_MAIN_URLBAR,
hInstance,
- 0);
+ NULL);
if (hwnd == NULL) {
return NULL;
@@ -487,6 +514,28 @@ nsws_window_urlbar_create(HINSTANCE hInstance,
SendMessage(hwnd, WM_SETFONT, (WPARAM)hFont, 0);
}
+
+ /* Create the page info button */
+ hbutton = CreateWindowEx(0L,
+ TEXT("BUTTON"),
+ NULL,
+ WS_CHILD | WS_VISIBLE | BS_BITMAP | BS_FLAT,
+ (NSWS_URLBAR_HEIGHT - NSW32_PGIBUTTON_HEIGHT) /2,
+ (NSWS_URLBAR_HEIGHT - NSW32_PGIBUTTON_HEIGHT) /2,
+ NSW32_PGIBUTTON_HEIGHT,
+ NSW32_PGIBUTTON_HEIGHT,
+ hwnd,
+ (HMENU)IDC_PAGEINFO,
+ hInstance,
+ NULL);
+
+ /* put a property on the parent toolbar so it can set the page info */
+ SetProp(hWndParent, TEXT("hPGIbutton"), (HANDLE)hbutton);
+
+ SendMessageW(hbutton, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)gw->hPageInfo[PAGE_STATE_UNKNOWN]);
+
+ set_urlbar_edit_size(hwnd);
+
NSLOG(netsurf, INFO,
"Created url bar hwnd:%p, x:%d, y:%d, w:%d, h:%d", hwnd, urlx,
urly, urlwidth, urlheight);
@@ -620,7 +669,7 @@ nsws_window_create_toolbar(HINSTANCE hInstance,
hWndToolbar = CreateWindowEx(0,
TOOLBARCLASSNAME,
"Toolbar",
- WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT,
+ WS_CHILD | TBSTYLE_FLAT,
0, 0, 0, 0,
hWndParent,
NULL,
@@ -685,15 +734,21 @@ nsws_window_create_toolbar(HINSTANCE hInstance,
TB_BUTTONSTRUCTSIZE,
(WPARAM)sizeof(TBBUTTON),
0);
+
SendMessage(hWndToolbar,
TB_ADDBUTTONS,
(WPARAM)gw->toolbuttonc,
(LPARAM)&tbButtons);
+ /* create url widget */
gw->urlbar = nsws_window_urlbar_create(hInstance, hWndToolbar, gw);
+ /* create throbber widget */
gw->throbber = nsws_window_throbber_create(hInstance, hWndToolbar, gw);
+ SendMessage(hWndToolbar, TB_AUTOSIZE, 0, 0);
+ ShowWindow(hWndToolbar, TRUE);
+
return hWndToolbar;
}
@@ -1330,12 +1385,30 @@ nsws_window_event_callback(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
struct gui_window *gw;
RECT rmain;
+ LPCREATESTRUCTW createstruct;
LOG_WIN_MSG(hwnd, msg, wparam, lparam);
- /* deal with window creation as a special case */
- if (msg == WM_CREATE) {
- /* To cause all the component child windows to be
+ gw = nsws_get_gui_window(hwnd);
+
+ switch (msg) {
+ case WM_NCCREATE: /* non client area create */
+ /* gw is passed as the lpParam from createwindowex() */
+ createstruct = (LPCREATESTRUCTW)lparam;
+ gw = (struct gui_window *)createstruct->lpCreateParams;
+
+ /* set the gui window associated with this window handle */
+ SetProp(hwnd, TEXT("GuiWnd"), (HANDLE)gw);
+
+ NSLOG(netsurf, INFO,
+ "created hWnd:%p hInstance %p GUI window %p",
+ hwnd, createstruct->hInstance, gw);
+
+ break;
+
+ case WM_CREATE:
+ /*
+ * To cause all the component child windows to be
* re-sized correctly a WM_SIZE message of the actual
* created size must be sent.
*
@@ -1344,19 +1417,9 @@ nsws_window_event_callback(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
* until after the WM_CREATE message is dispatched.
*/
GetClientRect(hwnd, &rmain);
- PostMessage(hwnd, WM_SIZE, 0, MAKELPARAM(rmain.right, rmain.bottom));
- return DefWindowProcW(hwnd, msg, wparam, lparam);
- }
-
-
- gw = nsws_get_gui_window(hwnd);
- if (gw == NULL) {
- NSLOG(netsurf, INFO,
- "Unable to find gui window structure for hwnd %p", hwnd);
- return DefWindowProcW(hwnd, msg, wparam, lparam);
- }
-
- switch (msg) {
+ PostMessage(hwnd, WM_SIZE, 0,
+ MAKELPARAM(rmain.right, rmain.bottom));
+ break;
case WM_CONTEXTMENU:
if (nsws_ctx_menu(gw, hwnd, GET_X_LPARAM(lparam),
@@ -1389,6 +1452,63 @@ nsws_window_event_callback(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
return DefWindowProcW(hwnd, msg, wparam, lparam);
}
+static void destroy_page_info_bitmaps(struct gui_window *gw)
+{
+ DeleteObject(gw->hPageInfo[PAGE_STATE_UNKNOWN]);
+ DeleteObject(gw->hPageInfo[PAGE_STATE_INTERNAL]);
+ DeleteObject(gw->hPageInfo[PAGE_STATE_LOCAL]);
+ DeleteObject(gw->hPageInfo[PAGE_STATE_INSECURE]);
+ DeleteObject(gw->hPageInfo[PAGE_STATE_SECURE_OVERRIDE]);
+ DeleteObject(gw->hPageInfo[PAGE_STATE_SECURE_ISSUES]);
+ DeleteObject(gw->hPageInfo[PAGE_STATE_SECURE]);
+}
+
+static void load_page_info_bitmaps(HINSTANCE hInstance, struct gui_window *gw)
+{
+ gw->hPageInfo[PAGE_STATE_UNKNOWN] = LoadImage(hInstance,
+ MAKEINTRESOURCE(IDB_PAGEINFO_INTERNAL),
+ IMAGE_BITMAP,
+ 0,
+ 0,
+ LR_DEFAULTCOLOR);
+ gw->hPageInfo[PAGE_STATE_INTERNAL] = LoadImage(hInstance,
+ MAKEINTRESOURCE(IDB_PAGEINFO_INTERNAL),
+ IMAGE_BITMAP,
+ 0,
+ 0,
+ LR_DEFAULTCOLOR);
+ gw->hPageInfo[PAGE_STATE_LOCAL] = LoadImage(hInstance,
+ MAKEINTRESOURCE(IDB_PAGEINFO_LOCAL),
+ IMAGE_BITMAP,
+ 0,
+ 0,
+ LR_DEFAULTCOLOR);
+ gw->hPageInfo[PAGE_STATE_INSECURE] = LoadImage(hInstance,
+ MAKEINTRESOURCE(IDB_PAGEINFO_INSECURE),
+ IMAGE_BITMAP,
+ 0,
+ 0,
+ LR_DEFAULTCOLOR);
+ gw->hPageInfo[PAGE_STATE_SECURE_OVERRIDE] = LoadImage(hInstance,
+ MAKEINTRESOURCE(IDB_PAGEINFO_WARNING),
+ IMAGE_BITMAP,
+ 0,
+ 0,
+ LR_DEFAULTCOLOR);
+ gw->hPageInfo[PAGE_STATE_SECURE_ISSUES] = LoadImage(hInstance,
+ MAKEINTRESOURCE(IDB_PAGEINFO_WARNING),
+ IMAGE_BITMAP,
+ 0,
+ 0,
+ LR_DEFAULTCOLOR);
+ gw->hPageInfo[PAGE_STATE_SECURE] = LoadImage(hInstance,
+ MAKEINTRESOURCE(IDB_PAGEINFO_SECURE),
+ IMAGE_BITMAP,
+ 0,
+ 0,
+ LR_DEFAULTCOLOR);
+}
+
/**
* create a new gui_window to contain a browser_window.
@@ -1422,6 +1542,8 @@ win32_window_create(struct browser_window *bw,
gw->requestscrolly = 0;
gw->localhistory = NULL;
+ load_page_info_bitmaps(hinst, gw);
+
gw->mouse = malloc(sizeof(struct browser_mouse));
if (gw->mouse == NULL) {
free(gw);
@@ -1480,6 +1602,8 @@ static void win32_window_destroy(struct gui_window *w)
DestroyAcceleratorTable(w->acceltable);
+ destroy_page_info_bitmaps(w);
+
free(w);
w = NULL;
}
@@ -1714,6 +1838,25 @@ static void win32_window_stop_throbber(struct gui_window *w)
/**
+ * win32 page info change.
+ *
+ * \param gw window to chnage info on
+ */
+static void win32_window_page_info_change(struct gui_window *gw)
+{
+ HWND hbutton;
+ browser_window_page_info_state pistate;
+
+ hbutton = GetProp(gw->toolbar, TEXT("hPGIbutton"));
+
+ pistate = browser_window_get_page_info_state(gw->bw);
+
+ SendMessageW(hbutton, BM_SETIMAGE, IMAGE_BITMAP,
+ (LPARAM)gw->hPageInfo[pistate]);
+}
+
+
+/**
* process miscellaneous window events
*
* \param gw The window receiving the event.
@@ -1740,6 +1883,10 @@ win32_window_event(struct gui_window *gw, enum gui_window_event event)
win32_window_stop_throbber(gw);
break;
+ case GW_EVENT_PAGE_INFO_CHANGE:
+ win32_window_page_info_change(gw);
+ break;
+
default:
break;
}
diff --git a/frontends/windows/window.h b/frontends/windows/window.h
index 80f5f27..5f43494 100644
--- a/frontends/windows/window.h
+++ b/frontends/windows/window.h
@@ -27,7 +27,7 @@ extern struct gui_window_table *win32_window_table;
struct browser_mouse {
struct gui_window *gui;
struct box *box;
-
+
double pressed_x;
double pressed_y;
bool waiting;
@@ -62,6 +62,8 @@ struct gui_window {
HACCEL acceltable; /**< accelerators */
+ HBITMAP hPageInfo[8]; /**< page info handles */
+
int scrollx; /**< current scroll location */
int scrolly; /**< current scroll location */
--
NetSurf Browser
3 years, 9 months
netsurf: branch master updated. release/3.9-390-gf081ffb
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/f081ffb7e8f9533cc74ba...
...commit http://git.netsurf-browser.org/netsurf.git/commit/f081ffb7e8f9533cc74bacc...
...tree http://git.netsurf-browser.org/netsurf.git/tree/f081ffb7e8f9533cc74bacc7e...
The branch, master has been updated
via f081ffb7e8f9533cc74bacc7e836a79ae9b0808d (commit)
from 4c68def4321911e417a98deb1d394fb96e42100f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=f081ffb7e8f9533cc74...
commit f081ffb7e8f9533cc74bacc7e836a79ae9b0808d
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
fix win32 font measurement of non ascii strings.
This greatly improves line breaking and font measurement in the
windows frontend.
diff --git a/frontends/windows/font.c b/frontends/windows/font.c
index 7389bd8..3e81a80 100644
--- a/frontends/windows/font.c
+++ b/frontends/windows/font.c
@@ -93,23 +93,31 @@ HFONT get_font(const plot_font_style_t *style)
{
char *face = NULL;
DWORD family;
+ int nHeight;
+ HDC hdc;
+ HFONT font;
+
switch(style->family) {
case PLOT_FONT_FAMILY_SERIF:
face = strdup(nsoption_charp(font_serif));
family = FF_ROMAN | DEFAULT_PITCH;
break;
+
case PLOT_FONT_FAMILY_MONOSPACE:
face = strdup(nsoption_charp(font_mono));
family = FF_MODERN | DEFAULT_PITCH;
break;
+
case PLOT_FONT_FAMILY_CURSIVE:
face = strdup(nsoption_charp(font_cursive));
family = FF_SCRIPT | DEFAULT_PITCH;
break;
+
case PLOT_FONT_FAMILY_FANTASY:
face = strdup(nsoption_charp(font_fantasy));
family = FF_DECORATIVE | DEFAULT_PITCH;
break;
+
case PLOT_FONT_FAMILY_SANS_SERIF:
default:
face = strdup(nsoption_charp(font_sans));
@@ -117,30 +125,30 @@ HFONT get_font(const plot_font_style_t *style)
break;
}
- int nHeight = -10;
+ nHeight = -10;
- HDC hdc = GetDC(font_hwnd);
+ hdc = GetDC(font_hwnd);
nHeight = -MulDiv(style->size, GetDeviceCaps(hdc, LOGPIXELSY), 72 * PLOT_STYLE_SCALE);
ReleaseDC(font_hwnd, hdc);
- HFONT font = CreateFont(
- nHeight, /* height */
- 0, /* width */
- 0, /* escapement*/
- 0, /* orientation */
- style->weight,
- (style->flags & FONTF_ITALIC) ? TRUE : FALSE,
- FALSE, /* underline */
- FALSE, /* strike */
- DEFAULT_CHARSET, /* for locale */
- OUT_DEFAULT_PRECIS, /* general 'best match' */
- CLIP_DEFAULT_PRECIS,
- DEFAULT_QUALITY,
- family,
- face /* name of font face */
- );
- if (face != NULL)
+ font = CreateFont(nHeight, /* height */
+ 0, /* width */
+ 0, /* escapement*/
+ 0, /* orientation */
+ style->weight,
+ (style->flags & FONTF_ITALIC) ? TRUE : FALSE,
+ FALSE, /* underline */
+ FALSE, /* strike */
+ DEFAULT_CHARSET, /* for locale */
+ OUT_DEFAULT_PRECIS, /* general 'best match' */
+ CLIP_DEFAULT_PRECIS,
+ DEFAULT_QUALITY,
+ family,
+ face); /* name of font face */
+
+ if (face != NULL) {
free(face);
+ }
if (font == NULL) {
if (style->family == PLOT_FONT_FAMILY_MONOSPACE) {
@@ -149,50 +157,67 @@ HFONT get_font(const plot_font_style_t *style)
font = (HFONT) GetStockObject(ANSI_VAR_FONT);
}
}
- if (font == NULL)
+
+ if (font == NULL) {
font = (HFONT) GetStockObject(SYSTEM_FONT);
+ }
+
return font;
}
+/* size of temporary wide character string for computing string width */
+#define WSTRLEN 4096
+
/**
* Measure the width of a string.
*
* \param[in] style plot style for this text
- * \param[in] string UTF-8 string to measure
- * \param[in] length length of string, in bytes
+ * \param[in] utf8str string encoded in UTF-8 to measure
+ * \param[in] utf8len length of string, in bytes
* \param[out] width updated to width of string[0..length)
* \return NSERROR_OK on success otherwise appropriate error code
*/
static nserror
win32_font_width(const plot_font_style_t *style,
- const char *string,
- size_t length,
+ const char *utf8str,
+ size_t utf8len,
int *width)
{
+ nserror ret = NSERROR_OK;
HDC hdc;
HFONT font;
HFONT fontbak;
- SIZE s;
- nserror ret = NSERROR_OK;
+ SIZE sizl; /* size in logical units */
+ BOOL wres;
+ int wclen; /* wide char length */
+ static WCHAR wstr[WSTRLEN]; /* temporary wide char string */
- if (length == 0) {
+ if (utf8len == 0) {
*width = 0;
- } else {
- hdc = GetDC(NULL);
- font = get_font(style);
- fontbak = SelectObject(hdc, font);
+ return ret;
+ }
- /* may well need to convert utf-8 to lpctstr */
- if (GetTextExtentPoint32A(hdc, string, length, &s) != 0) {
- *width = s.cx;
+ hdc = GetDC(NULL);
+ font = get_font(style);
+ fontbak = SelectObject(hdc, font);
+
+ wclen = MultiByteToWideChar(CP_UTF8, 0, utf8str, utf8len, wstr, WSTRLEN);
+ if (wclen != 0) {
+ wres = GetTextExtentPoint32W(hdc, wstr, wclen, &sizl);
+ if (wres == FALSE) {
+ ret = NSERROR_INVALID;
} else {
- ret = NSERROR_UNKNOWN;
+ *width = sizl.cx;
}
- font = SelectObject(hdc, fontbak);
- DeleteObject(font);
- ReleaseDC(NULL, hdc);
+ } else {
+ ret = NSERROR_NOSPACE;
}
+
+ font = SelectObject(hdc, fontbak);
+ DeleteObject(font);
+ ReleaseDC(NULL, hdc);
+
return ret;
}
@@ -200,19 +225,19 @@ win32_font_width(const plot_font_style_t *style,
/**
* Find the position in a string where an x coordinate falls.
*
- * \param style css_style for this text, with style->font_size.size ==
+ * \param style css_style for this text, with style->font_size.size ==
* CSS_FONT_SIZE_LENGTH
- * \param string UTF-8 string to measure
- * \param length length of string
- * \param x x coordinate to search for
- * \param char_offset updated to offset in string of actual_x, [0..length]
- * \param actual_x updated to x coordinate of character closest to x
+ * \param utf8str string to measure encoded in UTF-8
+ * \param utf8len length of string
+ * \param x coordinate to search for
+ * \param char_offset updated to offset in string of actual_x, [0..length]
+ * \param actual_x updated to x coordinate of character closest to x
* \return NSERROR_OK on success otherwise appropriate error code
*/
static nserror
win32_font_position(const plot_font_style_t *style,
- const char *string,
- size_t length,
+ const char *utf8str,
+ size_t utf8len,
int x,
size_t *char_offset,
int *actual_x)
@@ -224,26 +249,29 @@ win32_font_position(const plot_font_style_t *style,
int offset;
nserror ret = NSERROR_OK;
- if ((length == 0) || (x < 1)) {
+ /* deal with zero length input or invalid search co-ordiate */
+ if ((utf8len == 0) || (x < 1)) {
*char_offset = 0;
*actual_x = 0;
+ return ret;
+ }
+
+ hdc = GetDC(NULL);
+ font = get_font(style);
+ fontbak = SelectObject(hdc, font);
+
+ if ((GetTextExtentExPointA(hdc, utf8str, utf8len, x, &offset, NULL, &s) != 0) &&
+ (GetTextExtentPoint32A(hdc, utf8str, offset, &s) != 0)) {
+ *char_offset = (size_t)offset;
+ *actual_x = s.cx;
} else {
- hdc = GetDC(NULL);
- font = get_font(style);
- fontbak = SelectObject(hdc, font);
-
- if ((GetTextExtentExPointA(hdc, string, length, x, &offset, NULL,&s) != 0) &&
- (GetTextExtentPoint32A(hdc, string, offset, &s) != 0)) {
- *char_offset = (size_t)offset;
- *actual_x = s.cx;
- } else {
- ret = NSERROR_UNKNOWN;
- }
- font = SelectObject(hdc, fontbak);
- DeleteObject(font);
- ReleaseDC(NULL, hdc);
+ ret = NSERROR_UNKNOWN;
}
+ font = SelectObject(hdc, fontbak);
+ DeleteObject(font);
+ ReleaseDC(NULL, hdc);
+
return ret;
}
@@ -256,7 +284,7 @@ win32_font_position(const plot_font_style_t *style,
* \param string UTF-8 string to measure
* \param length length of string
* \param x width available
- * \param char_offset updated to offset in string of actual_x, [0..length]
+ * \param[out] offset updated to offset in string of actual_x, [0..length]
* \param actual_x updated to x coordinate of character closest to x
* \return NSERROR_OK on success otherwise appropriate error code
*
@@ -269,52 +297,48 @@ win32_font_split(const plot_font_style_t *style,
const char *string,
size_t length,
int x,
- size_t *char_offset,
+ size_t *offset,
int *actual_x)
{
+ nserror res;
int c_off;
- nserror ret = NSERROR_UNKNOWN;
-
- if (win32_font_position(style,
- string,
- length,
- x,
- char_offset,
- actual_x) == NSERROR_OK) {
- c_off = *char_offset;
- if (*char_offset == length) {
- ret = NSERROR_OK;
- } else {
- bool success;
- while ((string[*char_offset] != ' ') &&
- (*char_offset > 0)) {
- (*char_offset)--;
- }
-
- if (*char_offset == 0) {
- *char_offset = c_off;
- while ((*char_offset < length) &&
- (string[*char_offset] != ' ')) {
- (*char_offset)++;
- }
- }
-
- success = win32_font_width(style,
- string,
- *char_offset,
- actual_x);
- if (success) {
- ret = NSERROR_OK;
- }
+
+ /* get the offset into teh string on the proposed position */
+ res = win32_font_position(style, string, length, x, offset, actual_x);
+ if (res != NSERROR_OK) {
+ return res;
+ }
+
+ /* return the whole string fits in the proposed length */
+ if (*offset == length) {
+ return NSERROR_OK;
+ }
+
+ c_off = *offset;
+
+ /* walk backwards through string looking for space to break on */
+ while ((string[*offset] != ' ') &&
+ (*offset > 0)) {
+ (*offset)--;
+ }
+
+ /* walk forwards through string looking for space if back failed */
+ if (*offset == 0) {
+ *offset = c_off;
+ while ((*offset < length) &&
+ (string[*offset] != ' ')) {
+ (*offset)++;
}
}
+ /* find the actual string width of the break */
+ res = win32_font_width(style, string, *offset, actual_x);
NSLOG(netsurf, DEEPDEBUG,
"ret %d Split %u chars at %ipx: Split at char %i (%ipx) - %.*s",
- ret, length, x, *char_offset, *actual_x, *char_offset, string);
+ res, length, x, *offset, *actual_x, *offset, string);
- return ret;
+ return res;
}
-----------------------------------------------------------------------
Summary of changes:
frontends/windows/font.c | 220 +++++++++++++++++++++++++---------------------
1 file changed, 122 insertions(+), 98 deletions(-)
diff --git a/frontends/windows/font.c b/frontends/windows/font.c
index 7389bd8..3e81a80 100644
--- a/frontends/windows/font.c
+++ b/frontends/windows/font.c
@@ -93,23 +93,31 @@ HFONT get_font(const plot_font_style_t *style)
{
char *face = NULL;
DWORD family;
+ int nHeight;
+ HDC hdc;
+ HFONT font;
+
switch(style->family) {
case PLOT_FONT_FAMILY_SERIF:
face = strdup(nsoption_charp(font_serif));
family = FF_ROMAN | DEFAULT_PITCH;
break;
+
case PLOT_FONT_FAMILY_MONOSPACE:
face = strdup(nsoption_charp(font_mono));
family = FF_MODERN | DEFAULT_PITCH;
break;
+
case PLOT_FONT_FAMILY_CURSIVE:
face = strdup(nsoption_charp(font_cursive));
family = FF_SCRIPT | DEFAULT_PITCH;
break;
+
case PLOT_FONT_FAMILY_FANTASY:
face = strdup(nsoption_charp(font_fantasy));
family = FF_DECORATIVE | DEFAULT_PITCH;
break;
+
case PLOT_FONT_FAMILY_SANS_SERIF:
default:
face = strdup(nsoption_charp(font_sans));
@@ -117,30 +125,30 @@ HFONT get_font(const plot_font_style_t *style)
break;
}
- int nHeight = -10;
+ nHeight = -10;
- HDC hdc = GetDC(font_hwnd);
+ hdc = GetDC(font_hwnd);
nHeight = -MulDiv(style->size, GetDeviceCaps(hdc, LOGPIXELSY), 72 * PLOT_STYLE_SCALE);
ReleaseDC(font_hwnd, hdc);
- HFONT font = CreateFont(
- nHeight, /* height */
- 0, /* width */
- 0, /* escapement*/
- 0, /* orientation */
- style->weight,
- (style->flags & FONTF_ITALIC) ? TRUE : FALSE,
- FALSE, /* underline */
- FALSE, /* strike */
- DEFAULT_CHARSET, /* for locale */
- OUT_DEFAULT_PRECIS, /* general 'best match' */
- CLIP_DEFAULT_PRECIS,
- DEFAULT_QUALITY,
- family,
- face /* name of font face */
- );
- if (face != NULL)
+ font = CreateFont(nHeight, /* height */
+ 0, /* width */
+ 0, /* escapement*/
+ 0, /* orientation */
+ style->weight,
+ (style->flags & FONTF_ITALIC) ? TRUE : FALSE,
+ FALSE, /* underline */
+ FALSE, /* strike */
+ DEFAULT_CHARSET, /* for locale */
+ OUT_DEFAULT_PRECIS, /* general 'best match' */
+ CLIP_DEFAULT_PRECIS,
+ DEFAULT_QUALITY,
+ family,
+ face); /* name of font face */
+
+ if (face != NULL) {
free(face);
+ }
if (font == NULL) {
if (style->family == PLOT_FONT_FAMILY_MONOSPACE) {
@@ -149,50 +157,67 @@ HFONT get_font(const plot_font_style_t *style)
font = (HFONT) GetStockObject(ANSI_VAR_FONT);
}
}
- if (font == NULL)
+
+ if (font == NULL) {
font = (HFONT) GetStockObject(SYSTEM_FONT);
+ }
+
return font;
}
+/* size of temporary wide character string for computing string width */
+#define WSTRLEN 4096
+
/**
* Measure the width of a string.
*
* \param[in] style plot style for this text
- * \param[in] string UTF-8 string to measure
- * \param[in] length length of string, in bytes
+ * \param[in] utf8str string encoded in UTF-8 to measure
+ * \param[in] utf8len length of string, in bytes
* \param[out] width updated to width of string[0..length)
* \return NSERROR_OK on success otherwise appropriate error code
*/
static nserror
win32_font_width(const plot_font_style_t *style,
- const char *string,
- size_t length,
+ const char *utf8str,
+ size_t utf8len,
int *width)
{
+ nserror ret = NSERROR_OK;
HDC hdc;
HFONT font;
HFONT fontbak;
- SIZE s;
- nserror ret = NSERROR_OK;
+ SIZE sizl; /* size in logical units */
+ BOOL wres;
+ int wclen; /* wide char length */
+ static WCHAR wstr[WSTRLEN]; /* temporary wide char string */
- if (length == 0) {
+ if (utf8len == 0) {
*width = 0;
- } else {
- hdc = GetDC(NULL);
- font = get_font(style);
- fontbak = SelectObject(hdc, font);
+ return ret;
+ }
- /* may well need to convert utf-8 to lpctstr */
- if (GetTextExtentPoint32A(hdc, string, length, &s) != 0) {
- *width = s.cx;
+ hdc = GetDC(NULL);
+ font = get_font(style);
+ fontbak = SelectObject(hdc, font);
+
+ wclen = MultiByteToWideChar(CP_UTF8, 0, utf8str, utf8len, wstr, WSTRLEN);
+ if (wclen != 0) {
+ wres = GetTextExtentPoint32W(hdc, wstr, wclen, &sizl);
+ if (wres == FALSE) {
+ ret = NSERROR_INVALID;
} else {
- ret = NSERROR_UNKNOWN;
+ *width = sizl.cx;
}
- font = SelectObject(hdc, fontbak);
- DeleteObject(font);
- ReleaseDC(NULL, hdc);
+ } else {
+ ret = NSERROR_NOSPACE;
}
+
+ font = SelectObject(hdc, fontbak);
+ DeleteObject(font);
+ ReleaseDC(NULL, hdc);
+
return ret;
}
@@ -200,19 +225,19 @@ win32_font_width(const plot_font_style_t *style,
/**
* Find the position in a string where an x coordinate falls.
*
- * \param style css_style for this text, with style->font_size.size ==
+ * \param style css_style for this text, with style->font_size.size ==
* CSS_FONT_SIZE_LENGTH
- * \param string UTF-8 string to measure
- * \param length length of string
- * \param x x coordinate to search for
- * \param char_offset updated to offset in string of actual_x, [0..length]
- * \param actual_x updated to x coordinate of character closest to x
+ * \param utf8str string to measure encoded in UTF-8
+ * \param utf8len length of string
+ * \param x coordinate to search for
+ * \param char_offset updated to offset in string of actual_x, [0..length]
+ * \param actual_x updated to x coordinate of character closest to x
* \return NSERROR_OK on success otherwise appropriate error code
*/
static nserror
win32_font_position(const plot_font_style_t *style,
- const char *string,
- size_t length,
+ const char *utf8str,
+ size_t utf8len,
int x,
size_t *char_offset,
int *actual_x)
@@ -224,26 +249,29 @@ win32_font_position(const plot_font_style_t *style,
int offset;
nserror ret = NSERROR_OK;
- if ((length == 0) || (x < 1)) {
+ /* deal with zero length input or invalid search co-ordiate */
+ if ((utf8len == 0) || (x < 1)) {
*char_offset = 0;
*actual_x = 0;
+ return ret;
+ }
+
+ hdc = GetDC(NULL);
+ font = get_font(style);
+ fontbak = SelectObject(hdc, font);
+
+ if ((GetTextExtentExPointA(hdc, utf8str, utf8len, x, &offset, NULL, &s) != 0) &&
+ (GetTextExtentPoint32A(hdc, utf8str, offset, &s) != 0)) {
+ *char_offset = (size_t)offset;
+ *actual_x = s.cx;
} else {
- hdc = GetDC(NULL);
- font = get_font(style);
- fontbak = SelectObject(hdc, font);
-
- if ((GetTextExtentExPointA(hdc, string, length, x, &offset, NULL,&s) != 0) &&
- (GetTextExtentPoint32A(hdc, string, offset, &s) != 0)) {
- *char_offset = (size_t)offset;
- *actual_x = s.cx;
- } else {
- ret = NSERROR_UNKNOWN;
- }
- font = SelectObject(hdc, fontbak);
- DeleteObject(font);
- ReleaseDC(NULL, hdc);
+ ret = NSERROR_UNKNOWN;
}
+ font = SelectObject(hdc, fontbak);
+ DeleteObject(font);
+ ReleaseDC(NULL, hdc);
+
return ret;
}
@@ -256,7 +284,7 @@ win32_font_position(const plot_font_style_t *style,
* \param string UTF-8 string to measure
* \param length length of string
* \param x width available
- * \param char_offset updated to offset in string of actual_x, [0..length]
+ * \param[out] offset updated to offset in string of actual_x, [0..length]
* \param actual_x updated to x coordinate of character closest to x
* \return NSERROR_OK on success otherwise appropriate error code
*
@@ -269,52 +297,48 @@ win32_font_split(const plot_font_style_t *style,
const char *string,
size_t length,
int x,
- size_t *char_offset,
+ size_t *offset,
int *actual_x)
{
+ nserror res;
int c_off;
- nserror ret = NSERROR_UNKNOWN;
-
- if (win32_font_position(style,
- string,
- length,
- x,
- char_offset,
- actual_x) == NSERROR_OK) {
- c_off = *char_offset;
- if (*char_offset == length) {
- ret = NSERROR_OK;
- } else {
- bool success;
- while ((string[*char_offset] != ' ') &&
- (*char_offset > 0)) {
- (*char_offset)--;
- }
-
- if (*char_offset == 0) {
- *char_offset = c_off;
- while ((*char_offset < length) &&
- (string[*char_offset] != ' ')) {
- (*char_offset)++;
- }
- }
-
- success = win32_font_width(style,
- string,
- *char_offset,
- actual_x);
- if (success) {
- ret = NSERROR_OK;
- }
+
+ /* get the offset into teh string on the proposed position */
+ res = win32_font_position(style, string, length, x, offset, actual_x);
+ if (res != NSERROR_OK) {
+ return res;
+ }
+
+ /* return the whole string fits in the proposed length */
+ if (*offset == length) {
+ return NSERROR_OK;
+ }
+
+ c_off = *offset;
+
+ /* walk backwards through string looking for space to break on */
+ while ((string[*offset] != ' ') &&
+ (*offset > 0)) {
+ (*offset)--;
+ }
+
+ /* walk forwards through string looking for space if back failed */
+ if (*offset == 0) {
+ *offset = c_off;
+ while ((*offset < length) &&
+ (string[*offset] != ' ')) {
+ (*offset)++;
}
}
+ /* find the actual string width of the break */
+ res = win32_font_width(style, string, *offset, actual_x);
NSLOG(netsurf, DEEPDEBUG,
"ret %d Split %u chars at %ipx: Split at char %i (%ipx) - %.*s",
- ret, length, x, *char_offset, *actual_x, *char_offset, string);
+ res, length, x, *offset, *actual_x, *offset, string);
- return ret;
+ return res;
}
--
NetSurf Browser
3 years, 9 months
netsurf: branch master updated. release/3.9-389-g4c68def
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/4c68def4321911e417a98...
...commit http://git.netsurf-browser.org/netsurf.git/commit/4c68def4321911e417a98de...
...tree http://git.netsurf-browser.org/netsurf.git/tree/4c68def4321911e417a98deb1...
The branch, master has been updated
via 4c68def4321911e417a98deb1d394fb96e42100f (commit)
via 77d184913b64b1613ac70acb23c1230c5ec41e67 (commit)
via 56ddeed96c10bae6e67b7e15ee6fa982a0f40b3f (commit)
via 2f7de349ea4b9f26bf14d0ee5704cfe248462dd7 (commit)
from faf667ada7181b50890bc9fc970b99da0916d02c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=4c68def4321911e417a...
commit 4c68def4321911e417a98deb1d394fb96e42100f
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
extend search for certificate file to include resource paths
diff --git a/frontends/windows/main.c b/frontends/windows/main.c
index 2dd403e..eb0a866 100644
--- a/frontends/windows/main.c
+++ b/frontends/windows/main.c
@@ -190,6 +190,11 @@ static nserror set_defaults(struct nsoption_s *defaults)
&ptr);
if (res_len > 0) {
nsoption_setnull_charp(ca_bundle, strdup(buf));
+ } else {
+ ptr = filepath_sfind(G_resource_pathv, buf, "ca-bundle.crt");
+ if (ptr != NULL) {
+ nsoption_setnull_charp(ca_bundle, strdup(buf));
+ }
}
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=77d184913b64b1613ac...
commit 77d184913b64b1613ac70acb23c1230c5ec41e67
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
rename global resource path variables in win32 frontend
diff --git a/frontends/windows/fetch.c b/frontends/windows/fetch.c
index f69d7ad..287f20f 100644
--- a/frontends/windows/fetch.c
+++ b/frontends/windows/fetch.c
@@ -79,7 +79,7 @@ static nsurl *nsw32_get_resource_url(const char *path)
char buf[PATH_MAX];
nsurl *url = NULL;
- netsurf_path_to_nsurl(filepath_sfind(respaths, buf, path), &url);
+ netsurf_path_to_nsurl(filepath_sfind(G_resource_pathv, buf, path), &url);
return url;
}
diff --git a/frontends/windows/gui.c b/frontends/windows/gui.c
index 490f234..fdfafcf 100644
--- a/frontends/windows/gui.c
+++ b/frontends/windows/gui.c
@@ -41,13 +41,15 @@
#include "windows/window.h"
#include "windows/gui.h"
-/**
- * win32 application instance handle.
- *
- * This handle is set in the main windows entry point.
- */
+/* exported global defined in windows/gui.h */
HINSTANCE hinst;
+/* exported global defined in windows/gui.h */
+char **G_resource_pathv;
+
+/* exported global defined in windows/gui.h */
+char *G_config_path;
+
static bool win32_quit = false;
struct dialog_list_entry {
diff --git a/frontends/windows/gui.h b/frontends/windows/gui.h
index 8f8f0bc..0633c93 100644
--- a/frontends/windows/gui.h
+++ b/frontends/windows/gui.h
@@ -22,13 +22,22 @@
struct gui_window;
+/**
+ * win32 application instance handle.
+ *
+ * This handle is set in the main windows entry point.
+ */
extern HINSTANCE hinst;
-/** Directory where all configuration files are held. */
-extern char *nsw32_config_home;
+/**
+ * path to where all user config files are held.
+ */
+extern char *G_config_path;
-/** resource search path vector. */
-extern char **respaths;
+/**
+ * resource search path vector.
+ */
+extern char **G_resource_pathv;
/* bounding box */
typedef struct bbox_s {
diff --git a/frontends/windows/main.c b/frontends/windows/main.c
index cf94712..2dd403e 100644
--- a/frontends/windows/main.c
+++ b/frontends/windows/main.c
@@ -57,9 +57,6 @@
#include "windows/clipboard.h"
#include "windows/gui.h"
-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.
@@ -224,28 +221,28 @@ static nserror set_defaults(struct nsoption_s *defaults)
/* cookie file default */
fname = NULL;
- netsurf_mkpath(&fname, NULL, 2, nsw32_config_home, "Cookies");
+ netsurf_mkpath(&fname, NULL, 2, G_config_path, "Cookies");
if (fname != NULL) {
nsoption_setnull_charp(cookie_file, fname);
}
/* cookie jar default */
fname = NULL;
- netsurf_mkpath(&fname, NULL, 2, nsw32_config_home, "Cookies");
+ netsurf_mkpath(&fname, NULL, 2, G_config_path, "Cookies");
if (fname != NULL) {
nsoption_setnull_charp(cookie_jar, fname);
}
/* url database default */
fname = NULL;
- netsurf_mkpath(&fname, NULL, 2, nsw32_config_home, "URLs");
+ netsurf_mkpath(&fname, NULL, 2, G_config_path, "URLs");
if (fname != NULL) {
nsoption_setnull_charp(url_file, fname);
}
/* bookmark database default */
fname = NULL;
- netsurf_mkpath(&fname, NULL, 2, nsw32_config_home, "Hotlist");
+ netsurf_mkpath(&fname, NULL, 2, G_config_path, "Hotlist");
if (fname != NULL) {
nsoption_setnull_charp(hotlist_path, fname);
}
@@ -257,11 +254,16 @@ static nserror set_defaults(struct nsoption_s *defaults)
/**
* Initialise user options location and contents
*/
-static nserror nsw32_option_init(int *pargc, char** argv)
+static nserror
+nsw32_option_init(int *pargc, char** argv, char **respaths, char *config_path)
{
nserror ret;
char *choices = NULL;
+ /* set the globals that will be used in the set_defaults() callback */
+ G_resource_pathv = respaths;
+ G_config_path = config_path;
+
/* user options setup */
ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default);
if (ret != NSERROR_OK) {
@@ -269,7 +271,7 @@ static nserror nsw32_option_init(int *pargc, char** argv)
}
/* Attempt to load the user choices */
- ret = netsurf_mkpath(&choices, NULL, 2, nsw32_config_home, "Choices");
+ ret = netsurf_mkpath(&choices, NULL, 2, config_path, "Choices");
if (ret == NSERROR_OK) {
nsoption_read(choices, nsoptions);
free(choices);
@@ -311,6 +313,10 @@ static nserror nsw32_messages_init(char **respaths)
/**
* Construct a unix style argc/argv
+ *
+ * \param argc_out number of commandline arguments
+ * \param argv_out string vector of command line arguments
+ * \return NSERROR_OK on success else error code
*/
static nserror win32_to_unix_commandline(int *argc_out, char ***argv_out)
{
@@ -318,6 +324,7 @@ static nserror win32_to_unix_commandline(int *argc_out, char ***argv_out)
char **argv;
int cura;
LPWSTR *argvw;
+ size_t len;
argvw = CommandLineToArgvW(GetCommandLineW(), &argc);
if (argvw == NULL) {
@@ -367,9 +374,10 @@ static struct gui_misc_table win32_misc_table = {
int WINAPI
WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
{
- char **argv = NULL;
- int argc = 0;
- size_t len;
+ int argc;
+ char **argv;
+ char **respaths;
+ char *nsw32_config_home = NULL;
nserror ret;
const char *addr;
nsurl *url;
@@ -414,13 +422,12 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
if (ret != NSERROR_OK) {
NSLOG(netsurf, INFO,
"Unable to locate a configuration directory.");
- nsw32_config_home = NULL;
}
/* Initialise user options */
- ret = nsw32_option_init(&argc, argv);
+ ret = nsw32_option_init(&argc, argv, respaths, nsw32_config_home);
if (ret != NSERROR_OK) {
- NSLOG(netsurf, INFO, "Options failed to initialise (%s)\n",
+ NSLOG(netsurf, ERROR, "Options failed to initialise (%s)\n",
messages_get_errorcode(ret));
return 1;
}
diff --git a/frontends/windows/prefs.c b/frontends/windows/prefs.c
index b2cb7b2..9937f2e 100644
--- a/frontends/windows/prefs.c
+++ b/frontends/windows/prefs.c
@@ -699,7 +699,7 @@ nserror nsws_prefs_save(void)
char *choices = NULL;
nserror res;
- res = netsurf_mkpath(&choices, NULL, 2, nsw32_config_home, "Choices");
+ res = netsurf_mkpath(&choices, NULL, 2, G_config_path, "Choices");
if (res == NSERROR_OK) {
nsoption_write(choices, NULL, NULL);
free(choices);
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=56ddeed96c10bae6e67...
commit 56ddeed96c10bae6e67b7e15ee6fa982a0f40b3f
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
separate out construction of command line argument string vector
diff --git a/frontends/windows/main.c b/frontends/windows/main.c
index d71bb87..cf94712 100644
--- a/frontends/windows/main.c
+++ b/frontends/windows/main.c
@@ -308,6 +308,55 @@ static nserror nsw32_messages_init(char **respaths)
return res;
}
+
+/**
+ * Construct a unix style argc/argv
+ */
+static nserror win32_to_unix_commandline(int *argc_out, char ***argv_out)
+{
+ int argc = 0;
+ char **argv;
+ int cura;
+ LPWSTR *argvw;
+
+ argvw = CommandLineToArgvW(GetCommandLineW(), &argc);
+ if (argvw == NULL) {
+ return NSERROR_INVALID;
+ }
+
+ argv = malloc(sizeof(char *) * argc);
+ if (argv == NULL) {
+ return NSERROR_NOMEM;
+ }
+
+ for (cura = 0; cura < argc; cura++) {
+
+ len = wcstombs(NULL, argvw[cura], 0) + 1;
+ if (len > 0) {
+ argv[cura] = malloc(len);
+ if (argv[cura] == NULL) {
+ free(argv);
+ return NSERROR_NOMEM;
+ }
+ } else {
+ free(argv);
+ return NSERROR_INVALID;
+ }
+
+ wcstombs(argv[cura], argvw[cura], len);
+ /* alter windows-style forward slash flags to hyphen flags. */
+ if (argv[cura][0] == '/') {
+ argv[cura][0] = '-';
+ }
+ }
+
+ *argc_out = argc;
+ *argv_out = argv;
+
+ return NSERROR_OK;
+}
+
+
static struct gui_misc_table win32_misc_table = {
.schedule = win32_schedule,
};
@@ -319,9 +368,8 @@ int WINAPI
WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
{
char **argv = NULL;
- int argc = 0, argctemp = 0;
+ int argc = 0;
size_t len;
- LPWSTR *argvw;
nserror ret;
const char *addr;
nsurl *url;
@@ -347,27 +395,10 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
setbuf(stderr, NULL);
- /* Construct a unix style argc/argv */
- if (SLEN(lpcli) > 0) {
- argvw = CommandLineToArgvW(GetCommandLineW(), &argc);
- }
-
- argv = malloc(sizeof(char *) * argc);
- while (argctemp < argc) {
- len = wcstombs(NULL, argvw[argctemp], 0) + 1;
- if (len > 0) {
- argv[argctemp] = malloc(len);
- }
-
- if (argv[argctemp] != NULL) {
- wcstombs(argv[argctemp], argvw[argctemp], len);
- /* alter windows-style forward slash flags to
- * hyphen flags.
- */
- if (argv[argctemp][0] == '/')
- argv[argctemp][0] = '-';
- }
- argctemp++;
+ ret = win32_to_unix_commandline(&argc, &argv);
+ if (ret != NSERROR_OK) {
+ /* no log as logging requires this for initialisation */
+ return 1;
}
/* initialise logging - not fatal if it fails but not much we
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=2f7de349ea4b9f26bf1...
commit 2f7de349ea4b9f26bf14d0ee5704cfe248462dd7
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
update resource search path to remove users directory
it is no longer suitable to search the users home directory for
general browser resources as the correct config path is now
derived from the apropriate windows methods.
Additionaly the NETSURFRES environment variable is no longer part
of the fixed path and is instead added from the makefile
configuration option.
diff --git a/frontends/windows/Makefile.defaults b/frontends/windows/Makefile.defaults
index 1d844f1..51e71ac 100644
--- a/frontends/windows/Makefile.defaults
+++ b/frontends/windows/Makefile.defaults
@@ -3,8 +3,8 @@
# ----------------------------------------------------------------------------
# Where to search for NetSurf's resources after looking in ~/.netsurf and
-# $NETSURFRES. It must have a trailing backslash
-NETSURF_WINDOWS_RESPATH :=
+# ${APPDATA}\NetSurf. It must have a trailing backslash
+NETSURF_WINDOWS_RESPATH := $${NETSURFRES}
# Enable NetSurf's use of librosprite for displaying RISC OS Sprites
# Valid options: YES, NO, AUTO
diff --git a/frontends/windows/main.c b/frontends/windows/main.c
index 54e0249..d71bb87 100644
--- a/frontends/windows/main.c
+++ b/frontends/windows/main.c
@@ -375,6 +375,9 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
*/
nslog_init(nslog_ensure, &argc, argv);
+ /* build resource path string vector */
+ respaths = nsws_init_resource("${APPDATA}\\NetSurf:${PROGRAMFILES}\\NetSurf\\NetSurf\\:"NETSURF_WINDOWS_RESPATH);
+
/* Locate the correct user configuration directory path */
ret = get_config_home(&nsw32_config_home);
if (ret != NSERROR_OK) {
@@ -391,8 +394,6 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
return 1;
}
- respaths = nsws_init_resource("${APPDATA}\\NetSurf:${HOME}\\.netsurf:${NETSURFRES}:${PROGRAMFILES}\\NetSurf\\NetSurf\\:"NETSURF_WINDOWS_RESPATH);
-
/* Initialise translated messages */
ret = nsw32_messages_init(respaths);
if (ret != NSERROR_OK) {
-----------------------------------------------------------------------
Summary of changes:
frontends/windows/Makefile.defaults | 4 +-
frontends/windows/fetch.c | 2 +-
frontends/windows/gui.c | 12 ++--
frontends/windows/gui.h | 17 +++--
frontends/windows/main.c | 122 ++++++++++++++++++++++++-----------
frontends/windows/prefs.c | 2 +-
6 files changed, 107 insertions(+), 52 deletions(-)
diff --git a/frontends/windows/Makefile.defaults b/frontends/windows/Makefile.defaults
index 1d844f1..51e71ac 100644
--- a/frontends/windows/Makefile.defaults
+++ b/frontends/windows/Makefile.defaults
@@ -3,8 +3,8 @@
# ----------------------------------------------------------------------------
# Where to search for NetSurf's resources after looking in ~/.netsurf and
-# $NETSURFRES. It must have a trailing backslash
-NETSURF_WINDOWS_RESPATH :=
+# ${APPDATA}\NetSurf. It must have a trailing backslash
+NETSURF_WINDOWS_RESPATH := $${NETSURFRES}
# Enable NetSurf's use of librosprite for displaying RISC OS Sprites
# Valid options: YES, NO, AUTO
diff --git a/frontends/windows/fetch.c b/frontends/windows/fetch.c
index f69d7ad..287f20f 100644
--- a/frontends/windows/fetch.c
+++ b/frontends/windows/fetch.c
@@ -79,7 +79,7 @@ static nsurl *nsw32_get_resource_url(const char *path)
char buf[PATH_MAX];
nsurl *url = NULL;
- netsurf_path_to_nsurl(filepath_sfind(respaths, buf, path), &url);
+ netsurf_path_to_nsurl(filepath_sfind(G_resource_pathv, buf, path), &url);
return url;
}
diff --git a/frontends/windows/gui.c b/frontends/windows/gui.c
index 490f234..fdfafcf 100644
--- a/frontends/windows/gui.c
+++ b/frontends/windows/gui.c
@@ -41,13 +41,15 @@
#include "windows/window.h"
#include "windows/gui.h"
-/**
- * win32 application instance handle.
- *
- * This handle is set in the main windows entry point.
- */
+/* exported global defined in windows/gui.h */
HINSTANCE hinst;
+/* exported global defined in windows/gui.h */
+char **G_resource_pathv;
+
+/* exported global defined in windows/gui.h */
+char *G_config_path;
+
static bool win32_quit = false;
struct dialog_list_entry {
diff --git a/frontends/windows/gui.h b/frontends/windows/gui.h
index 8f8f0bc..0633c93 100644
--- a/frontends/windows/gui.h
+++ b/frontends/windows/gui.h
@@ -22,13 +22,22 @@
struct gui_window;
+/**
+ * win32 application instance handle.
+ *
+ * This handle is set in the main windows entry point.
+ */
extern HINSTANCE hinst;
-/** Directory where all configuration files are held. */
-extern char *nsw32_config_home;
+/**
+ * path to where all user config files are held.
+ */
+extern char *G_config_path;
-/** resource search path vector. */
-extern char **respaths;
+/**
+ * resource search path vector.
+ */
+extern char **G_resource_pathv;
/* bounding box */
typedef struct bbox_s {
diff --git a/frontends/windows/main.c b/frontends/windows/main.c
index 54e0249..eb0a866 100644
--- a/frontends/windows/main.c
+++ b/frontends/windows/main.c
@@ -57,9 +57,6 @@
#include "windows/clipboard.h"
#include "windows/gui.h"
-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.
@@ -193,6 +190,11 @@ static nserror set_defaults(struct nsoption_s *defaults)
&ptr);
if (res_len > 0) {
nsoption_setnull_charp(ca_bundle, strdup(buf));
+ } else {
+ ptr = filepath_sfind(G_resource_pathv, buf, "ca-bundle.crt");
+ if (ptr != NULL) {
+ nsoption_setnull_charp(ca_bundle, strdup(buf));
+ }
}
@@ -224,28 +226,28 @@ static nserror set_defaults(struct nsoption_s *defaults)
/* cookie file default */
fname = NULL;
- netsurf_mkpath(&fname, NULL, 2, nsw32_config_home, "Cookies");
+ netsurf_mkpath(&fname, NULL, 2, G_config_path, "Cookies");
if (fname != NULL) {
nsoption_setnull_charp(cookie_file, fname);
}
/* cookie jar default */
fname = NULL;
- netsurf_mkpath(&fname, NULL, 2, nsw32_config_home, "Cookies");
+ netsurf_mkpath(&fname, NULL, 2, G_config_path, "Cookies");
if (fname != NULL) {
nsoption_setnull_charp(cookie_jar, fname);
}
/* url database default */
fname = NULL;
- netsurf_mkpath(&fname, NULL, 2, nsw32_config_home, "URLs");
+ netsurf_mkpath(&fname, NULL, 2, G_config_path, "URLs");
if (fname != NULL) {
nsoption_setnull_charp(url_file, fname);
}
/* bookmark database default */
fname = NULL;
- netsurf_mkpath(&fname, NULL, 2, nsw32_config_home, "Hotlist");
+ netsurf_mkpath(&fname, NULL, 2, G_config_path, "Hotlist");
if (fname != NULL) {
nsoption_setnull_charp(hotlist_path, fname);
}
@@ -257,11 +259,16 @@ static nserror set_defaults(struct nsoption_s *defaults)
/**
* Initialise user options location and contents
*/
-static nserror nsw32_option_init(int *pargc, char** argv)
+static nserror
+nsw32_option_init(int *pargc, char** argv, char **respaths, char *config_path)
{
nserror ret;
char *choices = NULL;
+ /* set the globals that will be used in the set_defaults() callback */
+ G_resource_pathv = respaths;
+ G_config_path = config_path;
+
/* user options setup */
ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default);
if (ret != NSERROR_OK) {
@@ -269,7 +276,7 @@ static nserror nsw32_option_init(int *pargc, char** argv)
}
/* Attempt to load the user choices */
- ret = netsurf_mkpath(&choices, NULL, 2, nsw32_config_home, "Choices");
+ ret = netsurf_mkpath(&choices, NULL, 2, config_path, "Choices");
if (ret == NSERROR_OK) {
nsoption_read(choices, nsoptions);
free(choices);
@@ -308,6 +315,60 @@ static nserror nsw32_messages_init(char **respaths)
return res;
}
+
+/**
+ * Construct a unix style argc/argv
+ *
+ * \param argc_out number of commandline arguments
+ * \param argv_out string vector of command line arguments
+ * \return NSERROR_OK on success else error code
+ */
+static nserror win32_to_unix_commandline(int *argc_out, char ***argv_out)
+{
+ int argc = 0;
+ char **argv;
+ int cura;
+ LPWSTR *argvw;
+ size_t len;
+
+ argvw = CommandLineToArgvW(GetCommandLineW(), &argc);
+ if (argvw == NULL) {
+ return NSERROR_INVALID;
+ }
+
+ argv = malloc(sizeof(char *) * argc);
+ if (argv == NULL) {
+ return NSERROR_NOMEM;
+ }
+
+ for (cura = 0; cura < argc; cura++) {
+
+ len = wcstombs(NULL, argvw[cura], 0) + 1;
+ if (len > 0) {
+ argv[cura] = malloc(len);
+ if (argv[cura] == NULL) {
+ free(argv);
+ return NSERROR_NOMEM;
+ }
+ } else {
+ free(argv);
+ return NSERROR_INVALID;
+ }
+
+ wcstombs(argv[cura], argvw[cura], len);
+ /* alter windows-style forward slash flags to hyphen flags. */
+ if (argv[cura][0] == '/') {
+ argv[cura][0] = '-';
+ }
+ }
+
+ *argc_out = argc;
+ *argv_out = argv;
+
+ return NSERROR_OK;
+}
+
+
static struct gui_misc_table win32_misc_table = {
.schedule = win32_schedule,
};
@@ -318,10 +379,10 @@ static struct gui_misc_table win32_misc_table = {
int WINAPI
WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
{
- char **argv = NULL;
- int argc = 0, argctemp = 0;
- size_t len;
- LPWSTR *argvw;
+ int argc;
+ char **argv;
+ char **respaths;
+ char *nsw32_config_home = NULL;
nserror ret;
const char *addr;
nsurl *url;
@@ -347,27 +408,10 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
setbuf(stderr, NULL);
- /* Construct a unix style argc/argv */
- if (SLEN(lpcli) > 0) {
- argvw = CommandLineToArgvW(GetCommandLineW(), &argc);
- }
-
- argv = malloc(sizeof(char *) * argc);
- while (argctemp < argc) {
- len = wcstombs(NULL, argvw[argctemp], 0) + 1;
- if (len > 0) {
- argv[argctemp] = malloc(len);
- }
-
- if (argv[argctemp] != NULL) {
- wcstombs(argv[argctemp], argvw[argctemp], len);
- /* alter windows-style forward slash flags to
- * hyphen flags.
- */
- if (argv[argctemp][0] == '/')
- argv[argctemp][0] = '-';
- }
- argctemp++;
+ ret = win32_to_unix_commandline(&argc, &argv);
+ if (ret != NSERROR_OK) {
+ /* no log as logging requires this for initialisation */
+ return 1;
}
/* initialise logging - not fatal if it fails but not much we
@@ -375,24 +419,24 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
*/
nslog_init(nslog_ensure, &argc, argv);
+ /* build resource path string vector */
+ respaths = nsws_init_resource("${APPDATA}\\NetSurf:${PROGRAMFILES}\\NetSurf\\NetSurf\\:"NETSURF_WINDOWS_RESPATH);
+
/* Locate the correct user configuration directory path */
ret = get_config_home(&nsw32_config_home);
if (ret != NSERROR_OK) {
NSLOG(netsurf, INFO,
"Unable to locate a configuration directory.");
- nsw32_config_home = NULL;
}
/* Initialise user options */
- ret = nsw32_option_init(&argc, argv);
+ ret = nsw32_option_init(&argc, argv, respaths, nsw32_config_home);
if (ret != NSERROR_OK) {
- NSLOG(netsurf, INFO, "Options failed to initialise (%s)\n",
+ NSLOG(netsurf, ERROR, "Options failed to initialise (%s)\n",
messages_get_errorcode(ret));
return 1;
}
- respaths = nsws_init_resource("${APPDATA}\\NetSurf:${HOME}\\.netsurf:${NETSURFRES}:${PROGRAMFILES}\\NetSurf\\NetSurf\\:"NETSURF_WINDOWS_RESPATH);
-
/* Initialise translated messages */
ret = nsw32_messages_init(respaths);
if (ret != NSERROR_OK) {
diff --git a/frontends/windows/prefs.c b/frontends/windows/prefs.c
index b2cb7b2..9937f2e 100644
--- a/frontends/windows/prefs.c
+++ b/frontends/windows/prefs.c
@@ -699,7 +699,7 @@ nserror nsws_prefs_save(void)
char *choices = NULL;
nserror res;
- res = netsurf_mkpath(&choices, NULL, 2, nsw32_config_home, "Choices");
+ res = netsurf_mkpath(&choices, NULL, 2, G_config_path, "Choices");
if (res == NSERROR_OK) {
nsoption_write(choices, NULL, NULL);
free(choices);
--
NetSurf Browser
3 years, 9 months