summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2017-04-26 09:43:18 +0100
committerVincent Sanders <vince@kyllikki.org>2017-04-26 09:43:18 +0100
commitbd932d958b022c5fe02c76e976d3871d8651843b (patch)
tree4022b23875df5be7ad0eaa144325ed96aad1eb4e /include
parent31d98a1d2e5081ef2ca2d941f7e3b92344185399 (diff)
downloadnetsurf-bd932d958b022c5fe02c76e976d3871d8651843b.tar.gz
netsurf-bd932d958b022c5fe02c76e976d3871d8651843b.tar.bz2
remove reformat from browser window operation table
the reformat callback was completely unecessary and implementations appeared potentialy buggy. This rationalises the API and reduces the number of operations a frontend must provide.
Diffstat (limited to 'include')
-rw-r--r--include/netsurf/browser_window.h33
-rw-r--r--include/netsurf/window.h45
2 files changed, 47 insertions, 31 deletions
diff --git a/include/netsurf/browser_window.h b/include/netsurf/browser_window.h
index 858d4aeac..c56cf5571 100644
--- a/include/netsurf/browser_window.h
+++ b/include/netsurf/browser_window.h
@@ -296,16 +296,23 @@ void browser_window_reload(struct browser_window *bw, bool all);
*/
void browser_window_destroy(struct browser_window *bw);
+
/**
* Reformat a browser window contents to a new width or height.
*
+ * This API is not safe to call from all contexts and care must be used.
+ *
+ * \warning This API is generally only useful within the browser core
+ * and is only exposed for historical reasons. A frontend almost
+ * certianly actually wants browser_window_schedule_reformat() and not
+ * this.
+ *
* \param bw The browser window to reformat.
* \param background Reformat in the background.
* \param width new width
* \param height new height
*/
-void browser_window_reformat(struct browser_window *bw, bool background,
- int width, int height);
+void browser_window_reformat(struct browser_window *bw, bool background, int width, int height);
/**
@@ -411,6 +418,7 @@ void browser_window_mouse_click(struct browser_window *bw,
void browser_window_mouse_track(struct browser_window *bw,
browser_mouse_state mouse, int x, int y);
+
/**
* Locate a browser window in the specified stack according.
*
@@ -423,21 +431,28 @@ struct browser_window *browser_window_find_target(
struct browser_window *bw, const char *target,
browser_mouse_state mouse);
+
/**
- * Cause the frontends reformat entry to be called in safe context.
+ * Reformat the browser window contents in a safe context.
*
- * The browser_window_reformat call cannot safely be called from some
- * contexts, this call allows for the reformat to happen from a safe
+ * The browser_window_reformat() call cannot safely be called from some
+ * contexts, This interface allows for the reformat to happen from a safe
* top level context.
*
- * The callback is frontend provided as the context information (size
- * etc.) about the windowing toolkit is only available to the
- * frontend.
+ * The reformat uses the window table get_dimensions() callback as the
+ * correct viewport dimensions are only available to the frontend.
+ *
+ * \param bw The browser window to reformat the content of.
+ * \return NSERROR_OK on success else appropriate error code.
*/
nserror browser_window_schedule_reformat(struct browser_window *bw);
-
+/**
+ * callback for select menu widget
+ *
+ * \todo This API needs investigating
+ */
void browser_select_menu_callback(void *client_data,
int x, int y, int width, int height);
diff --git a/include/netsurf/window.h b/include/netsurf/window.h
index 434a79584..b9a68639c 100644
--- a/include/netsurf/window.h
+++ b/include/netsurf/window.h
@@ -23,8 +23,8 @@
* operations.
*/
-#ifndef _NETSURF_WINDOW_H_
-#define _NETSURF_WINDOW_H_
+#ifndef NETSURF_WINDOW_H
+#define NETSURF_WINDOW_H
typedef enum gui_save_type {
GUI_SAVE_SOURCE,
@@ -50,10 +50,13 @@ typedef enum {
GDRAGGING_OTHER
} gui_drag_type;
+/**
+ * Window creation control flags.
+ */
typedef enum {
- GW_CREATE_NONE = 0, /* New window */
- GW_CREATE_CLONE = (1 << 0), /* Clone existing window */
- GW_CREATE_TAB = (1 << 1) /* In same window as existing */
+ GW_CREATE_NONE = 0, /**< New window */
+ GW_CREATE_CLONE = (1 << 0), /**< Clone existing window */
+ GW_CREATE_TAB = (1 << 1) /**< In same window as existing */
} gui_window_create_flags;
struct browser_window;
@@ -90,6 +93,7 @@ struct gui_window_table {
struct gui_window *existing,
gui_window_create_flags flags);
+
/**
* Destroy previously created gui window
*
@@ -97,6 +101,7 @@ struct gui_window_table {
*/
void (*destroy)(struct gui_window *gw);
+
/**
* Invalidate an area of a window.
*
@@ -116,6 +121,7 @@ struct gui_window_table {
*/
nserror (*invalidate)(struct gui_window *g, const struct rect *rect);
+
/**
* Get the scroll position of a browser window.
*
@@ -126,6 +132,7 @@ struct gui_window_table {
*/
bool (*get_scroll)(struct gui_window *g, int *sx, int *sy);
+
/**
* Set the scroll position of a browser window.
*
@@ -135,18 +142,24 @@ struct gui_window_table {
*/
void (*set_scroll)(struct gui_window *g, int sx, int sy);
+
/**
* Find the current dimensions of a browser window's content area.
*
- * @todo The implementations of this are buggy and its only
- * used from frames code.
+ * This is used to determine the actual available drawing size
+ * in pixels. This is used to allow contents that can be
+ * dynamicaly reformatted, such as HTML, to better use the
+ * available space.
*
- * \param g gui_window to measure
- * \param width receives width of window
+ * \param gw The gui window to measure content area of.
+ * \param width receives width of window
* \param height receives height of window
* \param scaled whether to return scaled values
+ * \return NSERROR_OK on sucess and width and height updated
+ * else error code.
*/
- void (*get_dimensions)(struct gui_window *g, int *width, int *height, bool scaled);
+ nserror (*get_dimensions)(struct gui_window *gw, int *width, int *height, bool scaled);
+
/**
* Update the extent of the inside of a browser window to that of the
@@ -159,18 +172,6 @@ struct gui_window_table {
*/
void (*update_extent)(struct gui_window *g);
- /**
- * Reformat a window.
- *
- * This is used to perform reformats when the page contents
- * require reformatting. The reformat is requested using
- * browser_window_schedule_reformat and occurs via a scheduled
- * callback hence from top level context.
- *
- * \param g gui_window to reformat.
- */
- void (*reformat)(struct gui_window *g);
-
/* Optional entries */