libnslayout: branch master updated. 0797c998d5ec270df69745150d15608b4e5da9ac
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libnslayout.git/shortlog/0797c998d5ec270df...
...commit http://git.netsurf-browser.org/libnslayout.git/commit/0797c998d5ec270df69...
...tree http://git.netsurf-browser.org/libnslayout.git/tree/0797c998d5ec270df6974...
The branch, master has been updated
via 0797c998d5ec270df69745150d15608b4e5da9ac (commit)
from 617c559accc02deb3e956b592dc22d7891e28369 (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/libnslayout.git/commit/?id=0797c998d5ec270...
commit 0797c998d5ec270df69745150d15608b4e5da9ac
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Documentation: Start documenting library architecture.
diff --git a/docs/architecture.md b/docs/architecture.md
new file mode 100644
index 0000000..c45d355
--- /dev/null
+++ b/docs/architecture.md
@@ -0,0 +1,60 @@
+LibNSLayout Architecture
+========================
+
+`LibNSLayout` is a library for performing layout on a Document Object Model
+for HTML. Its purpose is to allow client applications to provide DOM
+information and convert that into a render list, which can be displayed
+by the client.
+
+Dependencies
+------------
+
+Clients of `LibNSLayout` must use the following additional libraries, because
+their types are used in the `LibNSLayout` interface:
+
+* `LibDOM` is used to provide the DOM interface.
+* `LibCSS` is used to provide the CSS handling.
+* `LibWapcaplet` is used for interned strings.
+
+Interface
+---------
+
+The devision of responsibilities between `LibNSLayout` and its clients are
+as follows:
+
+### Client
+
+* Fetching the document to be displayed.
+* Creating a CSS selection context (with default user-agent, and user CSS).
+* Generating DOM.
+* Creating a `LibNSLayout` layout for the document, passing the DOM document,
+ CSS selection context, and appropriate CSS media descriptor.
+* Listening to DOM changes.
+ * Fetching resources needed by DOM.
+ * CSS (STYLE elements, and LINK elements):
+ * Parsing the CSS.
+ * Updating CSS selection context as stylesheets are fetched,
+ and notifying `LibNSLayout`.
+ * JavaScript (SCRIPT elements, and LINK elements)
+ * Executing JavaScript.
+ * Favicons (LINK elements.)
+ * Images, Frames, Iframes.
+ * Notifying `LibNSLayout` of DOM changes.
+* Performing resource fetches on behalf of LibNSLayout.
+ * (Such as when LibNSLayout requires a background image or web font for
+ an element due to CSS.)
+* Asking `LibNSLayout` to perform layout.
+ * Displaying the returned render list.
+* Asking `LibNSLayout` for layout info (e.g. due to JavaScript.)
+* Passing mouse actions to `LibNSLayout`.
+* Passing keyboard input to `LibNSLayout`.
+* Measuring text???
+
+### `LibNSlayout`
+
+* Creates a layout object that's opaque to the client, and returns its
+ handle.
+* Performs CSS selection as appropriate when DOM changes.
+* Asking client to fetch a resource that's needed for a computed style.
+* Performs layout (if required) when asked by client and returns render list.
+* Performs layout (if required) when asked by client for layout info.
-----------------------------------------------------------------------
Summary of changes:
docs/architecture.md | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 60 insertions(+)
create mode 100644 docs/architecture.md
diff --git a/docs/architecture.md b/docs/architecture.md
new file mode 100644
index 0000000..c45d355
--- /dev/null
+++ b/docs/architecture.md
@@ -0,0 +1,60 @@
+LibNSLayout Architecture
+========================
+
+`LibNSLayout` is a library for performing layout on a Document Object Model
+for HTML. Its purpose is to allow client applications to provide DOM
+information and convert that into a render list, which can be displayed
+by the client.
+
+Dependencies
+------------
+
+Clients of `LibNSLayout` must use the following additional libraries, because
+their types are used in the `LibNSLayout` interface:
+
+* `LibDOM` is used to provide the DOM interface.
+* `LibCSS` is used to provide the CSS handling.
+* `LibWapcaplet` is used for interned strings.
+
+Interface
+---------
+
+The devision of responsibilities between `LibNSLayout` and its clients are
+as follows:
+
+### Client
+
+* Fetching the document to be displayed.
+* Creating a CSS selection context (with default user-agent, and user CSS).
+* Generating DOM.
+* Creating a `LibNSLayout` layout for the document, passing the DOM document,
+ CSS selection context, and appropriate CSS media descriptor.
+* Listening to DOM changes.
+ * Fetching resources needed by DOM.
+ * CSS (STYLE elements, and LINK elements):
+ * Parsing the CSS.
+ * Updating CSS selection context as stylesheets are fetched,
+ and notifying `LibNSLayout`.
+ * JavaScript (SCRIPT elements, and LINK elements)
+ * Executing JavaScript.
+ * Favicons (LINK elements.)
+ * Images, Frames, Iframes.
+ * Notifying `LibNSLayout` of DOM changes.
+* Performing resource fetches on behalf of LibNSLayout.
+ * (Such as when LibNSLayout requires a background image or web font for
+ an element due to CSS.)
+* Asking `LibNSLayout` to perform layout.
+ * Displaying the returned render list.
+* Asking `LibNSLayout` for layout info (e.g. due to JavaScript.)
+* Passing mouse actions to `LibNSLayout`.
+* Passing keyboard input to `LibNSLayout`.
+* Measuring text???
+
+### `LibNSlayout`
+
+* Creates a layout object that's opaque to the client, and returns its
+ handle.
+* Performs CSS selection as appropriate when DOM changes.
+* Asking client to fetch a resource that's needed for a computed style.
+* Performs layout (if required) when asked by client and returns render list.
+* Performs layout (if required) when asked by client for layout info.
--
NetSurf Layout Engine
5 years, 7 months
netsurf: branch ashmew2/netsurf-kolibrios updated. release/3.6-474-g0877c1a
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/0877c1aaaa813542b7564...
...commit http://git.netsurf-browser.org/netsurf.git/commit/0877c1aaaa813542b756446...
...tree http://git.netsurf-browser.org/netsurf.git/tree/0877c1aaaa813542b75644611...
The branch, ashmew2/netsurf-kolibrios has been updated
via 0877c1aaaa813542b75644611d5f6225aa6e6b24 (commit)
from 40b192f601a9b0cda51ceb791f118d6233dfdfa4 (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=0877c1aaaa813542b75...
commit 0877c1aaaa813542b75644611d5f6225aa6e6b24
Author: Ashish Gupta <ashmew2(a)gmail.com>
Commit: Ashish Gupta <ashmew2(a)gmail.com>
Add netsurf compilation to docs
diff --git a/docs/building-Kolibrios.md b/docs/building-Kolibrios.md
index 13f7fb3..6418bc3 100644
--- a/docs/building-Kolibrios.md
+++ b/docs/building-Kolibrios.md
@@ -46,5 +46,9 @@
cd ..
done
- Binaries can be found in /opt/netsurf/kos32-gcc/env/bin
+ # Compile and install Netsurf
+ cd netsurf
+ make TARGET=kolibrios install
+ cd ..
+Binaries can be found in /opt/netsurf/kos32-gcc/env/bin
-----------------------------------------------------------------------
Summary of changes:
docs/building-Kolibrios.md | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/docs/building-Kolibrios.md b/docs/building-Kolibrios.md
index 13f7fb3..6418bc3 100644
--- a/docs/building-Kolibrios.md
+++ b/docs/building-Kolibrios.md
@@ -46,5 +46,9 @@
cd ..
done
- Binaries can be found in /opt/netsurf/kos32-gcc/env/bin
+ # Compile and install Netsurf
+ cd netsurf
+ make TARGET=kolibrios install
+ cd ..
+Binaries can be found in /opt/netsurf/kos32-gcc/env/bin
--
NetSurf Browser
5 years, 7 months
netsurf: branch ashmew2/netsurf-kolibrios updated. release/3.6-473-g40b192f
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/40b192f601a9b0cda51ce...
...commit http://git.netsurf-browser.org/netsurf.git/commit/40b192f601a9b0cda51ceb7...
...tree http://git.netsurf-browser.org/netsurf.git/tree/40b192f601a9b0cda51ceb791...
The branch, ashmew2/netsurf-kolibrios has been updated
via 40b192f601a9b0cda51ceb791f118d6233dfdfa4 (commit)
from 7ee17c5ab31f2f8080ee16cb9f183364aafcbac9 (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=40b192f601a9b0cda51...
commit 40b192f601a9b0cda51ceb791f118d6233dfdfa4
Author: Ashish Gupta <ashmew2(a)gmail.com>
Commit: Ashish Gupta <ashmew2(a)gmail.com>
Add building-kolibrios doc
diff --git a/docs/building-Kolibrios.md b/docs/building-Kolibrios.md
new file mode 100644
index 0000000..13f7fb3
--- /dev/null
+++ b/docs/building-Kolibrios.md
@@ -0,0 +1,50 @@
+--------------------------------------------------------------------------------
+ Build Instructions for KolibriOS NetSurf 11 June 2017
+--------------------------------------------------------------------------------
+
+ Building
+=================
+
+ Obtaining the build dependencies
+----------------------------------
+ mkdir $HOME/NETSURFSTUFF
+ cd $HOME/NETSURFSTUFF
+
+ # Git clone all ns libs
+ for lib in libcss libdom libhubbub libnsbmp libnsfb libnsgif libnsutils libparserutils libsvgtiny libutf8proc libwapcaplet; do
+ git://git.netsurf-browser.org/${lib}.git
+ done
+
+ # Git clone toolchains
+ git clone git://git.netsurf-browser.org/toolchains.git
+
+ # Git clone buildsystem
+ git clone git://git.netsurf-browser.org/buildsystem.git
+
+ # Git clone Netsurf
+ git clone git://git.netsurf-browser.org/netsurf.git
+
+ Building Netsurf with it's dependencies
+----------------------------------------
+
+ cd $HOME/NETSURFSTUFF
+
+ # Set up the kolibrios compiler toolchain
+ cd toolchains/kos32-gcc
+ make
+ cd ..
+
+ # Set up the buildsystem
+ cd buildsystem
+ make install
+ cd ..
+
+ # Set up all netsurf libs (Order is important for libs)
+ for lib in libparserutils libwapcaplet libcss libhubbub libdom libnsbmp libnsfb libnsgif libnsutils libsvgtiny libutf8proc; do
+ cd $lib
+ HOST=kolibrios make install
+ cd ..
+ done
+
+ Binaries can be found in /opt/netsurf/kos32-gcc/env/bin
+
-----------------------------------------------------------------------
Summary of changes:
docs/building-Kolibrios.md | 50 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
create mode 100644 docs/building-Kolibrios.md
diff --git a/docs/building-Kolibrios.md b/docs/building-Kolibrios.md
new file mode 100644
index 0000000..13f7fb3
--- /dev/null
+++ b/docs/building-Kolibrios.md
@@ -0,0 +1,50 @@
+--------------------------------------------------------------------------------
+ Build Instructions for KolibriOS NetSurf 11 June 2017
+--------------------------------------------------------------------------------
+
+ Building
+=================
+
+ Obtaining the build dependencies
+----------------------------------
+ mkdir $HOME/NETSURFSTUFF
+ cd $HOME/NETSURFSTUFF
+
+ # Git clone all ns libs
+ for lib in libcss libdom libhubbub libnsbmp libnsfb libnsgif libnsutils libparserutils libsvgtiny libutf8proc libwapcaplet; do
+ git://git.netsurf-browser.org/${lib}.git
+ done
+
+ # Git clone toolchains
+ git clone git://git.netsurf-browser.org/toolchains.git
+
+ # Git clone buildsystem
+ git clone git://git.netsurf-browser.org/buildsystem.git
+
+ # Git clone Netsurf
+ git clone git://git.netsurf-browser.org/netsurf.git
+
+ Building Netsurf with it's dependencies
+----------------------------------------
+
+ cd $HOME/NETSURFSTUFF
+
+ # Set up the kolibrios compiler toolchain
+ cd toolchains/kos32-gcc
+ make
+ cd ..
+
+ # Set up the buildsystem
+ cd buildsystem
+ make install
+ cd ..
+
+ # Set up all netsurf libs (Order is important for libs)
+ for lib in libparserutils libwapcaplet libcss libhubbub libdom libnsbmp libnsfb libnsgif libnsutils libsvgtiny libutf8proc; do
+ cd $lib
+ HOST=kolibrios make install
+ cd ..
+ done
+
+ Binaries can be found in /opt/netsurf/kos32-gcc/env/bin
+
--
NetSurf Browser
5 years, 7 months
netsurf: branch master updated. release/3.6-479-g38c10c8
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/38c10c85cbfbc47eaaf64...
...commit http://git.netsurf-browser.org/netsurf.git/commit/38c10c85cbfbc47eaaf64a5...
...tree http://git.netsurf-browser.org/netsurf.git/tree/38c10c85cbfbc47eaaf64a58f...
The branch, master has been updated
via 38c10c85cbfbc47eaaf64a58fb50d60e136af673 (commit)
via 98a73379fec8297c840f592db8c9d2b6aed257bc (commit)
via dfa1e0bcd3e48f85214ff2b01909b00454d44d82 (commit)
from d34b0726e38b0ad51bf1b733fd611df0409b5001 (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=38c10c85cbfbc47eaaf...
commit 38c10c85cbfbc47eaaf64a58fb50d60e136af673
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Windows: Ensure core windows are fully initialised.
diff --git a/frontends/windows/cookies.c b/frontends/windows/cookies.c
index c4880fa..b3c56da 100644
--- a/frontends/windows/cookies.c
+++ b/frontends/windows/cookies.c
@@ -136,7 +136,7 @@ static nserror nsw32_cookie_init(HINSTANCE hInstance)
return NSERROR_OK;
}
- ncwin = malloc(sizeof(struct nsw32_cookie_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
diff --git a/frontends/windows/global_history.c b/frontends/windows/global_history.c
index 0ba013b..dcc75ba 100644
--- a/frontends/windows/global_history.c
+++ b/frontends/windows/global_history.c
@@ -126,7 +126,7 @@ static nserror nsw32_global_history_init(HINSTANCE hInstance)
return NSERROR_OK;
}
- ncwin = malloc(sizeof(struct nsw32_global_history_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
diff --git a/frontends/windows/hotlist.c b/frontends/windows/hotlist.c
index 0efe76f..e8dd90b 100644
--- a/frontends/windows/hotlist.c
+++ b/frontends/windows/hotlist.c
@@ -130,7 +130,7 @@ static nserror nsw32_hotlist_init(HINSTANCE hInstance)
return NSERROR_OK;
}
- ncwin = malloc(sizeof(struct nsw32_hotlist_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
diff --git a/frontends/windows/local_history.c b/frontends/windows/local_history.c
index 205ebfe..722d365 100644
--- a/frontends/windows/local_history.c
+++ b/frontends/windows/local_history.c
@@ -143,7 +143,7 @@ nsw32_local_history_init(HINSTANCE hInstance,
return res;
}
- ncwin = malloc(sizeof(struct nsw32_local_history_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=98a73379fec8297c840...
commit 98a73379fec8297c840f592db8c9d2b6aed257bc
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
RISC OS: Ensure core windows are fully initialised.
diff --git a/frontends/riscos/cookies.c b/frontends/riscos/cookies.c
index 38963ab..614bc3d 100644
--- a/frontends/riscos/cookies.c
+++ b/frontends/riscos/cookies.c
@@ -377,7 +377,7 @@ static nserror ro_cookie_init(void)
return NSERROR_OK;
}
- ncwin = malloc(sizeof(struct ro_cookie_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
diff --git a/frontends/riscos/global_history.c b/frontends/riscos/global_history.c
index 94e1d4a..d122a4d 100644
--- a/frontends/riscos/global_history.c
+++ b/frontends/riscos/global_history.c
@@ -405,7 +405,7 @@ static nserror ro_global_history_init(void)
return NSERROR_OK;
}
- ncwin = malloc(sizeof(struct ro_global_history_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
diff --git a/frontends/riscos/hotlist.c b/frontends/riscos/hotlist.c
index d348009..b055d1b 100644
--- a/frontends/riscos/hotlist.c
+++ b/frontends/riscos/hotlist.c
@@ -466,7 +466,7 @@ static nserror ro_hotlist_init(void)
return NSERROR_OK;
}
- ncwin = malloc(sizeof(struct ro_hotlist_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
diff --git a/frontends/riscos/local_history.c b/frontends/riscos/local_history.c
index 1ae98ff..f9f1f2e 100644
--- a/frontends/riscos/local_history.c
+++ b/frontends/riscos/local_history.c
@@ -299,7 +299,7 @@ ro_local_history_init(struct browser_window *bw,
return res;
}
- ncwin = malloc(sizeof(struct ro_local_history_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=dfa1e0bcd3e48f85214...
commit dfa1e0bcd3e48f85214ff2b01909b00454d44d82
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
GTK: Ensure core windows are fully initialised.
diff --git a/frontends/gtk/cookies.c b/frontends/gtk/cookies.c
index dc77e1c..500cd07 100644
--- a/frontends/gtk/cookies.c
+++ b/frontends/gtk/cookies.c
@@ -246,7 +246,7 @@ static nserror nsgtk_cookies_init(void)
return NSERROR_OK;
}
- ncwin = malloc(sizeof(struct nsgtk_cookie_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
diff --git a/frontends/gtk/global_history.c b/frontends/gtk/global_history.c
index 66ba1a6..360eb4e 100644
--- a/frontends/gtk/global_history.c
+++ b/frontends/gtk/global_history.c
@@ -299,7 +299,7 @@ static nserror nsgtk_global_history_init(void)
return NSERROR_OK;
}
- ncwin = malloc(sizeof(struct nsgtk_global_history_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
diff --git a/frontends/gtk/hotlist.c b/frontends/gtk/hotlist.c
index 34a1377..936573a 100644
--- a/frontends/gtk/hotlist.c
+++ b/frontends/gtk/hotlist.c
@@ -319,7 +319,7 @@ static nserror nsgtk_hotlist_init(void)
return NSERROR_OK;
}
- ncwin = malloc(sizeof(struct nsgtk_hotlist_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
diff --git a/frontends/gtk/local_history.c b/frontends/gtk/local_history.c
index b36ccd2..cc95801 100644
--- a/frontends/gtk/local_history.c
+++ b/frontends/gtk/local_history.c
@@ -141,7 +141,7 @@ nsgtk_local_history_init(struct browser_window *bw,
return res;
}
- ncwin = malloc(sizeof(struct nsgtk_local_history_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
-----------------------------------------------------------------------
Summary of changes:
frontends/gtk/cookies.c | 2 +-
frontends/gtk/global_history.c | 2 +-
frontends/gtk/hotlist.c | 2 +-
frontends/gtk/local_history.c | 2 +-
frontends/riscos/cookies.c | 2 +-
frontends/riscos/global_history.c | 2 +-
frontends/riscos/hotlist.c | 2 +-
frontends/riscos/local_history.c | 2 +-
frontends/windows/cookies.c | 2 +-
frontends/windows/global_history.c | 2 +-
frontends/windows/hotlist.c | 2 +-
frontends/windows/local_history.c | 2 +-
12 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/frontends/gtk/cookies.c b/frontends/gtk/cookies.c
index dc77e1c..500cd07 100644
--- a/frontends/gtk/cookies.c
+++ b/frontends/gtk/cookies.c
@@ -246,7 +246,7 @@ static nserror nsgtk_cookies_init(void)
return NSERROR_OK;
}
- ncwin = malloc(sizeof(struct nsgtk_cookie_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
diff --git a/frontends/gtk/global_history.c b/frontends/gtk/global_history.c
index 66ba1a6..360eb4e 100644
--- a/frontends/gtk/global_history.c
+++ b/frontends/gtk/global_history.c
@@ -299,7 +299,7 @@ static nserror nsgtk_global_history_init(void)
return NSERROR_OK;
}
- ncwin = malloc(sizeof(struct nsgtk_global_history_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
diff --git a/frontends/gtk/hotlist.c b/frontends/gtk/hotlist.c
index 34a1377..936573a 100644
--- a/frontends/gtk/hotlist.c
+++ b/frontends/gtk/hotlist.c
@@ -319,7 +319,7 @@ static nserror nsgtk_hotlist_init(void)
return NSERROR_OK;
}
- ncwin = malloc(sizeof(struct nsgtk_hotlist_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
diff --git a/frontends/gtk/local_history.c b/frontends/gtk/local_history.c
index b36ccd2..cc95801 100644
--- a/frontends/gtk/local_history.c
+++ b/frontends/gtk/local_history.c
@@ -141,7 +141,7 @@ nsgtk_local_history_init(struct browser_window *bw,
return res;
}
- ncwin = malloc(sizeof(struct nsgtk_local_history_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
diff --git a/frontends/riscos/cookies.c b/frontends/riscos/cookies.c
index 38963ab..614bc3d 100644
--- a/frontends/riscos/cookies.c
+++ b/frontends/riscos/cookies.c
@@ -377,7 +377,7 @@ static nserror ro_cookie_init(void)
return NSERROR_OK;
}
- ncwin = malloc(sizeof(struct ro_cookie_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
diff --git a/frontends/riscos/global_history.c b/frontends/riscos/global_history.c
index 94e1d4a..d122a4d 100644
--- a/frontends/riscos/global_history.c
+++ b/frontends/riscos/global_history.c
@@ -405,7 +405,7 @@ static nserror ro_global_history_init(void)
return NSERROR_OK;
}
- ncwin = malloc(sizeof(struct ro_global_history_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
diff --git a/frontends/riscos/hotlist.c b/frontends/riscos/hotlist.c
index d348009..b055d1b 100644
--- a/frontends/riscos/hotlist.c
+++ b/frontends/riscos/hotlist.c
@@ -466,7 +466,7 @@ static nserror ro_hotlist_init(void)
return NSERROR_OK;
}
- ncwin = malloc(sizeof(struct ro_hotlist_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
diff --git a/frontends/riscos/local_history.c b/frontends/riscos/local_history.c
index 1ae98ff..f9f1f2e 100644
--- a/frontends/riscos/local_history.c
+++ b/frontends/riscos/local_history.c
@@ -299,7 +299,7 @@ ro_local_history_init(struct browser_window *bw,
return res;
}
- ncwin = malloc(sizeof(struct ro_local_history_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
diff --git a/frontends/windows/cookies.c b/frontends/windows/cookies.c
index c4880fa..b3c56da 100644
--- a/frontends/windows/cookies.c
+++ b/frontends/windows/cookies.c
@@ -136,7 +136,7 @@ static nserror nsw32_cookie_init(HINSTANCE hInstance)
return NSERROR_OK;
}
- ncwin = malloc(sizeof(struct nsw32_cookie_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
diff --git a/frontends/windows/global_history.c b/frontends/windows/global_history.c
index 0ba013b..dcc75ba 100644
--- a/frontends/windows/global_history.c
+++ b/frontends/windows/global_history.c
@@ -126,7 +126,7 @@ static nserror nsw32_global_history_init(HINSTANCE hInstance)
return NSERROR_OK;
}
- ncwin = malloc(sizeof(struct nsw32_global_history_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
diff --git a/frontends/windows/hotlist.c b/frontends/windows/hotlist.c
index 0efe76f..e8dd90b 100644
--- a/frontends/windows/hotlist.c
+++ b/frontends/windows/hotlist.c
@@ -130,7 +130,7 @@ static nserror nsw32_hotlist_init(HINSTANCE hInstance)
return NSERROR_OK;
}
- ncwin = malloc(sizeof(struct nsw32_hotlist_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
diff --git a/frontends/windows/local_history.c b/frontends/windows/local_history.c
index 205ebfe..722d365 100644
--- a/frontends/windows/local_history.c
+++ b/frontends/windows/local_history.c
@@ -143,7 +143,7 @@ nsw32_local_history_init(HINSTANCE hInstance,
return res;
}
- ncwin = malloc(sizeof(struct nsw32_local_history_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
--
NetSurf Browser
5 years, 7 months
netsurf: branch master updated. release/3.6-476-gd34b072
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/d34b0726e38b0ad51bf1b...
...commit http://git.netsurf-browser.org/netsurf.git/commit/d34b0726e38b0ad51bf1b73...
...tree http://git.netsurf-browser.org/netsurf.git/tree/d34b0726e38b0ad51bf1b733f...
The branch, master has been updated
via d34b0726e38b0ad51bf1b733fd611df0409b5001 (commit)
from 40951d5294c87a85c9ff315ba5ebb13a643cea81 (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=d34b0726e38b0ad51bf...
commit d34b0726e38b0ad51bf1b733fd611df0409b5001
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Framebuffer: Ensure local history corewindow is fully initialised.
diff --git a/frontends/framebuffer/local_history.c b/frontends/framebuffer/local_history.c
index 5201298..cc45b1f 100644
--- a/frontends/framebuffer/local_history.c
+++ b/frontends/framebuffer/local_history.c
@@ -145,7 +145,7 @@ fb_local_history_init(fbtk_widget_t *parent,
return res;
}
- ncwin = malloc(sizeof(struct fb_local_history_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
-----------------------------------------------------------------------
Summary of changes:
frontends/framebuffer/local_history.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/frontends/framebuffer/local_history.c b/frontends/framebuffer/local_history.c
index 5201298..cc45b1f 100644
--- a/frontends/framebuffer/local_history.c
+++ b/frontends/framebuffer/local_history.c
@@ -145,7 +145,7 @@ fb_local_history_init(fbtk_widget_t *parent,
return res;
}
- ncwin = malloc(sizeof(struct fb_local_history_window));
+ ncwin = calloc(1, sizeof(*ncwin));
if (ncwin == NULL) {
return NSERROR_NOMEM;
}
--
NetSurf Browser
5 years, 7 months
netsurf: branch ashmew2/netsurf-kolibrios updated. release/3.6-472-g7ee17c5
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/7ee17c5ab31f2f8080ee1...
...commit http://git.netsurf-browser.org/netsurf.git/commit/7ee17c5ab31f2f8080ee16c...
...tree http://git.netsurf-browser.org/netsurf.git/tree/7ee17c5ab31f2f8080ee16cb9...
The branch, ashmew2/netsurf-kolibrios has been updated
via 7ee17c5ab31f2f8080ee16cb9f183364aafcbac9 (commit)
from 2ba19119f6421766f32fbddd07816a151f3ce2fa (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=7ee17c5ab31f2f8080e...
commit 7ee17c5ab31f2f8080ee16cb9f183364aafcbac9
Author: Ashish Gupta <ashmew2(a)gmail.com>
Commit: Ashish Gupta <ashmew2(a)gmail.com>
Minor makefile fixes for kolibrios
diff --git a/Makefile b/Makefile
index 4b26b6a..d71cdcc 100644
--- a/Makefile
+++ b/Makefile
@@ -289,9 +289,8 @@ else
endif
else
ifeq ($(TARGET),kolibrios)
-# CROSSDIR := /opt/netsurf/kos32-gcc/cross/autobuild/tools/win32/bin
- CROSSDIR := /home/autobuild/tools/win32/bin
- ENVDIR := /opt/netsurf/kos32-gcc/env/
+ CROSSDIR := /opt/netsurf/kos32-gcc/cross/autobuild/tools/win32/bin
+ ENVDIR := /opt/netsurf/kos32-gcc/env/
CC := $(CROSSDIR)/kos32-gcc
LD := $(CROSSDIR)/kos32-ld
PREFIX := /opt/netsurf/kos32-gcc/env
-----------------------------------------------------------------------
Summary of changes:
Makefile | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index 4b26b6a..d71cdcc 100644
--- a/Makefile
+++ b/Makefile
@@ -289,9 +289,8 @@ else
endif
else
ifeq ($(TARGET),kolibrios)
-# CROSSDIR := /opt/netsurf/kos32-gcc/cross/autobuild/tools/win32/bin
- CROSSDIR := /home/autobuild/tools/win32/bin
- ENVDIR := /opt/netsurf/kos32-gcc/env/
+ CROSSDIR := /opt/netsurf/kos32-gcc/cross/autobuild/tools/win32/bin
+ ENVDIR := /opt/netsurf/kos32-gcc/env/
CC := $(CROSSDIR)/kos32-gcc
LD := $(CROSSDIR)/kos32-ld
PREFIX := /opt/netsurf/kos32-gcc/env
--
NetSurf Browser
5 years, 7 months
toolchains: branch ashmew2/kolibrios updated. 45c332a4a206373dcf14030492b6fa46d1b3185c
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/toolchains.git/shortlog/45c332a4a206373dcf...
...commit http://git.netsurf-browser.org/toolchains.git/commit/45c332a4a206373dcf14...
...tree http://git.netsurf-browser.org/toolchains.git/tree/45c332a4a206373dcf1403...
The branch, ashmew2/kolibrios has been updated
via 45c332a4a206373dcf14030492b6fa46d1b3185c (commit)
from 165c08130b035b25d7ca203d2ffb078b17e83e2b (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/toolchains.git/commit/?id=45c332a4a206373d...
commit 45c332a4a206373dcf14030492b6fa46d1b3185c
Author: Ashish Gupta <ashmew2(a)gmail.com>
Commit: Ashish Gupta <ashmew2(a)gmail.com>
Set up kos32-gcc compiler in crossdir
diff --git a/kos32-gcc/Makefile b/kos32-gcc/Makefile
index 48f8ad5..10a6f86 100644
--- a/kos32-gcc/Makefile
+++ b/kos32-gcc/Makefile
@@ -1,14 +1,24 @@
KOLIBRI_SVN_URL := svn://kolibrios.org
-ENVDIR := /opt/netsurf/kos32-gcc/env
+KOS32_DIR := /opt/netsurf/kos32-gcc/
+ENVDIR := $(KOS32_DIR)/env
SVN_CHECKOUT := $(ENVDIR)/kolibrios
PATH := $(PATH):/opt/netsurf/kos32-gcc/cross/autobuild/tools/win32/bin
+COMPILER_INSTALL_PATH := /opt/netsurf/kos32-gcc/cross/autobuild/tools/
+COMPILER_NAME := x86_64-linux-kos32-4.8.5.7z
+COMPILER_URL := http://ftp.kolibrios.org/users/Serge/new/Toolchain/$(COMPILER_NAME)
OBJDIR := $(ENVDIR)/obj
COMPILE := kos32-gcc -c -fno-ident -fomit-frame-pointer -U__WIN32__ -I$(SVN_CHECKOUT)/contrib/sdk/sources/newlib/libc/include -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32 -U__BSD_VISIBLE
-all: clean kolibri-svn kolibri-libs
+all: clean kolibri-compiler kolibri-svn kolibri-libs
+kolibri-compiler:
+ mkdir -p $(COMPILER_INSTALL_PATH)
+ wget $(COMPILER_URL)
+ mv $(COMPILER_NAME) $(COMPILER_INSTALL_PATH)
+ cd $(COMPILER_INSTALL_PATH) && 7z x $(COMPILER_NAME)
+ rm -f $(COMPILER_INSTALL_PATH)/$(COMPILER_NAME)
kolibri-svn:
mkdir -p $(ENVDIR)
@@ -22,3 +32,4 @@ kolibri-libs:
clean:
rm -f $(OBJDIR)/*
+ rm -rf $(KOS32_DIR)
-----------------------------------------------------------------------
Summary of changes:
kos32-gcc/Makefile | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/kos32-gcc/Makefile b/kos32-gcc/Makefile
index 48f8ad5..10a6f86 100644
--- a/kos32-gcc/Makefile
+++ b/kos32-gcc/Makefile
@@ -1,14 +1,24 @@
KOLIBRI_SVN_URL := svn://kolibrios.org
-ENVDIR := /opt/netsurf/kos32-gcc/env
+KOS32_DIR := /opt/netsurf/kos32-gcc/
+ENVDIR := $(KOS32_DIR)/env
SVN_CHECKOUT := $(ENVDIR)/kolibrios
PATH := $(PATH):/opt/netsurf/kos32-gcc/cross/autobuild/tools/win32/bin
+COMPILER_INSTALL_PATH := /opt/netsurf/kos32-gcc/cross/autobuild/tools/
+COMPILER_NAME := x86_64-linux-kos32-4.8.5.7z
+COMPILER_URL := http://ftp.kolibrios.org/users/Serge/new/Toolchain/$(COMPILER_NAME)
OBJDIR := $(ENVDIR)/obj
COMPILE := kos32-gcc -c -fno-ident -fomit-frame-pointer -U__WIN32__ -I$(SVN_CHECKOUT)/contrib/sdk/sources/newlib/libc/include -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32 -U__BSD_VISIBLE
-all: clean kolibri-svn kolibri-libs
+all: clean kolibri-compiler kolibri-svn kolibri-libs
+kolibri-compiler:
+ mkdir -p $(COMPILER_INSTALL_PATH)
+ wget $(COMPILER_URL)
+ mv $(COMPILER_NAME) $(COMPILER_INSTALL_PATH)
+ cd $(COMPILER_INSTALL_PATH) && 7z x $(COMPILER_NAME)
+ rm -f $(COMPILER_INSTALL_PATH)/$(COMPILER_NAME)
kolibri-svn:
mkdir -p $(ENVDIR)
@@ -22,3 +32,4 @@ kolibri-libs:
clean:
rm -f $(OBJDIR)/*
+ rm -rf $(KOS32_DIR)
--
Cross-compilation toolchains and environments
5 years, 7 months
netsurf: branch master updated. release/3.6-475-g40951d5
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/40951d5294c87a85c9ff3...
...commit http://git.netsurf-browser.org/netsurf.git/commit/40951d5294c87a85c9ff315...
...tree http://git.netsurf-browser.org/netsurf.git/tree/40951d5294c87a85c9ff315ba...
The branch, master has been updated
via 40951d5294c87a85c9ff315ba5ebb13a643cea81 (commit)
from 6511e9f9e0346eb5dc5dfc512b456446d56e2b8c (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=40951d5294c87a85c9f...
commit 40951d5294c87a85c9ff315ba5ebb13a643cea81
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Use the correct function to get the URL at position
Hint popup still broken though :(
diff --git a/frontends/amiga/history_local.c b/frontends/amiga/history_local.c
index c1f2a36..c293f59 100644
--- a/frontends/amiga/history_local.c
+++ b/frontends/amiga/history_local.c
@@ -106,25 +106,27 @@ ami_history_local_mouse(struct ami_corewindow *ami_cw,
/* technically degenerate container of */
history_local_win = (struct ami_history_local_window *)ami_cw;
- nsurl *url = browser_window_history_position_url(history_local_win->gw->bw, x, y);
-
- if (url == NULL) {
- SetGadgetAttrs(
- (struct Gadget *)ami_cw->objects[GID_CW_DRAW],
- ami_cw->win,
- NULL,
- GA_HintInfo,
- NULL,
- TAG_DONE);
- } else {
- SetGadgetAttrs(
- (struct Gadget *)ami_cw->objects[GID_CW_DRAW],
- ami_cw->win,
- NULL,
- GA_HintInfo,
- nsurl_access(url),
- TAG_DONE);
- nsurl_unref(url);
+ nsurl *url;
+
+ if(local_history_get_url(history_local_win->session, x, y, &url) == NSERROR_OK) {
+ if (url == NULL) {
+ SetGadgetAttrs(
+ (struct Gadget *)ami_cw->objects[GID_CW_DRAW],
+ ami_cw->win,
+ NULL,
+ GA_HintInfo,
+ NULL,
+ TAG_DONE);
+ } else {
+ SetGadgetAttrs(
+ (struct Gadget *)ami_cw->objects[GID_CW_DRAW],
+ ami_cw->win,
+ NULL,
+ GA_HintInfo,
+ nsurl_access(url),
+ TAG_DONE);
+ nsurl_unref(url);
+ }
}
local_history_mouse_action(history_local_win->session, mouse_state, x, y);
-----------------------------------------------------------------------
Summary of changes:
frontends/amiga/history_local.c | 40 ++++++++++++++++++++-------------------
1 file changed, 21 insertions(+), 19 deletions(-)
diff --git a/frontends/amiga/history_local.c b/frontends/amiga/history_local.c
index c1f2a36..c293f59 100644
--- a/frontends/amiga/history_local.c
+++ b/frontends/amiga/history_local.c
@@ -106,25 +106,27 @@ ami_history_local_mouse(struct ami_corewindow *ami_cw,
/* technically degenerate container of */
history_local_win = (struct ami_history_local_window *)ami_cw;
- nsurl *url = browser_window_history_position_url(history_local_win->gw->bw, x, y);
-
- if (url == NULL) {
- SetGadgetAttrs(
- (struct Gadget *)ami_cw->objects[GID_CW_DRAW],
- ami_cw->win,
- NULL,
- GA_HintInfo,
- NULL,
- TAG_DONE);
- } else {
- SetGadgetAttrs(
- (struct Gadget *)ami_cw->objects[GID_CW_DRAW],
- ami_cw->win,
- NULL,
- GA_HintInfo,
- nsurl_access(url),
- TAG_DONE);
- nsurl_unref(url);
+ nsurl *url;
+
+ if(local_history_get_url(history_local_win->session, x, y, &url) == NSERROR_OK) {
+ if (url == NULL) {
+ SetGadgetAttrs(
+ (struct Gadget *)ami_cw->objects[GID_CW_DRAW],
+ ami_cw->win,
+ NULL,
+ GA_HintInfo,
+ NULL,
+ TAG_DONE);
+ } else {
+ SetGadgetAttrs(
+ (struct Gadget *)ami_cw->objects[GID_CW_DRAW],
+ ami_cw->win,
+ NULL,
+ GA_HintInfo,
+ nsurl_access(url),
+ TAG_DONE);
+ nsurl_unref(url);
+ }
}
local_history_mouse_action(history_local_win->session, mouse_state, x, y);
--
NetSurf Browser
5 years, 7 months
netsurf: branch master updated. release/3.6-474-g6511e9f
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/6511e9f9e0346eb5dc5df...
...commit http://git.netsurf-browser.org/netsurf.git/commit/6511e9f9e0346eb5dc5dfc5...
...tree http://git.netsurf-browser.org/netsurf.git/tree/6511e9f9e0346eb5dc5dfc512...
The branch, master has been updated
via 6511e9f9e0346eb5dc5dfc512b456446d56e2b8c (commit)
from 653ccb78a9d819d21dc8d3e6d57d724215f50605 (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=6511e9f9e0346eb5dc5...
commit 6511e9f9e0346eb5dc5dfc512b456446d56e2b8c
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Migrate Amiga local history to corewindow
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 3168758..2d5a27c 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -4596,7 +4596,7 @@ static void gui_window_destroy(struct gui_window *g)
if(g->hw)
{
- ami_history_close(g->hw);
+ ami_history_local_destroy(g->hw);
win_destroyed = true;
}
diff --git a/frontends/amiga/gui.h b/frontends/amiga/gui.h
index 5cec82d..bf4ec91 100644
--- a/frontends/amiga/gui.h
+++ b/frontends/amiga/gui.h
@@ -87,7 +87,8 @@ enum
};
struct find_window;
-struct history_window;
+struct ami_history_local_window;
+struct ami_menu_data;
#define AMI_GUI_TOOLBAR_MAX 20
@@ -110,8 +111,6 @@ struct ami_generic_window {
const struct ami_win_event_table *tbl;
};
-struct ami_menu_data;
-
struct gui_window_2 {
struct ami_generic_window w;
struct Window *win;
@@ -174,7 +173,7 @@ struct gui_window
int c_h_temp;
int scrollx;
int scrolly;
- struct history_window *hw;
+ struct ami_history_local_window *hw;
struct List dllist;
struct hlcache_handle *favicon;
bool throbbing;
diff --git a/frontends/amiga/gui_menu.c b/frontends/amiga/gui_menu.c
index 0469dd5..6ee0800 100644
--- a/frontends/amiga/gui_menu.c
+++ b/frontends/amiga/gui_menu.c
@@ -326,7 +326,7 @@ HOOKF(void, ami_menu_item_browser_localhistory, APTR, window, struct IntuiMessag
struct gui_window_2 *gwin;
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
- ami_history_open(gwin->gw);
+ ami_history_local_present(gwin->gw);
}
HOOKF(void, ami_menu_item_browser_globalhistory, APTR, window, struct IntuiMessage *)
diff --git a/frontends/amiga/history_local.c b/frontends/amiga/history_local.c
old mode 100755
new mode 100644
index 84f6561..c1f2a36
--- a/frontends/amiga/history_local.c
+++ b/frontends/amiga/history_local.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2009, 2010 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
+ * Copyright 2017 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -16,359 +16,298 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
- * Browser history window (AmigaOS implementation).
- *
- * There is only one history window, not one per browser window.
+/**
+ * \file
+ * Implementation of Amiga local history using core windows.
*/
-#include "amiga/os3support.h"
-
-#include <stdbool.h>
+#include <stdint.h>
#include <stdlib.h>
-#include <string.h>
+
#include <proto/intuition.h>
-#include <proto/exec.h>
-#include <proto/graphics.h>
-#include <intuition/icclass.h>
-#include <proto/utility.h>
-#include <proto/window.h>
-#include <proto/space.h>
-#include <proto/layout.h>
+
#include <classes/window.h>
-#include <gadgets/space.h>
+#include <gadgets/button.h>
+#include <gadgets/layout.h>
#include <gadgets/scroller.h>
-#include <reaction/reaction.h>
+#include <gadgets/space.h>
+#include <images/label.h>
+
+#include <intuition/icclass.h>
#include <reaction/reaction_macros.h>
#include "utils/log.h"
-#include "utils/utils.h"
+#include "netsurf/keypress.h"
+#include "netsurf/plotters.h"
+#include "desktop/local_history.h"
#include "utils/messages.h"
+#include "utils/nsoption.h"
#include "utils/nsurl.h"
-#include "desktop/local_history.h"
-#include "netsurf/browser_window.h"
-#include "netsurf/plotters.h"
-#include "netsurf/window.h"
-#include "graphics/rpattr.h"
-#include "amiga/libs.h"
-#include "amiga/misc.h"
-#include "amiga/object.h"
-#include "amiga/plotters.h"
+#include "amiga/corewindow.h"
#include "amiga/gui.h"
+#include "amiga/libs.h"
#include "amiga/history_local.h"
+#include "amiga/utf8.h"
-struct history_window {
- struct ami_generic_window w;
- struct Window *win;
- Object *objects[GID_LAST];
- struct gui_window *gw;
- struct Hook scrollerhook;
- struct gui_globals *gg;
-};
-static void ami_history_update_extent(struct history_window *hw);
-HOOKF(void, ami_history_scroller_hook, Object *, object, struct IntuiMessage *);
+/**
+ * Amiga local history viewing window context
+ */
+struct ami_history_local_window {
+ /** Amiga core window context */
+ struct ami_corewindow core;
-static BOOL ami_history_event(void *w);
+ /** Amiga GUI stuff */
+ struct gui_window *gw;
-static const struct ami_win_event_table ami_localhistory_table = {
- ami_history_event,
- NULL, /* we don't explicitly close the local history window on quit */
+ /** local history viewer context data */
+ struct local_history_session *session;
};
+static struct ami_history_local_window *history_local_window = NULL;
+
/**
- * Redraw history window.
+ * destroy a previously created local history view
*/
-
-static void ami_history_redraw(struct history_window *hw)
+nserror
+ami_history_local_destroy(struct ami_history_local_window *history_local_win)
{
- struct IBox *bbox;
- ULONG xs,ys;
- struct rect clip;
- struct redraw_context ctx = {
- .interactive = true,
- .background_images = true,
- .plot = &amiplot,
- .priv = hw->gg
- };
-
- GetAttr(SCROLLER_Top,hw->objects[OID_HSCROLL],(ULONG *)&xs);
- GetAttr(SCROLLER_Top,hw->objects[OID_VSCROLL],(ULONG *)&ys);
- if(ami_gui_get_space_box(hw->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return;
+ nserror res;
+
+ if (history_local_win == NULL) {
+ return NSERROR_OK;
}
-/* core should clear this area for us
- SetRPAttrs(glob->rp, RPTAG_APenColor, 0xffffffff, TAG_DONE);
- RectFill(glob->rp, 0, 0, bbox->Width - 1, bbox->Height - 1);
-*/
- clip.x0 = xs;
- clip.y0 = ys;
- clip.x1 = bbox->Width + xs;
- clip.y1 = bbox->Height + ys;
- browser_window_history_redraw_rectangle(hw->gw->bw, &clip, 0, 0, &ctx);
+ res = local_history_fini(history_local_win->session);
+ if (res == NSERROR_OK) {
+ history_local_win->gw->hw = NULL;
+ res = ami_corewindow_fini(&history_local_win->core); /* closes the window for us */
+ history_local_window = NULL;
+ }
+ return res;
+}
- ami_clearclipreg(hw->gg);
- ami_history_update_extent(hw);
+/**
+ * callback for mouse action for local history on core window
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param mouse_state netsurf mouse state on event
+ * \param x location of event
+ * \param y location of event
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_history_local_mouse(struct ami_corewindow *ami_cw,
+ browser_mouse_state mouse_state,
+ int x, int y)
+{
+ struct ami_history_local_window *history_local_win;
+ /* technically degenerate container of */
+ history_local_win = (struct ami_history_local_window *)ami_cw;
+
+ nsurl *url = browser_window_history_position_url(history_local_win->gw->bw, x, y);
+
+ if (url == NULL) {
+ SetGadgetAttrs(
+ (struct Gadget *)ami_cw->objects[GID_CW_DRAW],
+ ami_cw->win,
+ NULL,
+ GA_HintInfo,
+ NULL,
+ TAG_DONE);
+ } else {
+ SetGadgetAttrs(
+ (struct Gadget *)ami_cw->objects[GID_CW_DRAW],
+ ami_cw->win,
+ NULL,
+ GA_HintInfo,
+ nsurl_access(url),
+ TAG_DONE);
+ nsurl_unref(url);
+ }
- BltBitMapRastPort(ami_plot_ra_get_bitmap(hw->gg), 0, 0, hw->win->RPort,
- bbox->Left, bbox->Top, bbox->Width, bbox->Height, 0x0C0);
+ local_history_mouse_action(history_local_win->session, mouse_state, x, y);
- ami_gui_free_space_box(bbox);
+ return NSERROR_OK;
}
-
-/* exported interface documented in amiga/history_local.h */
-void ami_history_open(struct gui_window *gw)
+/**
+ * callback for keypress for local history on core window
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param nskey The netsurf key code
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_history_local_key(struct ami_corewindow *ami_cw, uint32_t nskey)
{
- struct history *history;
- int width, height;
+ struct ami_history_local_window *history_local_win;
- if (gw->bw == NULL)
- return;
-
- history = browser_window_get_history(gw->bw);
- if (history == NULL)
- return;
-
- if(!gw->hw)
- {
- gw->hw = calloc(1, sizeof(struct history_window));
- gw->hw->gg = ami_plot_ra_alloc(scrn->Width, scrn->Height, false, true);
-
- gw->hw->gw = gw;
- browser_window_history_size(gw->bw, &width, &height);
-
- gw->hw->scrollerhook.h_Entry = (void *)ami_history_scroller_hook;
- gw->hw->scrollerhook.h_Data = gw->hw;
-
- gw->hw->objects[OID_MAIN] = WindowObj,
- WA_ScreenTitle, ami_gui_get_screen_title(),
- WA_Title, messages_get("History"),
- WA_Activate, TRUE,
- WA_DepthGadget, TRUE,
- WA_DragBar, TRUE,
- WA_CloseGadget, TRUE,
- WA_SizeGadget, TRUE,
- WA_PubScreen,scrn,
- WA_InnerWidth,width,
- WA_InnerHeight,height + 10,
- WINDOW_SharedPort,sport,
- WINDOW_UserData,gw->hw,
- WINDOW_IconifyGadget, FALSE,
- WINDOW_GadgetHelp, TRUE,
- WINDOW_Position, WPOS_CENTERSCREEN,
- WINDOW_HorizProp,1,
- WINDOW_VertProp,1,
- WINDOW_IDCMPHook,&gw->hw->scrollerhook,
- WINDOW_IDCMPHookBits,IDCMP_IDCMPUPDATE,
-// WA_ReportMouse,TRUE,
- WA_IDCMP,IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE, // | IDCMP_MOUSEMOVE,
- WINDOW_ParentGroup, gw->hw->objects[GID_MAIN] = LayoutVObj,
- LAYOUT_AddChild, gw->hw->objects[GID_BROWSER] = SpaceObj,
- GA_ID,GID_BROWSER,
-// SPACE_MinWidth,width,
-// SPACE_MinHeight,height,
- SpaceEnd,
- EndGroup,
- EndWindow;
-
- gw->hw->win = (struct Window *)RA_OpenWindow(gw->hw->objects[OID_MAIN]);
- ami_gui_win_list_add(gw->hw, AMINS_HISTORYWINDOW, &ami_localhistory_table);
-
- GetAttr(WINDOW_HorizObject,gw->hw->objects[OID_MAIN],(ULONG *)&gw->hw->objects[OID_HSCROLL]);
- GetAttr(WINDOW_VertObject,gw->hw->objects[OID_MAIN],(ULONG *)&gw->hw->objects[OID_VSCROLL]);
-
- RefreshSetGadgetAttrs((APTR)gw->hw->objects[OID_VSCROLL],gw->hw->win,NULL,
- GA_ID,OID_VSCROLL,
- SCROLLER_Top,0,
- ICA_TARGET,ICTARGET_IDCMP,
- TAG_DONE);
+ /* technically degenerate container of */
+ history_local_win = (struct ami_history_local_window *)ami_cw;
- RefreshSetGadgetAttrs((APTR)gw->hw->objects[OID_HSCROLL],gw->hw->win,NULL,
- GA_ID,OID_HSCROLL,
- SCROLLER_Top,0,
- ICA_TARGET,ICTARGET_IDCMP,
- TAG_DONE);
+ if (local_history_keypress(history_local_win->session, nskey)) {
+ return NSERROR_OK;
}
-
- ami_history_redraw(gw->hw);
+ return NSERROR_NOT_IMPLEMENTED;
}
-
/**
- * Handle mouse clicks in the history window.
+ * callback on draw event for certificate verify on core window
*
- * \return true if the event was handled, false to pass it on
+ * \param ami_cw The Amiga core window structure.
+ * \param x the x coordinate to draw
+ * \param y the y coordinate to draw
+ * \param r The rectangle of the window that needs updating.
+ * \param ctx The drawing context
+ * \return NSERROR_OK on success otherwise apropriate error code
*/
+static nserror
+ami_history_local_draw(struct ami_corewindow *ami_cw, int x, int y, struct rect *r, struct redraw_context *ctx)
+{
+ struct ami_history_local_window *history_local_win;
+
+ /* technically degenerate container of */
+ history_local_win = (struct ami_history_local_window *)ami_cw;
+
+ //ctx->plot->clip(ctx, r); //??
+ local_history_redraw(history_local_win->session, x, y, r, ctx);
+
+ return NSERROR_OK;
+}
-static bool ami_history_click(struct history_window *hw, uint16 code)
+static nserror
+ami_history_local_create_window(struct ami_history_local_window *history_local_win)
{
- int x, y;
- struct IBox *bbox;
- ULONG xs, ys;
+ struct ami_corewindow *ami_cw = (struct ami_corewindow *)&history_local_win->core;
+ ULONG refresh_mode = WA_SmartRefresh;
- if(ami_gui_get_space_box(hw->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return false;
+ if(nsoption_bool(window_simple_refresh) == true) {
+ refresh_mode = WA_SimpleRefresh;
}
- GetAttr(SCROLLER_Top,hw->objects[OID_HSCROLL],(ULONG *)&xs);
- x = hw->win->MouseX - bbox->Left +xs;
- GetAttr(SCROLLER_Top,hw->objects[OID_VSCROLL],(ULONG *)&ys);
- y = hw->win->MouseY - bbox->Top + ys;
-
- ami_gui_free_space_box(bbox);
-
- switch(code)
- {
- case SELECTUP:
- browser_window_history_click(hw->gw->bw, x, y, false);
- ami_history_redraw(hw);
- ami_schedule_redraw(hw->gw->shared, true);
- break;
-
- case MIDDLEUP:
- browser_window_history_click(hw->gw->bw, x, y, true);
- ami_history_redraw(hw);
- break;
+ ami_cw->objects[GID_CW_WIN] = WindowObj,
+ WA_ScreenTitle, ami_gui_get_screen_title(),
+ WA_Title, ami_cw->wintitle,
+ WA_Activate, TRUE,
+ WA_DepthGadget, TRUE,
+ WA_DragBar, TRUE,
+ WA_CloseGadget, TRUE,
+ WA_SizeGadget, TRUE,
+ WA_SizeBRight, TRUE,
+ WA_Width, 100,
+ WA_Height, 100,
+ WA_PubScreen, scrn,
+ WA_ReportMouse, TRUE,
+ refresh_mode, TRUE,
+ WA_IDCMP, IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
+ IDCMP_RAWKEY | IDCMP_GADGETUP | IDCMP_IDCMPUPDATE |
+ IDCMP_EXTENDEDMOUSE | IDCMP_SIZEVERIFY | IDCMP_REFRESHWINDOW,
+ WINDOW_IDCMPHook, &ami_cw->idcmp_hook,
+ WINDOW_IDCMPHookBits, IDCMP_IDCMPUPDATE | IDCMP_EXTENDEDMOUSE |
+ IDCMP_SIZEVERIFY | IDCMP_REFRESHWINDOW,
+ WINDOW_SharedPort, sport,
+ WINDOW_HorizProp, 1,
+ WINDOW_VertProp, 1,
+ WINDOW_UserData, history_local_win,
+// WINDOW_MenuStrip, NULL,
+ WINDOW_MenuUserData, WGUD_HOOK,
+ WINDOW_IconifyGadget, FALSE,
+ WINDOW_Position, WPOS_CENTERSCREEN,
+ WINDOW_ParentGroup, ami_cw->objects[GID_CW_MAIN] = LayoutVObj,
+ LAYOUT_AddChild, ami_cw->objects[GID_CW_DRAW] = SpaceObj,
+ GA_ID, GID_CW_DRAW,
+ SPACE_Transparent, TRUE,
+ SPACE_BevelStyle, BVS_DISPLAY,
+ GA_RelVerify, TRUE,
+ SpaceEnd,
+ EndGroup,
+ EndWindow;
+
+ if(ami_cw->objects[GID_CW_WIN] == NULL) {
+ return NSERROR_NOMEM;
}
- return true;
+ return NSERROR_OK;
}
-void ami_history_close(struct history_window *hw)
+/* exported interface documented in amiga/history_local.h */
+nserror ami_history_local_present(struct gui_window *gw)
{
- ami_plot_ra_free(hw->gg);
- hw->gw->hw = NULL;
- DisposeObject(hw->objects[OID_MAIN]);
- ami_gui_win_list_remove(hw);
-}
+ struct ami_history_local_window *ncwin;
+ nserror res;
+ int width, height;
-static BOOL ami_history_event(void *w)
-{
- /* return TRUE if window destroyed */
- struct history_window *hw = (struct history_window *)w;
- ULONG result = 0;
- uint16 code;
- nsurl *url = NULL;
- struct IBox *bbox;
- ULONG xs, ys;
-
- while((result = RA_HandleInput(hw->objects[OID_MAIN],&code)) != WMHI_LASTMSG)
- {
- switch(result & WMHI_CLASSMASK) // class
- {
-/* no menus yet, copied in as will probably need it later
- case WMHI_MENUPICK:
- item = ItemAddress(gwin->win->MenuStrip,code);
- while (code != MENUNULL)
- {
- ami_menupick(code,gwin);
- if(win_destroyed) break;
- code = item->NextSelect;
- }
- break;
-*/
-
- case WMHI_MOUSEMOVE:
- GetAttr(SCROLLER_Top, hw->objects[OID_HSCROLL], (ULONG *)&xs);
- GetAttr(SCROLLER_Top, hw->objects[OID_VSCROLL], (ULONG *)&ys);
-
- if(ami_gui_get_space_box(hw->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- break;
- }
-
- url = browser_window_history_position_url(hw->gw->bw,
- hw->win->MouseX - bbox->Left + xs,
- hw->win->MouseY - bbox->Top + ys);
-
- ami_gui_free_space_box(bbox);
-
- if (url == NULL) {
- RefreshSetGadgetAttrs(
- (APTR)hw->objects[GID_BROWSER],
- hw->win,
- NULL,
- GA_HintInfo,
- NULL,
- TAG_DONE);
- } else {
- RefreshSetGadgetAttrs(
- (APTR)hw->objects[GID_BROWSER],
- hw->win,
- NULL,
- GA_HintInfo,
- nsurl_access(url),
- TAG_DONE);
- nsurl_unref(url);
- }
- break;
-
- case WMHI_NEWSIZE:
- ami_history_redraw(hw);
- break;
-
- case WMHI_MOUSEBUTTONS:
- ami_history_click(hw,code);
- break;
-
- case WMHI_CLOSEWINDOW:
- ami_history_close(hw);
- return TRUE;
- break;
+ if(history_local_window != NULL) {
+ //windowtofront()
+
+ if (gw->hw != NULL) {
+ res = local_history_set(gw->hw->session, gw->bw);
+ return res;
}
+
+ return NSERROR_OK;
}
- return FALSE;
-}
-static void ami_history_update_extent(struct history_window *hw)
-{
- struct IBox *bbox;
- int width, height;
+ ncwin = calloc(1, sizeof(struct ami_history_local_window));
+ if (ncwin == NULL) {
+ return NSERROR_NOMEM;
+ }
- browser_window_history_size(hw->gw->bw, &width, &height);
- if(ami_gui_get_space_box(hw->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return;
+ ncwin->core.wintitle = ami_utf8_easy((char *)messages_get("History"));
+
+ res = ami_history_local_create_window(ncwin);
+ if (res != NSERROR_OK) {
+ LOG("SSL UI builder init failed");
+ ami_utf8_free(ncwin->core.wintitle);
+ free(ncwin);
+ return res;
}
- RefreshSetGadgetAttrs((APTR)hw->objects[OID_VSCROLL], hw->win, NULL,
- GA_ID, OID_VSCROLL,
- SCROLLER_Total, height,
- SCROLLER_Visible, bbox->Height,
- ICA_TARGET, ICTARGET_IDCMP,
- TAG_DONE);
+ /* initialise Amiga core window */
+ ncwin->core.draw = ami_history_local_draw;
+ ncwin->core.key = ami_history_local_key;
+ ncwin->core.mouse = ami_history_local_mouse;
+ ncwin->core.close = ami_history_local_destroy;
+ ncwin->core.event = NULL;
+ ncwin->core.drag_end = NULL;
+ ncwin->core.icon_drop = NULL;
+
+ res = ami_corewindow_init(&ncwin->core);
+ if (res != NSERROR_OK) {
+ ami_utf8_free(ncwin->core.wintitle);
+ DisposeObject(ncwin->core.objects[GID_CW_WIN]);
+ free(ncwin);
+ return res;
+ }
+
+ res = local_history_init(ncwin->core.cb_table,
+ (struct core_window *)ncwin,
+ gw->bw,
+ &ncwin->session);
+ if (res != NSERROR_OK) {
+ ami_utf8_free(ncwin->core.wintitle);
+ DisposeObject(ncwin->core.objects[GID_CW_WIN]);
+ free(ncwin);
+ return res;
+ }
+
+ res = local_history_get_size(ncwin->session,
+ &width,
+ &height);
- RefreshSetGadgetAttrs((APTR)hw->objects[OID_HSCROLL], hw->win, NULL,
- GA_ID, OID_HSCROLL,
- SCROLLER_Total, width,
- SCROLLER_Visible, bbox->Width,
- ICA_TARGET, ICTARGET_IDCMP,
+ /*TODO: Adjust these to account for window borders */
+
+ SetAttrs(ncwin->core.objects[GID_CW_WIN],
+ WA_Width, width,
+ WA_Height, height,
TAG_DONE);
- ami_gui_free_space_box(bbox);
+ ncwin->gw = gw;
+ history_local_window = ncwin;
+ gw->hw = ncwin;
+
+ return NSERROR_OK;
}
-HOOKF(void, ami_history_scroller_hook, Object *, object, struct IntuiMessage *)
-{
- ULONG gid;
- struct history_window *hw = hook->h_Data;
-
- if (msg->Class == IDCMP_IDCMPUPDATE)
- {
- gid = GetTagData( GA_ID, 0, msg->IAddress );
-
- switch( gid )
- {
- case OID_HSCROLL:
- case OID_VSCROLL:
- ami_history_redraw(hw);
- break;
- }
- }
-// ReplyMsg((struct Message *)msg);
-}
diff --git a/frontends/amiga/history_local.h b/frontends/amiga/history_local.h
old mode 100755
new mode 100644
index 97aea05..72ba7fa
--- a/frontends/amiga/history_local.h
+++ b/frontends/amiga/history_local.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2009 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
+ * Copyright 2017 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -16,23 +16,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef AMIGA_HISTORY_LOCAL_H
-#define AMIGA_HISTORY_LOCAL_H
-
-#include <exec/types.h>
-#include <intuition/classusr.h>
+#ifndef AMIGA_HISTORY_GLOBAL_H
+#define AMIGA_HISTORY_GLOBAL_H
struct gui_window;
-struct gui_globals;
-struct history_window;
-
-/**
- * Open history window.
- *
- * \param gw gui_window to open history for
- */
-void ami_history_open(struct gui_window *gw);
+struct ami_history_local_window;
-void ami_history_close(struct history_window *hw);
+/** Open the global history viewer */
+nserror ami_history_local_present(struct gui_window *gw);
+nserror ami_history_local_destroy(struct ami_history_local_window *history_local_win);
#endif
-----------------------------------------------------------------------
Summary of changes:
frontends/amiga/gui.c | 2 +-
frontends/amiga/gui.h | 7 +-
frontends/amiga/gui_menu.c | 2 +-
frontends/amiga/history_local.c | 531 +++++++++++++++++----------------------
frontends/amiga/history_local.h | 23 +-
5 files changed, 247 insertions(+), 318 deletions(-)
mode change 100755 => 100644 frontends/amiga/history_local.c
mode change 100755 => 100644 frontends/amiga/history_local.h
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 3168758..2d5a27c 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -4596,7 +4596,7 @@ static void gui_window_destroy(struct gui_window *g)
if(g->hw)
{
- ami_history_close(g->hw);
+ ami_history_local_destroy(g->hw);
win_destroyed = true;
}
diff --git a/frontends/amiga/gui.h b/frontends/amiga/gui.h
index 5cec82d..bf4ec91 100644
--- a/frontends/amiga/gui.h
+++ b/frontends/amiga/gui.h
@@ -87,7 +87,8 @@ enum
};
struct find_window;
-struct history_window;
+struct ami_history_local_window;
+struct ami_menu_data;
#define AMI_GUI_TOOLBAR_MAX 20
@@ -110,8 +111,6 @@ struct ami_generic_window {
const struct ami_win_event_table *tbl;
};
-struct ami_menu_data;
-
struct gui_window_2 {
struct ami_generic_window w;
struct Window *win;
@@ -174,7 +173,7 @@ struct gui_window
int c_h_temp;
int scrollx;
int scrolly;
- struct history_window *hw;
+ struct ami_history_local_window *hw;
struct List dllist;
struct hlcache_handle *favicon;
bool throbbing;
diff --git a/frontends/amiga/gui_menu.c b/frontends/amiga/gui_menu.c
index 0469dd5..6ee0800 100644
--- a/frontends/amiga/gui_menu.c
+++ b/frontends/amiga/gui_menu.c
@@ -326,7 +326,7 @@ HOOKF(void, ami_menu_item_browser_localhistory, APTR, window, struct IntuiMessag
struct gui_window_2 *gwin;
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
- ami_history_open(gwin->gw);
+ ami_history_local_present(gwin->gw);
}
HOOKF(void, ami_menu_item_browser_globalhistory, APTR, window, struct IntuiMessage *)
diff --git a/frontends/amiga/history_local.c b/frontends/amiga/history_local.c
old mode 100755
new mode 100644
index 84f6561..c1f2a36
--- a/frontends/amiga/history_local.c
+++ b/frontends/amiga/history_local.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2009, 2010 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
+ * Copyright 2017 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -16,359 +16,298 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
- * Browser history window (AmigaOS implementation).
- *
- * There is only one history window, not one per browser window.
+/**
+ * \file
+ * Implementation of Amiga local history using core windows.
*/
-#include "amiga/os3support.h"
-
-#include <stdbool.h>
+#include <stdint.h>
#include <stdlib.h>
-#include <string.h>
+
#include <proto/intuition.h>
-#include <proto/exec.h>
-#include <proto/graphics.h>
-#include <intuition/icclass.h>
-#include <proto/utility.h>
-#include <proto/window.h>
-#include <proto/space.h>
-#include <proto/layout.h>
+
#include <classes/window.h>
-#include <gadgets/space.h>
+#include <gadgets/button.h>
+#include <gadgets/layout.h>
#include <gadgets/scroller.h>
-#include <reaction/reaction.h>
+#include <gadgets/space.h>
+#include <images/label.h>
+
+#include <intuition/icclass.h>
#include <reaction/reaction_macros.h>
#include "utils/log.h"
-#include "utils/utils.h"
+#include "netsurf/keypress.h"
+#include "netsurf/plotters.h"
+#include "desktop/local_history.h"
#include "utils/messages.h"
+#include "utils/nsoption.h"
#include "utils/nsurl.h"
-#include "desktop/local_history.h"
-#include "netsurf/browser_window.h"
-#include "netsurf/plotters.h"
-#include "netsurf/window.h"
-#include "graphics/rpattr.h"
-#include "amiga/libs.h"
-#include "amiga/misc.h"
-#include "amiga/object.h"
-#include "amiga/plotters.h"
+#include "amiga/corewindow.h"
#include "amiga/gui.h"
+#include "amiga/libs.h"
#include "amiga/history_local.h"
+#include "amiga/utf8.h"
-struct history_window {
- struct ami_generic_window w;
- struct Window *win;
- Object *objects[GID_LAST];
- struct gui_window *gw;
- struct Hook scrollerhook;
- struct gui_globals *gg;
-};
-static void ami_history_update_extent(struct history_window *hw);
-HOOKF(void, ami_history_scroller_hook, Object *, object, struct IntuiMessage *);
+/**
+ * Amiga local history viewing window context
+ */
+struct ami_history_local_window {
+ /** Amiga core window context */
+ struct ami_corewindow core;
-static BOOL ami_history_event(void *w);
+ /** Amiga GUI stuff */
+ struct gui_window *gw;
-static const struct ami_win_event_table ami_localhistory_table = {
- ami_history_event,
- NULL, /* we don't explicitly close the local history window on quit */
+ /** local history viewer context data */
+ struct local_history_session *session;
};
+static struct ami_history_local_window *history_local_window = NULL;
+
/**
- * Redraw history window.
+ * destroy a previously created local history view
*/
-
-static void ami_history_redraw(struct history_window *hw)
+nserror
+ami_history_local_destroy(struct ami_history_local_window *history_local_win)
{
- struct IBox *bbox;
- ULONG xs,ys;
- struct rect clip;
- struct redraw_context ctx = {
- .interactive = true,
- .background_images = true,
- .plot = &amiplot,
- .priv = hw->gg
- };
-
- GetAttr(SCROLLER_Top,hw->objects[OID_HSCROLL],(ULONG *)&xs);
- GetAttr(SCROLLER_Top,hw->objects[OID_VSCROLL],(ULONG *)&ys);
- if(ami_gui_get_space_box(hw->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return;
+ nserror res;
+
+ if (history_local_win == NULL) {
+ return NSERROR_OK;
}
-/* core should clear this area for us
- SetRPAttrs(glob->rp, RPTAG_APenColor, 0xffffffff, TAG_DONE);
- RectFill(glob->rp, 0, 0, bbox->Width - 1, bbox->Height - 1);
-*/
- clip.x0 = xs;
- clip.y0 = ys;
- clip.x1 = bbox->Width + xs;
- clip.y1 = bbox->Height + ys;
- browser_window_history_redraw_rectangle(hw->gw->bw, &clip, 0, 0, &ctx);
+ res = local_history_fini(history_local_win->session);
+ if (res == NSERROR_OK) {
+ history_local_win->gw->hw = NULL;
+ res = ami_corewindow_fini(&history_local_win->core); /* closes the window for us */
+ history_local_window = NULL;
+ }
+ return res;
+}
- ami_clearclipreg(hw->gg);
- ami_history_update_extent(hw);
+/**
+ * callback for mouse action for local history on core window
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param mouse_state netsurf mouse state on event
+ * \param x location of event
+ * \param y location of event
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_history_local_mouse(struct ami_corewindow *ami_cw,
+ browser_mouse_state mouse_state,
+ int x, int y)
+{
+ struct ami_history_local_window *history_local_win;
+ /* technically degenerate container of */
+ history_local_win = (struct ami_history_local_window *)ami_cw;
+
+ nsurl *url = browser_window_history_position_url(history_local_win->gw->bw, x, y);
+
+ if (url == NULL) {
+ SetGadgetAttrs(
+ (struct Gadget *)ami_cw->objects[GID_CW_DRAW],
+ ami_cw->win,
+ NULL,
+ GA_HintInfo,
+ NULL,
+ TAG_DONE);
+ } else {
+ SetGadgetAttrs(
+ (struct Gadget *)ami_cw->objects[GID_CW_DRAW],
+ ami_cw->win,
+ NULL,
+ GA_HintInfo,
+ nsurl_access(url),
+ TAG_DONE);
+ nsurl_unref(url);
+ }
- BltBitMapRastPort(ami_plot_ra_get_bitmap(hw->gg), 0, 0, hw->win->RPort,
- bbox->Left, bbox->Top, bbox->Width, bbox->Height, 0x0C0);
+ local_history_mouse_action(history_local_win->session, mouse_state, x, y);
- ami_gui_free_space_box(bbox);
+ return NSERROR_OK;
}
-
-/* exported interface documented in amiga/history_local.h */
-void ami_history_open(struct gui_window *gw)
+/**
+ * callback for keypress for local history on core window
+ *
+ * \param ami_cw The Amiga core window structure.
+ * \param nskey The netsurf key code
+ * \return NSERROR_OK on success otherwise apropriate error code
+ */
+static nserror
+ami_history_local_key(struct ami_corewindow *ami_cw, uint32_t nskey)
{
- struct history *history;
- int width, height;
+ struct ami_history_local_window *history_local_win;
- if (gw->bw == NULL)
- return;
-
- history = browser_window_get_history(gw->bw);
- if (history == NULL)
- return;
-
- if(!gw->hw)
- {
- gw->hw = calloc(1, sizeof(struct history_window));
- gw->hw->gg = ami_plot_ra_alloc(scrn->Width, scrn->Height, false, true);
-
- gw->hw->gw = gw;
- browser_window_history_size(gw->bw, &width, &height);
-
- gw->hw->scrollerhook.h_Entry = (void *)ami_history_scroller_hook;
- gw->hw->scrollerhook.h_Data = gw->hw;
-
- gw->hw->objects[OID_MAIN] = WindowObj,
- WA_ScreenTitle, ami_gui_get_screen_title(),
- WA_Title, messages_get("History"),
- WA_Activate, TRUE,
- WA_DepthGadget, TRUE,
- WA_DragBar, TRUE,
- WA_CloseGadget, TRUE,
- WA_SizeGadget, TRUE,
- WA_PubScreen,scrn,
- WA_InnerWidth,width,
- WA_InnerHeight,height + 10,
- WINDOW_SharedPort,sport,
- WINDOW_UserData,gw->hw,
- WINDOW_IconifyGadget, FALSE,
- WINDOW_GadgetHelp, TRUE,
- WINDOW_Position, WPOS_CENTERSCREEN,
- WINDOW_HorizProp,1,
- WINDOW_VertProp,1,
- WINDOW_IDCMPHook,&gw->hw->scrollerhook,
- WINDOW_IDCMPHookBits,IDCMP_IDCMPUPDATE,
-// WA_ReportMouse,TRUE,
- WA_IDCMP,IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE, // | IDCMP_MOUSEMOVE,
- WINDOW_ParentGroup, gw->hw->objects[GID_MAIN] = LayoutVObj,
- LAYOUT_AddChild, gw->hw->objects[GID_BROWSER] = SpaceObj,
- GA_ID,GID_BROWSER,
-// SPACE_MinWidth,width,
-// SPACE_MinHeight,height,
- SpaceEnd,
- EndGroup,
- EndWindow;
-
- gw->hw->win = (struct Window *)RA_OpenWindow(gw->hw->objects[OID_MAIN]);
- ami_gui_win_list_add(gw->hw, AMINS_HISTORYWINDOW, &ami_localhistory_table);
-
- GetAttr(WINDOW_HorizObject,gw->hw->objects[OID_MAIN],(ULONG *)&gw->hw->objects[OID_HSCROLL]);
- GetAttr(WINDOW_VertObject,gw->hw->objects[OID_MAIN],(ULONG *)&gw->hw->objects[OID_VSCROLL]);
-
- RefreshSetGadgetAttrs((APTR)gw->hw->objects[OID_VSCROLL],gw->hw->win,NULL,
- GA_ID,OID_VSCROLL,
- SCROLLER_Top,0,
- ICA_TARGET,ICTARGET_IDCMP,
- TAG_DONE);
+ /* technically degenerate container of */
+ history_local_win = (struct ami_history_local_window *)ami_cw;
- RefreshSetGadgetAttrs((APTR)gw->hw->objects[OID_HSCROLL],gw->hw->win,NULL,
- GA_ID,OID_HSCROLL,
- SCROLLER_Top,0,
- ICA_TARGET,ICTARGET_IDCMP,
- TAG_DONE);
+ if (local_history_keypress(history_local_win->session, nskey)) {
+ return NSERROR_OK;
}
-
- ami_history_redraw(gw->hw);
+ return NSERROR_NOT_IMPLEMENTED;
}
-
/**
- * Handle mouse clicks in the history window.
+ * callback on draw event for certificate verify on core window
*
- * \return true if the event was handled, false to pass it on
+ * \param ami_cw The Amiga core window structure.
+ * \param x the x coordinate to draw
+ * \param y the y coordinate to draw
+ * \param r The rectangle of the window that needs updating.
+ * \param ctx The drawing context
+ * \return NSERROR_OK on success otherwise apropriate error code
*/
+static nserror
+ami_history_local_draw(struct ami_corewindow *ami_cw, int x, int y, struct rect *r, struct redraw_context *ctx)
+{
+ struct ami_history_local_window *history_local_win;
+
+ /* technically degenerate container of */
+ history_local_win = (struct ami_history_local_window *)ami_cw;
+
+ //ctx->plot->clip(ctx, r); //??
+ local_history_redraw(history_local_win->session, x, y, r, ctx);
+
+ return NSERROR_OK;
+}
-static bool ami_history_click(struct history_window *hw, uint16 code)
+static nserror
+ami_history_local_create_window(struct ami_history_local_window *history_local_win)
{
- int x, y;
- struct IBox *bbox;
- ULONG xs, ys;
+ struct ami_corewindow *ami_cw = (struct ami_corewindow *)&history_local_win->core;
+ ULONG refresh_mode = WA_SmartRefresh;
- if(ami_gui_get_space_box(hw->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return false;
+ if(nsoption_bool(window_simple_refresh) == true) {
+ refresh_mode = WA_SimpleRefresh;
}
- GetAttr(SCROLLER_Top,hw->objects[OID_HSCROLL],(ULONG *)&xs);
- x = hw->win->MouseX - bbox->Left +xs;
- GetAttr(SCROLLER_Top,hw->objects[OID_VSCROLL],(ULONG *)&ys);
- y = hw->win->MouseY - bbox->Top + ys;
-
- ami_gui_free_space_box(bbox);
-
- switch(code)
- {
- case SELECTUP:
- browser_window_history_click(hw->gw->bw, x, y, false);
- ami_history_redraw(hw);
- ami_schedule_redraw(hw->gw->shared, true);
- break;
-
- case MIDDLEUP:
- browser_window_history_click(hw->gw->bw, x, y, true);
- ami_history_redraw(hw);
- break;
+ ami_cw->objects[GID_CW_WIN] = WindowObj,
+ WA_ScreenTitle, ami_gui_get_screen_title(),
+ WA_Title, ami_cw->wintitle,
+ WA_Activate, TRUE,
+ WA_DepthGadget, TRUE,
+ WA_DragBar, TRUE,
+ WA_CloseGadget, TRUE,
+ WA_SizeGadget, TRUE,
+ WA_SizeBRight, TRUE,
+ WA_Width, 100,
+ WA_Height, 100,
+ WA_PubScreen, scrn,
+ WA_ReportMouse, TRUE,
+ refresh_mode, TRUE,
+ WA_IDCMP, IDCMP_MOUSEMOVE | IDCMP_MOUSEBUTTONS | IDCMP_NEWSIZE |
+ IDCMP_RAWKEY | IDCMP_GADGETUP | IDCMP_IDCMPUPDATE |
+ IDCMP_EXTENDEDMOUSE | IDCMP_SIZEVERIFY | IDCMP_REFRESHWINDOW,
+ WINDOW_IDCMPHook, &ami_cw->idcmp_hook,
+ WINDOW_IDCMPHookBits, IDCMP_IDCMPUPDATE | IDCMP_EXTENDEDMOUSE |
+ IDCMP_SIZEVERIFY | IDCMP_REFRESHWINDOW,
+ WINDOW_SharedPort, sport,
+ WINDOW_HorizProp, 1,
+ WINDOW_VertProp, 1,
+ WINDOW_UserData, history_local_win,
+// WINDOW_MenuStrip, NULL,
+ WINDOW_MenuUserData, WGUD_HOOK,
+ WINDOW_IconifyGadget, FALSE,
+ WINDOW_Position, WPOS_CENTERSCREEN,
+ WINDOW_ParentGroup, ami_cw->objects[GID_CW_MAIN] = LayoutVObj,
+ LAYOUT_AddChild, ami_cw->objects[GID_CW_DRAW] = SpaceObj,
+ GA_ID, GID_CW_DRAW,
+ SPACE_Transparent, TRUE,
+ SPACE_BevelStyle, BVS_DISPLAY,
+ GA_RelVerify, TRUE,
+ SpaceEnd,
+ EndGroup,
+ EndWindow;
+
+ if(ami_cw->objects[GID_CW_WIN] == NULL) {
+ return NSERROR_NOMEM;
}
- return true;
+ return NSERROR_OK;
}
-void ami_history_close(struct history_window *hw)
+/* exported interface documented in amiga/history_local.h */
+nserror ami_history_local_present(struct gui_window *gw)
{
- ami_plot_ra_free(hw->gg);
- hw->gw->hw = NULL;
- DisposeObject(hw->objects[OID_MAIN]);
- ami_gui_win_list_remove(hw);
-}
+ struct ami_history_local_window *ncwin;
+ nserror res;
+ int width, height;
-static BOOL ami_history_event(void *w)
-{
- /* return TRUE if window destroyed */
- struct history_window *hw = (struct history_window *)w;
- ULONG result = 0;
- uint16 code;
- nsurl *url = NULL;
- struct IBox *bbox;
- ULONG xs, ys;
-
- while((result = RA_HandleInput(hw->objects[OID_MAIN],&code)) != WMHI_LASTMSG)
- {
- switch(result & WMHI_CLASSMASK) // class
- {
-/* no menus yet, copied in as will probably need it later
- case WMHI_MENUPICK:
- item = ItemAddress(gwin->win->MenuStrip,code);
- while (code != MENUNULL)
- {
- ami_menupick(code,gwin);
- if(win_destroyed) break;
- code = item->NextSelect;
- }
- break;
-*/
-
- case WMHI_MOUSEMOVE:
- GetAttr(SCROLLER_Top, hw->objects[OID_HSCROLL], (ULONG *)&xs);
- GetAttr(SCROLLER_Top, hw->objects[OID_VSCROLL], (ULONG *)&ys);
-
- if(ami_gui_get_space_box(hw->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- break;
- }
-
- url = browser_window_history_position_url(hw->gw->bw,
- hw->win->MouseX - bbox->Left + xs,
- hw->win->MouseY - bbox->Top + ys);
-
- ami_gui_free_space_box(bbox);
-
- if (url == NULL) {
- RefreshSetGadgetAttrs(
- (APTR)hw->objects[GID_BROWSER],
- hw->win,
- NULL,
- GA_HintInfo,
- NULL,
- TAG_DONE);
- } else {
- RefreshSetGadgetAttrs(
- (APTR)hw->objects[GID_BROWSER],
- hw->win,
- NULL,
- GA_HintInfo,
- nsurl_access(url),
- TAG_DONE);
- nsurl_unref(url);
- }
- break;
-
- case WMHI_NEWSIZE:
- ami_history_redraw(hw);
- break;
-
- case WMHI_MOUSEBUTTONS:
- ami_history_click(hw,code);
- break;
-
- case WMHI_CLOSEWINDOW:
- ami_history_close(hw);
- return TRUE;
- break;
+ if(history_local_window != NULL) {
+ //windowtofront()
+
+ if (gw->hw != NULL) {
+ res = local_history_set(gw->hw->session, gw->bw);
+ return res;
}
+
+ return NSERROR_OK;
}
- return FALSE;
-}
-static void ami_history_update_extent(struct history_window *hw)
-{
- struct IBox *bbox;
- int width, height;
+ ncwin = calloc(1, sizeof(struct ami_history_local_window));
+ if (ncwin == NULL) {
+ return NSERROR_NOMEM;
+ }
- browser_window_history_size(hw->gw->bw, &width, &height);
- if(ami_gui_get_space_box(hw->objects[GID_BROWSER], &bbox) != NSERROR_OK) {
- amiga_warn_user("NoMemory", "");
- return;
+ ncwin->core.wintitle = ami_utf8_easy((char *)messages_get("History"));
+
+ res = ami_history_local_create_window(ncwin);
+ if (res != NSERROR_OK) {
+ LOG("SSL UI builder init failed");
+ ami_utf8_free(ncwin->core.wintitle);
+ free(ncwin);
+ return res;
}
- RefreshSetGadgetAttrs((APTR)hw->objects[OID_VSCROLL], hw->win, NULL,
- GA_ID, OID_VSCROLL,
- SCROLLER_Total, height,
- SCROLLER_Visible, bbox->Height,
- ICA_TARGET, ICTARGET_IDCMP,
- TAG_DONE);
+ /* initialise Amiga core window */
+ ncwin->core.draw = ami_history_local_draw;
+ ncwin->core.key = ami_history_local_key;
+ ncwin->core.mouse = ami_history_local_mouse;
+ ncwin->core.close = ami_history_local_destroy;
+ ncwin->core.event = NULL;
+ ncwin->core.drag_end = NULL;
+ ncwin->core.icon_drop = NULL;
+
+ res = ami_corewindow_init(&ncwin->core);
+ if (res != NSERROR_OK) {
+ ami_utf8_free(ncwin->core.wintitle);
+ DisposeObject(ncwin->core.objects[GID_CW_WIN]);
+ free(ncwin);
+ return res;
+ }
+
+ res = local_history_init(ncwin->core.cb_table,
+ (struct core_window *)ncwin,
+ gw->bw,
+ &ncwin->session);
+ if (res != NSERROR_OK) {
+ ami_utf8_free(ncwin->core.wintitle);
+ DisposeObject(ncwin->core.objects[GID_CW_WIN]);
+ free(ncwin);
+ return res;
+ }
+
+ res = local_history_get_size(ncwin->session,
+ &width,
+ &height);
- RefreshSetGadgetAttrs((APTR)hw->objects[OID_HSCROLL], hw->win, NULL,
- GA_ID, OID_HSCROLL,
- SCROLLER_Total, width,
- SCROLLER_Visible, bbox->Width,
- ICA_TARGET, ICTARGET_IDCMP,
+ /*TODO: Adjust these to account for window borders */
+
+ SetAttrs(ncwin->core.objects[GID_CW_WIN],
+ WA_Width, width,
+ WA_Height, height,
TAG_DONE);
- ami_gui_free_space_box(bbox);
+ ncwin->gw = gw;
+ history_local_window = ncwin;
+ gw->hw = ncwin;
+
+ return NSERROR_OK;
}
-HOOKF(void, ami_history_scroller_hook, Object *, object, struct IntuiMessage *)
-{
- ULONG gid;
- struct history_window *hw = hook->h_Data;
-
- if (msg->Class == IDCMP_IDCMPUPDATE)
- {
- gid = GetTagData( GA_ID, 0, msg->IAddress );
-
- switch( gid )
- {
- case OID_HSCROLL:
- case OID_VSCROLL:
- ami_history_redraw(hw);
- break;
- }
- }
-// ReplyMsg((struct Message *)msg);
-}
diff --git a/frontends/amiga/history_local.h b/frontends/amiga/history_local.h
old mode 100755
new mode 100644
index 97aea05..72ba7fa
--- a/frontends/amiga/history_local.h
+++ b/frontends/amiga/history_local.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2009 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
+ * Copyright 2017 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -16,23 +16,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef AMIGA_HISTORY_LOCAL_H
-#define AMIGA_HISTORY_LOCAL_H
-
-#include <exec/types.h>
-#include <intuition/classusr.h>
+#ifndef AMIGA_HISTORY_GLOBAL_H
+#define AMIGA_HISTORY_GLOBAL_H
struct gui_window;
-struct gui_globals;
-struct history_window;
-
-/**
- * Open history window.
- *
- * \param gw gui_window to open history for
- */
-void ami_history_open(struct gui_window *gw);
+struct ami_history_local_window;
-void ami_history_close(struct history_window *hw);
+/** Open the global history viewer */
+nserror ami_history_local_present(struct gui_window *gw);
+nserror ami_history_local_destroy(struct ami_history_local_window *history_local_win);
#endif
--
NetSurf Browser
5 years, 7 months
netsurf: branch master updated. release/3.6-473-g653ccb7
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/653ccb78a9d819d21dc8d...
...commit http://git.netsurf-browser.org/netsurf.git/commit/653ccb78a9d819d21dc8d3e...
...tree http://git.netsurf-browser.org/netsurf.git/tree/653ccb78a9d819d21dc8d3e6d...
The branch, master has been updated
via 653ccb78a9d819d21dc8d3e6d57d724215f50605 (commit)
from 92ecc77768dc86ed6a8d2d9aa1b0f49567878b2c (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=653ccb78a9d819d21dc...
commit 653ccb78a9d819d21dc8d3e6d57d724215f50605
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
Split local history data from viewer in headers
This separates the local history data object API from the viewing
API. It also changes the api to return nsurl references instead of
strings.
diff --git a/desktop/browser_history.c b/desktop/browser_history.c
index df95aa6..71fc974 100644
--- a/desktop/browser_history.c
+++ b/desktop/browser_history.c
@@ -41,6 +41,7 @@
#include "desktop/gui_internal.h"
#include "desktop/browser_history.h"
#include "desktop/browser_private.h"
+#include "desktop/local_history.h"
#define WIDTH 100
#define HEIGHT 86
@@ -811,7 +812,7 @@ bool browser_window_history_click(struct browser_window *bw,
/* exported interface documented in desktop/browser_history.h */
-const char *browser_window_history_position_url(struct browser_window *bw,
+nsurl *browser_window_history_position_url(struct browser_window *bw,
int x, int y)
{
struct history_entry *entry;
@@ -821,10 +822,11 @@ const char *browser_window_history_position_url(struct browser_window *bw,
history = bw->history;
entry = browser_window_history__find_position(history->start, x, y);
- if (!entry)
- return 0;
+ if (!entry) {
+ return NULL;
+ }
- return nsurl_access(entry->page.url);
+ return nsurl_ref(entry->page.url);
}
@@ -875,10 +877,9 @@ void browser_window_history_enumerate(const struct browser_window *bw,
/* exported interface documented in desktop/browser_history.h */
-const char *browser_window_history_entry_get_url(
- const struct history_entry *entry)
+nsurl *browser_window_history_entry_get_url(const struct history_entry *entry)
{
- return nsurl_access(entry->page.url);
+ return nsurl_ref(entry->page.url);
}
diff --git a/desktop/browser_history.h b/desktop/browser_history.h
index ec625df..9140e2c 100644
--- a/desktop/browser_history.h
+++ b/desktop/browser_history.h
@@ -16,71 +16,27 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
- * Browser history tree (interface).
+/**
+ * \file
+ * Interface to browser history operations
+ *
+ * The are operations on a browsing contexts history. These interfaces
+ * allow navigation forward and backwards in the history as well as
+ * enumerating the entries.
+ *
+ * The local history viewing is distinct via corewindow defined in
+ * desktop/local_history.h
*/
-#ifndef _NETSURF_DESKTOP_BROWSER_HISTORY_H_
-#define _NETSURF_DESKTOP_BROWSER_HISTORY_H_
+#ifndef NETSURF_DESKTOP_BROWSER_HISTORY_H
+#define NETSURF_DESKTOP_BROWSER_HISTORY_H
#include <stdbool.h>
-#include <libwapcaplet/libwapcaplet.h>
#include "utils/errors.h"
-struct hlcache_handle;
struct browser_window;
struct history_entry;
-struct redraw_context;
-
-/**
- * Create a new history tree for a browser window window.
- *
- * \param bw browser window to create history for.
- *
- * \return NSERROR_OK or appropriate error otherwise
- */
-nserror browser_window_history_create(struct browser_window *bw);
-
-/**
- * Clone a bw's history tree for new bw
- *
- * \param existing browser window with history to clone.
- * \param clone browser window to make cloned history for.
- *
- * \return NSERROR_OK or appropriate error otherwise
- */
-nserror browser_window_history_clone(const struct browser_window *existing,
- struct browser_window *clone);
-/**
- * Insert a url into the history tree.
- *
- * \param bw browser window with history object
- * \param content content to add to history
- * \param frag_id fragment identifier, or NULL.
- * \return NSERROR_OK or error code on faliure.
- *
- * The page is added after the current entry and becomes current.
- */
-nserror browser_window_history_add(struct browser_window *bw,
- struct hlcache_handle *content, lwc_string *frag_id);
-
-/**
- * Update the thumbnail for the current entry.
- *
- * \param bw The browser window to update the history within.
- * \param content content for current entry
- * \return NSERROR_OK or error code on faliure.
- */
-nserror browser_window_history_update(struct browser_window *bw,
- struct hlcache_handle *content);
-
-/**
- * Free a history structure.
- *
- * \param bw The browser window to destroy the history within.
- */
-void browser_window_history_destroy(struct browser_window *bw);
/**
* Go back in the history.
@@ -91,6 +47,7 @@ void browser_window_history_destroy(struct browser_window *bw);
*/
nserror browser_window_history_back(struct browser_window *bw, bool new_window);
+
/**
* Go forward in the history.
*
@@ -100,6 +57,7 @@ nserror browser_window_history_back(struct browser_window *bw, bool new_window);
*/
nserror browser_window_history_forward(struct browser_window *bw, bool new_window);
+
/**
* Check whether it is pssible to go back in the history.
*
@@ -108,6 +66,7 @@ nserror browser_window_history_forward(struct browser_window *bw, bool new_windo
*/
bool browser_window_history_back_available(struct browser_window *bw);
+
/**
* Check whether it is pssible to go forwards in the history.
*
@@ -116,51 +75,6 @@ bool browser_window_history_back_available(struct browser_window *bw);
*/
bool browser_window_history_forward_available(struct browser_window *bw);
-/**
- * Get the dimensions of a history.
- *
- * \param bw browser window with history object.
- * \param width updated to width
- * \param height updated to height
- */
-void browser_window_history_size(struct browser_window *bw,
- int *width, int *height);
-
-/**
- * Redraw part of a history area.
- *
- * \param bw browser window with history object.
- * \param clip redraw area
- * \param x start X co-ordinate on plot canvas
- * \param y start Y co-ordinate on plot canvas
- * \param ctx current redraw context
- */
-bool browser_window_history_redraw_rectangle(struct browser_window *bw,
- struct rect *clip, int x, int y,
- const struct redraw_context *ctx);
-
-/**
- * Handle a mouse click in a history.
- *
- * \param bw browser window containing history
- * \param x click coordinate
- * \param y click coordinate
- * \param new_window open a new window instead of using bw
- * \return true if action was taken, false if click was not on an entry
- */
-bool browser_window_history_click(struct browser_window *bw,
- int x, int y, bool new_window);
-
-/**
- * Determine the URL of the entry at a position.
- *
- * \param bw browser window containing history
- * \param x x coordinate.
- * \param y y coordinate.
- * \return URL, or 0 if no entry at (x, y)
- */
-const char *browser_window_history_position_url(struct browser_window *bw,
- int x, int y);
/**
* Callback function type for history enumeration
@@ -175,6 +89,7 @@ typedef bool (*browser_window_history_enumerate_cb)(
int x0, int y0, int x1, int y1,
const struct history_entry *entry, void *user_data);
+
/**
* Enumerate all entries in the history.
* Do not change the history while it is being enumerated.
@@ -186,6 +101,7 @@ typedef bool (*browser_window_history_enumerate_cb)(
void browser_window_history_enumerate(const struct browser_window *bw,
browser_window_history_enumerate_cb cb, void *user_data);
+
/**
* Enumerate all entries that will be reached by the 'forward' button
*
@@ -196,6 +112,7 @@ void browser_window_history_enumerate(const struct browser_window *bw,
void browser_window_history_enumerate_forward(const struct browser_window *bw,
browser_window_history_enumerate_cb cb, void *user_data);
+
/**
* Enumerate all entries that will be reached by the 'back' button
*
@@ -206,14 +123,15 @@ void browser_window_history_enumerate_forward(const struct browser_window *bw,
void browser_window_history_enumerate_back(const struct browser_window *bw,
browser_window_history_enumerate_cb cb, void *user_data);
+
/**
* Returns the URL to a history entry
*
- * \param entry the history entry to retrieve the URL from
- * \return the URL
+ * \param entry the history entry to retrieve the URL from
+ * \return A referenced nsurl URL
*/
-const char *browser_window_history_entry_get_url(
- const struct history_entry *entry);
+struct nsurl *browser_window_history_entry_get_url(const struct history_entry *entry);
+
/**
* Returns the URL to a history entry
@@ -224,6 +142,7 @@ const char *browser_window_history_entry_get_url(
const char *browser_window_history_entry_get_fragment_id(
const struct history_entry *entry);
+
/**
* Returns the title of a history entry
*
@@ -233,6 +152,7 @@ const char *browser_window_history_entry_get_fragment_id(
const char *browser_window_history_entry_get_title(
const struct history_entry *entry);
+
/**
* Navigate to specified history entry, optionally in new window
*
diff --git a/desktop/browser_private.h b/desktop/browser_private.h
index 5a53e2f..a54393f 100644
--- a/desktop/browser_private.h
+++ b/desktop/browser_private.h
@@ -249,4 +249,55 @@ void browser_window_set_status(struct browser_window *bw, const char *text);
*/
struct browser_window * browser_window_get_root(struct browser_window *bw);
+
+/**
+ * Create a new history tree for a browser window window.
+ *
+ * \param bw browser window to create history for.
+ *
+ * \return NSERROR_OK or appropriate error otherwise
+ */
+nserror browser_window_history_create(struct browser_window *bw);
+
+/**
+ * Clone a bw's history tree for new bw
+ *
+ * \param existing browser window with history to clone.
+ * \param clone browser window to make cloned history for.
+ *
+ * \return NSERROR_OK or appropriate error otherwise
+ */
+nserror browser_window_history_clone(const struct browser_window *existing,
+ struct browser_window *clone);
+/**
+ * Insert a url into the history tree.
+ *
+ * \param bw browser window with history object
+ * \param content content to add to history
+ * \param frag_id fragment identifier, or NULL.
+ * \return NSERROR_OK or error code on faliure.
+ *
+ * The page is added after the current entry and becomes current.
+ */
+nserror browser_window_history_add(struct browser_window *bw,
+ struct hlcache_handle *content, lwc_string *frag_id);
+
+/**
+ * Update the thumbnail for the current entry.
+ *
+ * \param bw The browser window to update the history within.
+ * \param content content for current entry
+ * \return NSERROR_OK or error code on faliure.
+ */
+nserror browser_window_history_update(struct browser_window *bw,
+ struct hlcache_handle *content);
+
+/**
+ * Free a history structure.
+ *
+ * \param bw The browser window to destroy the history within.
+ */
+void browser_window_history_destroy(struct browser_window *bw);
+
+
#endif
diff --git a/desktop/local_history.c b/desktop/local_history.c
index d7022d7..ffe01e0 100644
--- a/desktop/local_history.c
+++ b/desktop/local_history.c
@@ -24,6 +24,7 @@
#include <stdlib.h>
#include "utils/errors.h"
+#include "utils/nsurl.h"
#include "netsurf/types.h"
#include "netsurf/core_window.h"
@@ -143,9 +144,9 @@ local_history_get_size(struct local_history_session *session,
nserror
local_history_get_url(struct local_history_session *session,
int x, int y,
- const char **url_out)
+ nsurl **url_out)
{
- const char *url;
+ nsurl *url;
url = browser_window_history_position_url(session->bw, x, y);
if (url == NULL) {
return NSERROR_NOT_FOUND;
diff --git a/desktop/local_history.h b/desktop/local_history.h
index 2ce2a5c..9bfe0f2 100644
--- a/desktop/local_history.h
+++ b/desktop/local_history.h
@@ -35,14 +35,15 @@ struct browser_window;
/**
* Initialise the local history.
*
- * This iterates through the URL database, generating the local history data,
- * and creates a treeview.
+ * This iterates through the history object of a browser window and
+ * creates tree of visited pages with thumbnails which may be selected
+ * to cause navigation.
*
* This must be called before any other local_history_* function.
*
- * \param cw_t Callback table for core_window containing the treeview.
- * \param core_window_handle The core_window in which the treeview is shown.
- * \param bw browser window to show history of.
+ * \param[in] cw_t Callback table for core_window containing the treeview.
+ * \param[in] core_window_handle The core_window in which the treeview is shown.
+ * \param[in] bw browser window to show history of.
* \param[out] session The created local history session context.
* \return NSERROR_OK on success and session set, appropriate error code otherwise
*/
@@ -54,12 +55,12 @@ nserror local_history_init(struct core_window_callback_table *cw_t,
/**
* Finalise the local history.
*
- * This destroys the local history treeview and the local history module's
- * internal data. After calling this if ocall history is required again,
- * local_history_init must be called.
+ * This destroys the local history view and the local history module's
+ * internal data. After calling this if local history is required again,
+ * local_history_init must be called to create a new session.
*
* \param session The local history session to finalise.
- * \return NSERROR_OK on success, appropriate error otherwise
+ * \return NSERROR_OK on success and session freed appropriate error otherwise
*/
nserror local_history_fini(struct local_history_session *session);
@@ -67,42 +68,49 @@ nserror local_history_fini(struct local_history_session *session);
/**
* Redraw the local history.
*
- * \param session The local history session context.
- * \param x X coordinate to render history at
- * \param y Y coordinate to render history at
- * \param clip Current clip rectangle (wrt tree origin)
- * \param ctx Current redraw context
+ * Causes the local history viewer to issue plot operations to redraw
+ * the specified area of the viewport.
+ *
+ * \param[in] session The local history session context.
+ * \param[in] x X coordinate to render history at
+ * \param[in] y Y coordinate to render history at
+ * \param[in] clip Current clip rectangle (wrt tree origin)
+ * \param[in] ctx Current redraw context
*/
nserror local_history_redraw(struct local_history_session *session, int x, int y, struct rect *clip, const struct redraw_context *ctx);
+
/**
* Handles all kinds of mouse action
*
- * \param session The local history session context.
- * \param mouse The current mouse state
- * \param x X coordinate
- * \param y Y coordinate
+ * \param[in] session The local history session context.
+ * \param[in] mouse The current mouse state
+ * \param[in] x The current mouse X coordinate
+ * \param[in] y The current mouse Y coordinate
*/
void local_history_mouse_action(struct local_history_session *session, enum browser_mouse_state mouse, int x, int y);
+
/**
* Key press handling.
*
- * \param session The local history session context.
- * \param key The ucs4 character codepoint
+ * \param[in] session The local history session context.
+ * \param[in] key The ucs4 character codepoint
* \return true if the keypress is dealt with, false otherwise.
*/
bool local_history_keypress(struct local_history_session *session, uint32_t key);
+
/**
* Change the browser window to draw local history for.
*
- * \param session The local history session context.
+ * \param[in] session The local history session context.
* \param bw browser window to show history of.
* \return NSERROR_OK or appropriate error code.
*/
nserror local_history_set(struct local_history_session *session, struct browser_window *bw);
+
/**
* get size of local history content area.
*
@@ -113,6 +121,7 @@ nserror local_history_set(struct local_history_session *session, struct browser_
*/
nserror local_history_get_size(struct local_history_session *session, int *width, int *height);
+
/**
* get url of entry at position in local history content area.
*
@@ -121,10 +130,55 @@ nserror local_history_get_size(struct local_history_session *session, int *width
* \param[in] session The local history session context.
* \param[in] x The x coordinate to get url of.
* \param[in] y The y coordinate to get url of.
- * \param[out] url_out string representation of the url at the coordinates.
+ * \param[out] url_out referenced url.
* \return NSERROR_OK and url_out updated or NSERROR_NOT_FOUND if no url at
* location.
*/
-nserror local_history_get_url(struct local_history_session *session, int x, int y, const char **url_out);
+nserror local_history_get_url(struct local_history_session *session, int x, int y, struct nsurl **url_out);
+
+
+/* depricated local history viewing interfaces */
+
+/**
+ * Get the dimensions of a history.
+ *
+ * \param bw browser window with history object.
+ * \param width updated to width
+ * \param height updated to height
+ */
+void browser_window_history_size(struct browser_window *bw, int *width, int *height);
+
+/**
+ * Redraw part of a history area.
+ *
+ * \param bw browser window with history object.
+ * \param clip redraw area
+ * \param x start X co-ordinate on plot canvas
+ * \param y start Y co-ordinate on plot canvas
+ * \param ctx current redraw context
+ */
+bool browser_window_history_redraw_rectangle(struct browser_window *bw, struct rect *clip, int x, int y, const struct redraw_context *ctx);
+
+/**
+ * Handle a mouse click in a history.
+ *
+ * \param bw browser window containing history
+ * \param x click coordinate
+ * \param y click coordinate
+ * \param new_window open a new window instead of using bw
+ * \return true if action was taken, false if click was not on an entry
+ */
+bool browser_window_history_click(struct browser_window *bw, int x, int y, bool new_window);
+
+/**
+ * Determine the URL of the entry at a position.
+ *
+ * \param bw browser window containing history
+ * \param x x coordinate.
+ * \param y y coordinate.
+ * \return nsurl at position or NULL if no entry.
+ */
+struct nsurl *browser_window_history_position_url(struct browser_window *bw, int x, int y);
+
#endif
diff --git a/frontends/amiga/history_local.c b/frontends/amiga/history_local.c
index 8d1f4ac..84f6561 100755
--- a/frontends/amiga/history_local.c
+++ b/frontends/amiga/history_local.c
@@ -44,7 +44,8 @@
#include "utils/log.h"
#include "utils/utils.h"
#include "utils/messages.h"
-#include "desktop/browser_history.h"
+#include "utils/nsurl.h"
+#include "desktop/local_history.h"
#include "netsurf/browser_window.h"
#include "netsurf/plotters.h"
#include "netsurf/window.h"
@@ -252,7 +253,7 @@ static BOOL ami_history_event(void *w)
struct history_window *hw = (struct history_window *)w;
ULONG result = 0;
uint16 code;
- const char *url;
+ nsurl *url = NULL;
struct IBox *bbox;
ULONG xs, ys;
@@ -287,10 +288,24 @@ static BOOL ami_history_event(void *w)
ami_gui_free_space_box(bbox);
- RefreshSetGadgetAttrs((APTR)hw->objects[GID_BROWSER],
- hw->win, NULL,
- GA_HintInfo, url,
- TAG_DONE);
+ if (url == NULL) {
+ RefreshSetGadgetAttrs(
+ (APTR)hw->objects[GID_BROWSER],
+ hw->win,
+ NULL,
+ GA_HintInfo,
+ NULL,
+ TAG_DONE);
+ } else {
+ RefreshSetGadgetAttrs(
+ (APTR)hw->objects[GID_BROWSER],
+ hw->win,
+ NULL,
+ GA_HintInfo,
+ nsurl_access(url),
+ TAG_DONE);
+ nsurl_unref(url);
+ }
break;
case WMHI_NEWSIZE:
diff --git a/frontends/riscos/local_history.c b/frontends/riscos/local_history.c
index 1ad63e0..1ae98ff 100644
--- a/frontends/riscos/local_history.c
+++ b/frontends/riscos/local_history.c
@@ -28,6 +28,7 @@
#include "utils/nsoption.h"
#include "utils/messages.h"
#include "utils/log.h"
+#include "utils/nsurl.h"
#include "netsurf/window.h"
#include "netsurf/plotters.h"
#include "netsurf/keypress.h"
@@ -127,7 +128,7 @@ static nserror
ro_local_history_tooltip(struct ro_local_history_window *lhw, int x, int y)
{
int width;
- const char *url;
+ nsurl *url;
wimp_window_state state;
wimp_icon_state ic;
os_box box = {0, 0, 0, 0};
@@ -162,17 +163,19 @@ ro_local_history_tooltip(struct ro_local_history_window *lhw, int x, int y)
}
/* get width of string */
- error = xwimptextop_string_width(url,
- strlen(url) > 256 ? 256 : strlen(url),
+ error = xwimptextop_string_width(nsurl_access(url),
+ nsurl_length(url) > 256 ? 256 : nsurl_length(url),
&width);
if (error) {
LOG("xwimptextop_string_width: 0x%x: %s",
error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
+ nsurl_unref(url);
return NSERROR_NOMEM;
}
- ro_gui_set_icon_string(dialog_tooltip, 0, url, true);
+ ro_gui_set_icon_string(dialog_tooltip, 0, nsurl_access(url), true);
+ nsurl_unref(url);
/* resize icon appropriately */
ic.w = dialog_tooltip;
-----------------------------------------------------------------------
Summary of changes:
desktop/browser_history.c | 15 +++--
desktop/browser_history.h | 130 ++++++++------------------------------
desktop/browser_private.h | 51 +++++++++++++++
desktop/local_history.c | 5 +-
desktop/local_history.h | 100 ++++++++++++++++++++++-------
frontends/amiga/history_local.c | 27 ++++++--
frontends/riscos/local_history.c | 11 ++--
7 files changed, 192 insertions(+), 147 deletions(-)
diff --git a/desktop/browser_history.c b/desktop/browser_history.c
index df95aa6..71fc974 100644
--- a/desktop/browser_history.c
+++ b/desktop/browser_history.c
@@ -41,6 +41,7 @@
#include "desktop/gui_internal.h"
#include "desktop/browser_history.h"
#include "desktop/browser_private.h"
+#include "desktop/local_history.h"
#define WIDTH 100
#define HEIGHT 86
@@ -811,7 +812,7 @@ bool browser_window_history_click(struct browser_window *bw,
/* exported interface documented in desktop/browser_history.h */
-const char *browser_window_history_position_url(struct browser_window *bw,
+nsurl *browser_window_history_position_url(struct browser_window *bw,
int x, int y)
{
struct history_entry *entry;
@@ -821,10 +822,11 @@ const char *browser_window_history_position_url(struct browser_window *bw,
history = bw->history;
entry = browser_window_history__find_position(history->start, x, y);
- if (!entry)
- return 0;
+ if (!entry) {
+ return NULL;
+ }
- return nsurl_access(entry->page.url);
+ return nsurl_ref(entry->page.url);
}
@@ -875,10 +877,9 @@ void browser_window_history_enumerate(const struct browser_window *bw,
/* exported interface documented in desktop/browser_history.h */
-const char *browser_window_history_entry_get_url(
- const struct history_entry *entry)
+nsurl *browser_window_history_entry_get_url(const struct history_entry *entry)
{
- return nsurl_access(entry->page.url);
+ return nsurl_ref(entry->page.url);
}
diff --git a/desktop/browser_history.h b/desktop/browser_history.h
index ec625df..9140e2c 100644
--- a/desktop/browser_history.h
+++ b/desktop/browser_history.h
@@ -16,71 +16,27 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
- * Browser history tree (interface).
+/**
+ * \file
+ * Interface to browser history operations
+ *
+ * The are operations on a browsing contexts history. These interfaces
+ * allow navigation forward and backwards in the history as well as
+ * enumerating the entries.
+ *
+ * The local history viewing is distinct via corewindow defined in
+ * desktop/local_history.h
*/
-#ifndef _NETSURF_DESKTOP_BROWSER_HISTORY_H_
-#define _NETSURF_DESKTOP_BROWSER_HISTORY_H_
+#ifndef NETSURF_DESKTOP_BROWSER_HISTORY_H
+#define NETSURF_DESKTOP_BROWSER_HISTORY_H
#include <stdbool.h>
-#include <libwapcaplet/libwapcaplet.h>
#include "utils/errors.h"
-struct hlcache_handle;
struct browser_window;
struct history_entry;
-struct redraw_context;
-
-/**
- * Create a new history tree for a browser window window.
- *
- * \param bw browser window to create history for.
- *
- * \return NSERROR_OK or appropriate error otherwise
- */
-nserror browser_window_history_create(struct browser_window *bw);
-
-/**
- * Clone a bw's history tree for new bw
- *
- * \param existing browser window with history to clone.
- * \param clone browser window to make cloned history for.
- *
- * \return NSERROR_OK or appropriate error otherwise
- */
-nserror browser_window_history_clone(const struct browser_window *existing,
- struct browser_window *clone);
-/**
- * Insert a url into the history tree.
- *
- * \param bw browser window with history object
- * \param content content to add to history
- * \param frag_id fragment identifier, or NULL.
- * \return NSERROR_OK or error code on faliure.
- *
- * The page is added after the current entry and becomes current.
- */
-nserror browser_window_history_add(struct browser_window *bw,
- struct hlcache_handle *content, lwc_string *frag_id);
-
-/**
- * Update the thumbnail for the current entry.
- *
- * \param bw The browser window to update the history within.
- * \param content content for current entry
- * \return NSERROR_OK or error code on faliure.
- */
-nserror browser_window_history_update(struct browser_window *bw,
- struct hlcache_handle *content);
-
-/**
- * Free a history structure.
- *
- * \param bw The browser window to destroy the history within.
- */
-void browser_window_history_destroy(struct browser_window *bw);
/**
* Go back in the history.
@@ -91,6 +47,7 @@ void browser_window_history_destroy(struct browser_window *bw);
*/
nserror browser_window_history_back(struct browser_window *bw, bool new_window);
+
/**
* Go forward in the history.
*
@@ -100,6 +57,7 @@ nserror browser_window_history_back(struct browser_window *bw, bool new_window);
*/
nserror browser_window_history_forward(struct browser_window *bw, bool new_window);
+
/**
* Check whether it is pssible to go back in the history.
*
@@ -108,6 +66,7 @@ nserror browser_window_history_forward(struct browser_window *bw, bool new_windo
*/
bool browser_window_history_back_available(struct browser_window *bw);
+
/**
* Check whether it is pssible to go forwards in the history.
*
@@ -116,51 +75,6 @@ bool browser_window_history_back_available(struct browser_window *bw);
*/
bool browser_window_history_forward_available(struct browser_window *bw);
-/**
- * Get the dimensions of a history.
- *
- * \param bw browser window with history object.
- * \param width updated to width
- * \param height updated to height
- */
-void browser_window_history_size(struct browser_window *bw,
- int *width, int *height);
-
-/**
- * Redraw part of a history area.
- *
- * \param bw browser window with history object.
- * \param clip redraw area
- * \param x start X co-ordinate on plot canvas
- * \param y start Y co-ordinate on plot canvas
- * \param ctx current redraw context
- */
-bool browser_window_history_redraw_rectangle(struct browser_window *bw,
- struct rect *clip, int x, int y,
- const struct redraw_context *ctx);
-
-/**
- * Handle a mouse click in a history.
- *
- * \param bw browser window containing history
- * \param x click coordinate
- * \param y click coordinate
- * \param new_window open a new window instead of using bw
- * \return true if action was taken, false if click was not on an entry
- */
-bool browser_window_history_click(struct browser_window *bw,
- int x, int y, bool new_window);
-
-/**
- * Determine the URL of the entry at a position.
- *
- * \param bw browser window containing history
- * \param x x coordinate.
- * \param y y coordinate.
- * \return URL, or 0 if no entry at (x, y)
- */
-const char *browser_window_history_position_url(struct browser_window *bw,
- int x, int y);
/**
* Callback function type for history enumeration
@@ -175,6 +89,7 @@ typedef bool (*browser_window_history_enumerate_cb)(
int x0, int y0, int x1, int y1,
const struct history_entry *entry, void *user_data);
+
/**
* Enumerate all entries in the history.
* Do not change the history while it is being enumerated.
@@ -186,6 +101,7 @@ typedef bool (*browser_window_history_enumerate_cb)(
void browser_window_history_enumerate(const struct browser_window *bw,
browser_window_history_enumerate_cb cb, void *user_data);
+
/**
* Enumerate all entries that will be reached by the 'forward' button
*
@@ -196,6 +112,7 @@ void browser_window_history_enumerate(const struct browser_window *bw,
void browser_window_history_enumerate_forward(const struct browser_window *bw,
browser_window_history_enumerate_cb cb, void *user_data);
+
/**
* Enumerate all entries that will be reached by the 'back' button
*
@@ -206,14 +123,15 @@ void browser_window_history_enumerate_forward(const struct browser_window *bw,
void browser_window_history_enumerate_back(const struct browser_window *bw,
browser_window_history_enumerate_cb cb, void *user_data);
+
/**
* Returns the URL to a history entry
*
- * \param entry the history entry to retrieve the URL from
- * \return the URL
+ * \param entry the history entry to retrieve the URL from
+ * \return A referenced nsurl URL
*/
-const char *browser_window_history_entry_get_url(
- const struct history_entry *entry);
+struct nsurl *browser_window_history_entry_get_url(const struct history_entry *entry);
+
/**
* Returns the URL to a history entry
@@ -224,6 +142,7 @@ const char *browser_window_history_entry_get_url(
const char *browser_window_history_entry_get_fragment_id(
const struct history_entry *entry);
+
/**
* Returns the title of a history entry
*
@@ -233,6 +152,7 @@ const char *browser_window_history_entry_get_fragment_id(
const char *browser_window_history_entry_get_title(
const struct history_entry *entry);
+
/**
* Navigate to specified history entry, optionally in new window
*
diff --git a/desktop/browser_private.h b/desktop/browser_private.h
index 5a53e2f..a54393f 100644
--- a/desktop/browser_private.h
+++ b/desktop/browser_private.h
@@ -249,4 +249,55 @@ void browser_window_set_status(struct browser_window *bw, const char *text);
*/
struct browser_window * browser_window_get_root(struct browser_window *bw);
+
+/**
+ * Create a new history tree for a browser window window.
+ *
+ * \param bw browser window to create history for.
+ *
+ * \return NSERROR_OK or appropriate error otherwise
+ */
+nserror browser_window_history_create(struct browser_window *bw);
+
+/**
+ * Clone a bw's history tree for new bw
+ *
+ * \param existing browser window with history to clone.
+ * \param clone browser window to make cloned history for.
+ *
+ * \return NSERROR_OK or appropriate error otherwise
+ */
+nserror browser_window_history_clone(const struct browser_window *existing,
+ struct browser_window *clone);
+/**
+ * Insert a url into the history tree.
+ *
+ * \param bw browser window with history object
+ * \param content content to add to history
+ * \param frag_id fragment identifier, or NULL.
+ * \return NSERROR_OK or error code on faliure.
+ *
+ * The page is added after the current entry and becomes current.
+ */
+nserror browser_window_history_add(struct browser_window *bw,
+ struct hlcache_handle *content, lwc_string *frag_id);
+
+/**
+ * Update the thumbnail for the current entry.
+ *
+ * \param bw The browser window to update the history within.
+ * \param content content for current entry
+ * \return NSERROR_OK or error code on faliure.
+ */
+nserror browser_window_history_update(struct browser_window *bw,
+ struct hlcache_handle *content);
+
+/**
+ * Free a history structure.
+ *
+ * \param bw The browser window to destroy the history within.
+ */
+void browser_window_history_destroy(struct browser_window *bw);
+
+
#endif
diff --git a/desktop/local_history.c b/desktop/local_history.c
index d7022d7..ffe01e0 100644
--- a/desktop/local_history.c
+++ b/desktop/local_history.c
@@ -24,6 +24,7 @@
#include <stdlib.h>
#include "utils/errors.h"
+#include "utils/nsurl.h"
#include "netsurf/types.h"
#include "netsurf/core_window.h"
@@ -143,9 +144,9 @@ local_history_get_size(struct local_history_session *session,
nserror
local_history_get_url(struct local_history_session *session,
int x, int y,
- const char **url_out)
+ nsurl **url_out)
{
- const char *url;
+ nsurl *url;
url = browser_window_history_position_url(session->bw, x, y);
if (url == NULL) {
return NSERROR_NOT_FOUND;
diff --git a/desktop/local_history.h b/desktop/local_history.h
index 2ce2a5c..9bfe0f2 100644
--- a/desktop/local_history.h
+++ b/desktop/local_history.h
@@ -35,14 +35,15 @@ struct browser_window;
/**
* Initialise the local history.
*
- * This iterates through the URL database, generating the local history data,
- * and creates a treeview.
+ * This iterates through the history object of a browser window and
+ * creates tree of visited pages with thumbnails which may be selected
+ * to cause navigation.
*
* This must be called before any other local_history_* function.
*
- * \param cw_t Callback table for core_window containing the treeview.
- * \param core_window_handle The core_window in which the treeview is shown.
- * \param bw browser window to show history of.
+ * \param[in] cw_t Callback table for core_window containing the treeview.
+ * \param[in] core_window_handle The core_window in which the treeview is shown.
+ * \param[in] bw browser window to show history of.
* \param[out] session The created local history session context.
* \return NSERROR_OK on success and session set, appropriate error code otherwise
*/
@@ -54,12 +55,12 @@ nserror local_history_init(struct core_window_callback_table *cw_t,
/**
* Finalise the local history.
*
- * This destroys the local history treeview and the local history module's
- * internal data. After calling this if ocall history is required again,
- * local_history_init must be called.
+ * This destroys the local history view and the local history module's
+ * internal data. After calling this if local history is required again,
+ * local_history_init must be called to create a new session.
*
* \param session The local history session to finalise.
- * \return NSERROR_OK on success, appropriate error otherwise
+ * \return NSERROR_OK on success and session freed appropriate error otherwise
*/
nserror local_history_fini(struct local_history_session *session);
@@ -67,42 +68,49 @@ nserror local_history_fini(struct local_history_session *session);
/**
* Redraw the local history.
*
- * \param session The local history session context.
- * \param x X coordinate to render history at
- * \param y Y coordinate to render history at
- * \param clip Current clip rectangle (wrt tree origin)
- * \param ctx Current redraw context
+ * Causes the local history viewer to issue plot operations to redraw
+ * the specified area of the viewport.
+ *
+ * \param[in] session The local history session context.
+ * \param[in] x X coordinate to render history at
+ * \param[in] y Y coordinate to render history at
+ * \param[in] clip Current clip rectangle (wrt tree origin)
+ * \param[in] ctx Current redraw context
*/
nserror local_history_redraw(struct local_history_session *session, int x, int y, struct rect *clip, const struct redraw_context *ctx);
+
/**
* Handles all kinds of mouse action
*
- * \param session The local history session context.
- * \param mouse The current mouse state
- * \param x X coordinate
- * \param y Y coordinate
+ * \param[in] session The local history session context.
+ * \param[in] mouse The current mouse state
+ * \param[in] x The current mouse X coordinate
+ * \param[in] y The current mouse Y coordinate
*/
void local_history_mouse_action(struct local_history_session *session, enum browser_mouse_state mouse, int x, int y);
+
/**
* Key press handling.
*
- * \param session The local history session context.
- * \param key The ucs4 character codepoint
+ * \param[in] session The local history session context.
+ * \param[in] key The ucs4 character codepoint
* \return true if the keypress is dealt with, false otherwise.
*/
bool local_history_keypress(struct local_history_session *session, uint32_t key);
+
/**
* Change the browser window to draw local history for.
*
- * \param session The local history session context.
+ * \param[in] session The local history session context.
* \param bw browser window to show history of.
* \return NSERROR_OK or appropriate error code.
*/
nserror local_history_set(struct local_history_session *session, struct browser_window *bw);
+
/**
* get size of local history content area.
*
@@ -113,6 +121,7 @@ nserror local_history_set(struct local_history_session *session, struct browser_
*/
nserror local_history_get_size(struct local_history_session *session, int *width, int *height);
+
/**
* get url of entry at position in local history content area.
*
@@ -121,10 +130,55 @@ nserror local_history_get_size(struct local_history_session *session, int *width
* \param[in] session The local history session context.
* \param[in] x The x coordinate to get url of.
* \param[in] y The y coordinate to get url of.
- * \param[out] url_out string representation of the url at the coordinates.
+ * \param[out] url_out referenced url.
* \return NSERROR_OK and url_out updated or NSERROR_NOT_FOUND if no url at
* location.
*/
-nserror local_history_get_url(struct local_history_session *session, int x, int y, const char **url_out);
+nserror local_history_get_url(struct local_history_session *session, int x, int y, struct nsurl **url_out);
+
+
+/* depricated local history viewing interfaces */
+
+/**
+ * Get the dimensions of a history.
+ *
+ * \param bw browser window with history object.
+ * \param width updated to width
+ * \param height updated to height
+ */
+void browser_window_history_size(struct browser_window *bw, int *width, int *height);
+
+/**
+ * Redraw part of a history area.
+ *
+ * \param bw browser window with history object.
+ * \param clip redraw area
+ * \param x start X co-ordinate on plot canvas
+ * \param y start Y co-ordinate on plot canvas
+ * \param ctx current redraw context
+ */
+bool browser_window_history_redraw_rectangle(struct browser_window *bw, struct rect *clip, int x, int y, const struct redraw_context *ctx);
+
+/**
+ * Handle a mouse click in a history.
+ *
+ * \param bw browser window containing history
+ * \param x click coordinate
+ * \param y click coordinate
+ * \param new_window open a new window instead of using bw
+ * \return true if action was taken, false if click was not on an entry
+ */
+bool browser_window_history_click(struct browser_window *bw, int x, int y, bool new_window);
+
+/**
+ * Determine the URL of the entry at a position.
+ *
+ * \param bw browser window containing history
+ * \param x x coordinate.
+ * \param y y coordinate.
+ * \return nsurl at position or NULL if no entry.
+ */
+struct nsurl *browser_window_history_position_url(struct browser_window *bw, int x, int y);
+
#endif
diff --git a/frontends/amiga/history_local.c b/frontends/amiga/history_local.c
index 8d1f4ac..84f6561 100755
--- a/frontends/amiga/history_local.c
+++ b/frontends/amiga/history_local.c
@@ -44,7 +44,8 @@
#include "utils/log.h"
#include "utils/utils.h"
#include "utils/messages.h"
-#include "desktop/browser_history.h"
+#include "utils/nsurl.h"
+#include "desktop/local_history.h"
#include "netsurf/browser_window.h"
#include "netsurf/plotters.h"
#include "netsurf/window.h"
@@ -252,7 +253,7 @@ static BOOL ami_history_event(void *w)
struct history_window *hw = (struct history_window *)w;
ULONG result = 0;
uint16 code;
- const char *url;
+ nsurl *url = NULL;
struct IBox *bbox;
ULONG xs, ys;
@@ -287,10 +288,24 @@ static BOOL ami_history_event(void *w)
ami_gui_free_space_box(bbox);
- RefreshSetGadgetAttrs((APTR)hw->objects[GID_BROWSER],
- hw->win, NULL,
- GA_HintInfo, url,
- TAG_DONE);
+ if (url == NULL) {
+ RefreshSetGadgetAttrs(
+ (APTR)hw->objects[GID_BROWSER],
+ hw->win,
+ NULL,
+ GA_HintInfo,
+ NULL,
+ TAG_DONE);
+ } else {
+ RefreshSetGadgetAttrs(
+ (APTR)hw->objects[GID_BROWSER],
+ hw->win,
+ NULL,
+ GA_HintInfo,
+ nsurl_access(url),
+ TAG_DONE);
+ nsurl_unref(url);
+ }
break;
case WMHI_NEWSIZE:
diff --git a/frontends/riscos/local_history.c b/frontends/riscos/local_history.c
index 1ad63e0..1ae98ff 100644
--- a/frontends/riscos/local_history.c
+++ b/frontends/riscos/local_history.c
@@ -28,6 +28,7 @@
#include "utils/nsoption.h"
#include "utils/messages.h"
#include "utils/log.h"
+#include "utils/nsurl.h"
#include "netsurf/window.h"
#include "netsurf/plotters.h"
#include "netsurf/keypress.h"
@@ -127,7 +128,7 @@ static nserror
ro_local_history_tooltip(struct ro_local_history_window *lhw, int x, int y)
{
int width;
- const char *url;
+ nsurl *url;
wimp_window_state state;
wimp_icon_state ic;
os_box box = {0, 0, 0, 0};
@@ -162,17 +163,19 @@ ro_local_history_tooltip(struct ro_local_history_window *lhw, int x, int y)
}
/* get width of string */
- error = xwimptextop_string_width(url,
- strlen(url) > 256 ? 256 : strlen(url),
+ error = xwimptextop_string_width(nsurl_access(url),
+ nsurl_length(url) > 256 ? 256 : nsurl_length(url),
&width);
if (error) {
LOG("xwimptextop_string_width: 0x%x: %s",
error->errnum, error->errmess);
ro_warn_user("WimpError", error->errmess);
+ nsurl_unref(url);
return NSERROR_NOMEM;
}
- ro_gui_set_icon_string(dialog_tooltip, 0, url, true);
+ ro_gui_set_icon_string(dialog_tooltip, 0, nsurl_access(url), true);
+ nsurl_unref(url);
/* resize icon appropriately */
ic.w = dialog_tooltip;
--
NetSurf Browser
5 years, 7 months