summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2014-01-12 22:55:26 +0000
committerVincent Sanders <vince@kyllikki.org>2014-01-12 22:55:26 +0000
commit4b49b4ac775a1e3ca0c59f390f3f2427e31bce2b (patch)
tree311a26dd1e0d387172cfd28d83a6e92b6d2538f4 /desktop
parentb7736bae2f37675be55b1c89d33b03e8603b2946 (diff)
downloadnetsurf-4b49b4ac775a1e3ca0c59f390f3f2427e31bce2b.tar.gz
netsurf-4b49b4ac775a1e3ca0c59f390f3f2427e31bce2b.tar.bz2
move more optional window operations into table including removing unused hide_pointer operation altogether
Diffstat (limited to 'desktop')
-rw-r--r--desktop/browser.c6
-rw-r--r--desktop/gui.h31
-rw-r--r--desktop/gui_factory.c48
3 files changed, 65 insertions, 20 deletions
diff --git a/desktop/browser.c b/desktop/browser.c
index bef6eb109..7c29468c3 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -484,7 +484,7 @@ void browser_window_scroll_visible(struct browser_window *bw,
if (bw->window != NULL) {
/* Front end window */
- gui_window_scroll_visible(bw->window,
+ guit->window->scroll_visible(bw->window,
rect->x0, rect->y0, rect->x1, rect->y1);
} else {
/* Core managed browser window */
@@ -1233,7 +1233,7 @@ static nserror browser_window_callback(hlcache_handle *c,
browser_window_remove_caret(bw, false);
if (bw->window != NULL) {
- gui_window_new_content(bw->window);
+ guit->window->new_content(bw->window);
browser_window_refresh_url_bar(bw,
hlcache_handle_get_url(bw->current_content),
@@ -2949,7 +2949,7 @@ void browser_window_page_drag_start(struct browser_window *bw, int x, int y)
gui_window_get_scroll(bw->window, &bw->drag_start_scroll_x,
&bw->drag_start_scroll_y);
- gui_window_scroll_start(bw->window);
+ guit->window->scroll_start(bw->window);
} else {
/* Core managed browser window */
bw->drag_start_scroll_x = scrollbar_get_offset(bw->scroll_x);
diff --git a/desktop/gui.h b/desktop/gui.h
index 96062ddae..1ab871f33 100644
--- a/desktop/gui.h
+++ b/desktop/gui.h
@@ -102,6 +102,32 @@ struct gui_window_table {
/** set favicon */
void (*set_icon)(struct gui_window *g, hlcache_handle *icon);
+
+ /**
+ * Scrolls the specified area of a browser window into view.
+ *
+ * \param g gui_window to scroll
+ * \param x0 left point to ensure visible
+ * \param y0 bottom point to ensure visible
+ * \param x1 right point to ensure visible
+ * \param y1 top point to ensure visible
+ */
+ void (*scroll_visible)(struct gui_window *g, int x0, int y0, int x1, int y1);
+
+ /**
+ * Starts drag scrolling of a browser window
+ *
+ * \param g the window to scroll
+ */
+ bool (*scroll_start)(struct gui_window *g);
+
+ /**
+ * Called when the gui_window has new content.
+ *
+ * \param g the gui_window that has new content
+ */
+ void (*new_content)(struct gui_window *g);
+
};
/** Graphical user interface function table
@@ -143,19 +169,14 @@ void gui_window_update_box(struct gui_window *g,
const struct rect *rect);
bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy);
void gui_window_set_scroll(struct gui_window *g, int sx, int sy);
-void gui_window_scroll_visible(struct gui_window *g, int x0, int y0,
- int x1, int y1);
void gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
bool scaled);
void gui_window_update_extent(struct gui_window *g);
void gui_window_set_status(struct gui_window *g, const char *text);
void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape);
-void gui_window_hide_pointer(struct gui_window *g);
void gui_window_place_caret(struct gui_window *g, int x, int y, int height,
const struct rect *clip);
void gui_window_remove_caret(struct gui_window *g);
-void gui_window_new_content(struct gui_window *g);
-bool gui_window_scroll_start(struct gui_window *g);
struct gui_download_window *gui_download_window_create(download_context *ctx,
diff --git a/desktop/gui_factory.c b/desktop/gui_factory.c
index 3ced1901f..73fb016e4 100644
--- a/desktop/gui_factory.c
+++ b/desktop/gui_factory.c
@@ -9,6 +9,11 @@ static void gui_default_quit(void)
{
}
+static void gui_default_set_search_ico(hlcache_handle *ico)
+{
+}
+
+
static void gui_default_window_set_title(struct gui_window *g, const char *title)
{
}
@@ -25,31 +30,41 @@ static void gui_default_window_stop_throbber(struct gui_window *g)
{
}
-static bool
-gui_default_window_drag_start(struct gui_window *g,
- gui_drag_type type,
- const struct rect *rect)
+static bool gui_default_window_drag_start(struct gui_window *g,
+ gui_drag_type type,
+ const struct rect *rect)
{
return true;
}
-static void
-gui_default_window_save_link(struct gui_window *g,
- const char *url,
- const char *title)
+static void gui_default_window_save_link(struct gui_window *g,
+ const char *url,
+ const char *title)
{
}
-static void
-gui_default_window_set_icon(struct gui_window *g, hlcache_handle *icon)
+static void gui_default_window_set_icon(struct gui_window *g,
+ hlcache_handle *icon)
{
}
-static void
-gui_default_set_search_ico(hlcache_handle *ico)
+static void gui_default_window_scroll_visible(struct gui_window *g,
+ int x0, int y0,
+ int x1, int y1)
{
+ gui_window_set_scroll(g, x0, y0);
}
+static void gui_default_window_new_content(struct gui_window *g)
+{
+}
+
+static bool gui_default_window_scroll_start(struct gui_window *g)
+{
+ return true;
+}
+
+
/** verify window table is valid */
static nserror verify_window_register(struct gui_window_table *gwt)
{
@@ -88,6 +103,15 @@ static nserror verify_window_register(struct gui_window_table *gwt)
if (gwt->set_icon == NULL) {
gwt->set_icon = gui_default_window_set_icon;
}
+ if (gwt->scroll_visible == NULL) {
+ gwt->scroll_visible = gui_default_window_scroll_visible;
+ }
+ if (gwt->new_content == NULL) {
+ gwt->new_content = gui_default_window_new_content;
+ }
+ if (gwt->scroll_start == NULL) {
+ gwt->scroll_start = gui_default_window_scroll_start;
+ }
return NSERROR_OK;
}