diff options
author | Vincent Sanders <vince@kyllikki.org> | 2014-01-13 01:08:15 +0000 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2014-01-13 01:08:15 +0000 |
commit | 7227c29bbacbc796e9f549cf21e8bd978fde5114 (patch) | |
tree | ecd935b801f61ea1d69eea576fcaaf57e4bd909c | |
parent | 5a962586fb161651fc612ed8a8f6da99d8d22f65 (diff) | |
download | netsurf-7227c29bbacbc796e9f549cf21e8bd978fde5114.tar.gz netsurf-7227c29bbacbc796e9f549cf21e8bd978fde5114.tar.bz2 |
move window scroll getter and setter into operations table
-rw-r--r-- | amiga/gui.c | 9 | ||||
-rw-r--r-- | atari/ctxmenu.c | 1 | ||||
-rw-r--r-- | atari/gui.c | 5 | ||||
-rwxr-xr-x | atari/rootwin.c | 2 | ||||
-rw-r--r-- | beos/window.cpp | 6 | ||||
-rw-r--r-- | cocoa/gui.m | 6 | ||||
-rw-r--r-- | desktop/browser.c | 4 | ||||
-rw-r--r-- | desktop/gui.h | 21 | ||||
-rw-r--r-- | desktop/gui_factory.c | 8 | ||||
-rw-r--r-- | framebuffer/gui.c | 6 | ||||
-rw-r--r-- | gtk/window.c | 31 | ||||
-rw-r--r-- | monkey/browser.c | 6 | ||||
-rw-r--r-- | riscos/window.c | 6 | ||||
-rw-r--r-- | windows/drawable.c | 2 | ||||
-rw-r--r-- | windows/gui.c | 7 |
15 files changed, 87 insertions, 33 deletions
diff --git a/amiga/gui.c b/amiga/gui.c index 9ed3559f2..7c3a72afe 100644 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -200,6 +200,9 @@ static void ami_gui_window_update_box_deferred(struct gui_window *g, bool draw); static void ami_do_redraw(struct gui_window_2 *g); static void ami_schedule_redraw_remove(struct gui_window_2 *gwin); +static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy); +static void gui_window_set_scroll(struct gui_window *g, int sx, int sy); + /* accessors for default options - user option is updated if it is set as per default */ #define nsoption_default_set_int(OPTION, VALUE) \ if (nsoptions_default[NSOPTION_##OPTION].value.i == nsoptions[NSOPTION_##OPTION].value.i) \ @@ -4480,13 +4483,13 @@ void ami_get_vscroll_pos(struct gui_window_2 *gwin, ULONG *ys) *ys /= gwin->bw->scale; } -bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy) +static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy) { ami_get_hscroll_pos(g->shared, (ULONG *)sx); ami_get_vscroll_pos(g->shared, (ULONG *)sy); } -void gui_window_set_scroll(struct gui_window *g, int sx, int sy) +static void gui_window_set_scroll(struct gui_window *g, int sx, int sy) { struct IBox *bbox; ULONG cur_tab = 0; @@ -5087,6 +5090,8 @@ static struct gui_window_table ami_window_table = { .destroy = gui_window_destroy, .redraw = gui_window_redraw_window, .update = gui_window_update_box, + .get_scroll = gui_window_get_scroll, + .set_scroll = gui_window_set_scroll, .set_icon = gui_window_set_icon, .set_title = gui_window_set_title, diff --git a/atari/ctxmenu.c b/atari/ctxmenu.c index fb687b809..ae918c6a5 100644 --- a/atari/ctxmenu.c +++ b/atari/ctxmenu.c @@ -58,6 +58,7 @@ #define CNT_INTERACTIVE 512
#define CNT_IMG 1024
+bool gui_window_get_scroll(struct gui_window *w, int *sx, int *sy); struct s_context_info {
unsigned long flags;
diff --git a/atari/gui.c b/atari/gui.c index cfb6b86d6..cb1b123bd 100644 --- a/atari/gui.c +++ b/atari/gui.c @@ -113,6 +113,7 @@ EVMULT_IN aes_event_in = { EVMULT_OUT aes_event_out; short aes_msg_out[8]; +bool gui_window_get_scroll(struct gui_window *w, int *sx, int *sy); static void gui_poll(bool active) @@ -404,7 +405,7 @@ bool gui_window_get_scroll(struct gui_window *w, int *sx, int *sy) return( true ); } -void gui_window_set_scroll(struct gui_window *w, int sx, int sy) +static void gui_window_set_scroll(struct gui_window *w, int sx, int sy) { int units = 0; if ((w == NULL) @@ -1072,6 +1073,8 @@ static struct gui_window_table atari_window_table = { .destroy = gui_window_destroy, .redraw = gui_window_redraw_window, .update = gui_window_update_box, + .get_scroll = gui_window_get_scroll, + .set_scroll = gui_window_set_scroll, .set_title = gui_window_set_title, .set_url = gui_window_set_url, diff --git a/atari/rootwin.c b/atari/rootwin.c index 3c89e6d55..0f3413c3d 100755 --- a/atari/rootwin.c +++ b/atari/rootwin.c @@ -85,6 +85,8 @@ static bool on_content_mouse_click(ROOTWIN *rootwin); static bool on_content_mouse_move(ROOTWIN *rootwin, GRECT *content_area); static void toolbar_redraw_cb(GUIWIN *win, uint16_t msg, GRECT *clip); +bool gui_window_get_scroll(struct gui_window *w, int *sx, int *sy); + static bool redraw_active = false; static const struct redraw_context rootwin_rdrw_ctx = { diff --git a/beos/window.cpp b/beos/window.cpp index beee9642e..5fd177bb7 100644 --- a/beos/window.cpp +++ b/beos/window.cpp @@ -1051,7 +1051,7 @@ static void gui_window_update_box(struct gui_window *g, const struct rect *rect) g->view->UnlockLooper(); } -bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy) +static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy) { //CALLED(); if (g->view == NULL) @@ -1069,7 +1069,7 @@ bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy) return true; } -void gui_window_set_scroll(struct gui_window *g, int sx, int sy) +static void gui_window_set_scroll(struct gui_window *g, int sx, int sy) { //CALLED(); if (g->view == NULL) @@ -1367,6 +1367,8 @@ static struct gui_window_table gui_window_table = { .destroy = gui_window_destroy, .redraw = gui_window_redraw_window, .update = gui_window_update_box, + .get_scroll = gui_window_get_scroll, + .set_scroll = gui_window_set_scroll, .new_content = gui_window_new_content, diff --git a/cocoa/gui.m b/cocoa/gui.m index 5909fcddc..d193fa9c9 100644 --- a/cocoa/gui.m +++ b/cocoa/gui.m @@ -120,7 +120,7 @@ static void gui_window_update_box(struct gui_window *g, const struct rect *rect) [[(BrowserViewController *)g browserView] setNeedsDisplayInRect: nsrect]; } -bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy) +static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy) { NSCParameterAssert( g != NULL && sx != NULL && sy != NULL ); @@ -130,7 +130,7 @@ bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy) return true; } -void gui_window_set_scroll(struct gui_window *g, int sx, int sy) +static void gui_window_set_scroll(struct gui_window *g, int sx, int sy) { [[(BrowserViewController *)g browserView] scrollPoint: cocoa_point( sx, sy )]; } @@ -301,6 +301,8 @@ static struct gui_window_table cocoa_window_table = { .destroy = gui_window_destroy, .redraw = gui_window_redraw_window, .update = gui_window_update_box, + .get_scroll = gui_window_get_scroll, + .set_scroll = gui_window_set_scroll, .set_title = gui_window_set_title, .set_url = gui_window_set_url, diff --git a/desktop/browser.c b/desktop/browser.c index 6d260a538..3a286eecf 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -499,7 +499,7 @@ void browser_window_scroll_visible(struct browser_window *bw, void browser_window_set_scroll(struct browser_window *bw, int x, int y) { if (bw->window != NULL) { - gui_window_set_scroll(bw->window, x, y); + guit->window->set_scroll(bw->window, x, y); } else { if (bw->scroll_x != NULL) scrollbar_set(bw->scroll_x, x, false); @@ -2946,7 +2946,7 @@ void browser_window_page_drag_start(struct browser_window *bw, int x, int y) if (bw->window != NULL) { /* Front end window */ - gui_window_get_scroll(bw->window, &bw->drag_start_scroll_x, + guit->window->get_scroll(bw->window, &bw->drag_start_scroll_x, &bw->drag_start_scroll_y); guit->window->scroll_start(bw->window); diff --git a/desktop/gui.h b/desktop/gui.h index 0b7bdcca6..bf922737b 100644 --- a/desktop/gui.h +++ b/desktop/gui.h @@ -94,6 +94,25 @@ struct gui_window_table { */ void (*update)(struct gui_window *g, const struct rect *rect); + /** + * Get the scroll position of a browser window. + * + * \param g gui_window + * \param sx receives x ordinate of point at top-left of window + * \param sy receives y ordinate of point at top-left of window + * \return true iff successful + */ + bool (*get_scroll)(struct gui_window *g, int *sx, int *sy); + + /** + * Set the scroll position of a browser window. + * + * \param g gui_window to scroll + * \param sx point to place at top-left of window + * \param sy point to place at top-left of window + */ + void (*set_scroll)(struct gui_window *g, int sx, int sy); + /* Optional entries */ @@ -179,8 +198,6 @@ struct gui_table { extern struct gui_table *guit; /* the gui vtable */ -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_get_dimensions(struct gui_window *g, int *width, int *height, bool scaled); void gui_window_update_extent(struct gui_window *g); diff --git a/desktop/gui_factory.c b/desktop/gui_factory.c index 9cf328557..a4cc1c9a9 100644 --- a/desktop/gui_factory.c +++ b/desktop/gui_factory.c @@ -52,7 +52,7 @@ 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); + guit->window->set_scroll(g, x0, y0); } static void gui_default_window_new_content(struct gui_window *g) @@ -86,6 +86,12 @@ static nserror verify_window_register(struct gui_window_table *gwt) if (gwt->update == NULL) { return NSERROR_BAD_PARAMETER; } + if (gwt->get_scroll == NULL) { + return NSERROR_BAD_PARAMETER; + } + if (gwt->set_scroll == NULL) { + return NSERROR_BAD_PARAMETER; + } /* fill in the optional entries with defaults */ if (gwt->set_title == NULL) { diff --git a/framebuffer/gui.c b/framebuffer/gui.c index aefc24bdb..13d0421d1 100644 --- a/framebuffer/gui.c +++ b/framebuffer/gui.c @@ -1552,7 +1552,7 @@ gui_window_update_box(struct gui_window *g, const struct rect *rect) rect->y1 - bwidget->scrolly); } -bool +static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy) { struct browser_widget_s *bwidget = fbtk_get_userpw(g->browser); @@ -1563,7 +1563,7 @@ gui_window_get_scroll(struct gui_window *g, int *sx, int *sy) return true; } -void +static void gui_window_set_scroll(struct gui_window *gw, int sx, int sy) { struct browser_widget_s *bwidget = fbtk_get_userpw(gw->browser); @@ -1846,6 +1846,8 @@ static struct gui_window_table framebuffer_gui_window_table = { .destroy = gui_window_destroy, .redraw = gui_window_redraw_window, .update = gui_window_update_box, + .get_scroll = gui_window_get_scroll, + .set_scroll = gui_window_set_scroll, .set_url = gui_window_set_url, .start_throbber = gui_window_start_throbber, diff --git a/gtk/window.c b/gtk/window.c index 0ea67edb9..e6da490e6 100644 --- a/gtk/window.c +++ b/gtk/window.c @@ -888,6 +888,20 @@ static void gui_window_set_icon(struct gui_window *gw, hlcache_handle *icon) nsgtk_scaffolding_set_icon(gw); } +static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy) +{ + GtkAdjustment *vadj = nsgtk_layout_get_vadjustment(g->layout); + GtkAdjustment *hadj = nsgtk_layout_get_hadjustment(g->layout); + + assert(vadj); + assert(hadj); + + *sy = (int)(gtk_adjustment_get_value(vadj)); + *sx = (int)(gtk_adjustment_get_value(hadj)); + + return true; +} + static void nsgtk_redraw_caret(struct gui_window *g) { int sx, sy; @@ -948,21 +962,8 @@ void gui_window_set_status(struct gui_window *g, const char *text) gtk_label_set_text(g->status_bar, text); } -bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy) -{ - GtkAdjustment *vadj = nsgtk_layout_get_vadjustment(g->layout); - GtkAdjustment *hadj = nsgtk_layout_get_hadjustment(g->layout); - - assert(vadj); - assert(hadj); - - *sy = (int)(gtk_adjustment_get_value(vadj)); - *sx = (int)(gtk_adjustment_get_value(hadj)); - - return true; -} -void gui_window_set_scroll(struct gui_window *g, int sx, int sy) +static void gui_window_set_scroll(struct gui_window *g, int sx, int sy) { GtkAdjustment *vadj = nsgtk_layout_get_vadjustment(g->layout); GtkAdjustment *hadj = nsgtk_layout_get_hadjustment(g->layout); @@ -1176,6 +1177,8 @@ static struct gui_window_table gui_window_table = { .destroy = gui_window_destroy, .redraw = gui_window_redraw_window, .update = gui_window_update_box, + .get_scroll = gui_window_get_scroll, + .set_scroll = gui_window_set_scroll, .set_icon = gui_window_set_icon, diff --git a/monkey/browser.c b/monkey/browser.c index 33f302089..706034cf2 100644 --- a/monkey/browser.c +++ b/monkey/browser.c @@ -166,7 +166,7 @@ gui_window_stop_throbber(struct gui_window *g) fprintf(stdout, "WINDOW STOP_THROBBER WIN %u\n", g->win_num); } -void +static void gui_window_set_scroll(struct gui_window *g, int sx, int sy) { g->scrollx = sx; @@ -283,7 +283,7 @@ gui_drag_save_object(gui_save_type type, hlcache_handle *c, /* Ignore? */ } -bool +static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy) { fprintf(stdout, "WINDOW GET_SCROLL WIN %u X %d Y %d\n", @@ -568,6 +568,8 @@ static struct gui_window_table gui_window_table = { .destroy = gui_window_destroy, .redraw = gui_window_redraw_window, .update = gui_window_update_box, + .get_scroll = gui_window_get_scroll, + .set_scroll = gui_window_set_scroll, .set_title = gui_window_set_title, .set_url = gui_window_set_url, diff --git a/riscos/window.c b/riscos/window.c index 3975773a0..f722ab187 100644 --- a/riscos/window.c +++ b/riscos/window.c @@ -766,7 +766,7 @@ static void gui_window_update_box(struct gui_window *g, const struct rect *rect) * \return true iff successful */ -bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy) +static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy) { wimp_window_state state; os_error *error; @@ -799,7 +799,7 @@ bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy) * \param sy point to place at top-left of window */ -void gui_window_set_scroll(struct gui_window *g, int sx, int sy) +static void gui_window_set_scroll(struct gui_window *g, int sx, int sy) { wimp_window_state state; os_error *error; @@ -5245,6 +5245,8 @@ static struct gui_window_table gui_window_table = { .destroy = gui_window_destroy, .redraw = gui_window_redraw_window, .update = gui_window_update_box, + .get_scroll = gui_window_get_scroll, + .set_scroll = gui_window_set_scroll, .set_icon = gui_window_set_icon, .set_title = gui_window_set_title, diff --git a/windows/drawable.c b/windows/drawable.c index 8e35d306c..34b8958dc 100644 --- a/windows/drawable.c +++ b/windows/drawable.c @@ -37,6 +37,8 @@ static const char windowclassname_drawable[] = "nswsdrawablewindow"; +void gui_window_set_scroll(struct gui_window *w, int sx, int sy); + /** * Handle wheel scroll messages. */ diff --git a/windows/gui.c b/windows/gui.c index e40414eac..de6634ab7 100644 --- a/windows/gui.c +++ b/windows/gui.c @@ -73,6 +73,9 @@ static const char windowclassname_main[] = "nswsmainwindow"; static struct nsws_pointers nsws_pointer; +void gui_window_set_scroll(struct gui_window *w, int sx, int sy); +static bool gui_window_get_scroll(struct gui_window *w, int *sx, int *sy); + void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl, struct form_control *gadget) { @@ -1469,7 +1472,7 @@ static void gui_window_update_box(struct gui_window *gw, const struct rect *rect } -bool gui_window_get_scroll(struct gui_window *w, int *sx, int *sy) +static bool gui_window_get_scroll(struct gui_window *w, int *sx, int *sy) { LOG(("get scroll")); if (w == NULL) @@ -1849,6 +1852,8 @@ static struct gui_window_table win32_window_table = { .destroy = gui_window_destroy, .redraw = gui_window_redraw_window, .update = gui_window_update_box, + .get_scroll = gui_window_get_scroll, + .set_scroll = gui_window_set_scroll, .set_title = gui_window_set_title, .set_url = gui_window_set_url, |