diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2011-06-27 17:29:49 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2011-06-27 17:29:49 +0000 |
commit | 23eea5de9fc46283123248bc3c1306266297205c (patch) | |
tree | 5d7a8686ac0fb1618383fa15b69e8aa372d691ce /desktop | |
parent | 311080ff54268aeccc19277dead9f276e27e1f43 (diff) | |
download | netsurf-23eea5de9fc46283123248bc3c1306266297205c.tar.gz netsurf-23eea5de9fc46283123248bc3c1306266297205c.tar.bz2 |
Fix bw->drag_type to be aware of remaining drag types.
svn path=/trunk/netsurf/; revision=12514
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/browser.c | 37 | ||||
-rw-r--r-- | desktop/browser.h | 28 |
2 files changed, 44 insertions, 21 deletions
diff --git a/desktop/browser.c b/desktop/browser.c index df6ce480b..babd5d49c 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -224,6 +224,13 @@ void browser_window_set_position(struct browser_window *bw, int x, int y) } } +/* exported interface, documented in browser.h */ +void browser_window_set_drag_type(struct browser_window *bw, + browser_drag_type type) +{ + bw->drag_type = type; +} + /** * Create and open a new root browser window with the given page. * @@ -1770,20 +1777,9 @@ void browser_window_mouse_click(struct browser_window *bw, void browser_window_mouse_drag_end(struct browser_window *bw, browser_mouse_state mouse, int x, int y) { - - if (bw->visible_select_menu != NULL) { - form_select_mouse_drag_end(bw->visible_select_menu, mouse, - x, y); - return; - } - - if (bw->scrollbar != NULL) { - html_overflow_scroll_drag_end(bw->scrollbar, mouse, x, y); - return; - } - switch (bw->drag_type) { - case DRAGGING_SELECTION: { + case DRAGGING_SELECTION: + { hlcache_handle *h = bw->current_content; if (h) { int dir = -1; @@ -1807,7 +1803,20 @@ void browser_window_mouse_drag_end(struct browser_window *bw, } selection_drag_end(bw->sel); } - break; + break; + + case DRAGGING_OTHER: + + if (bw->visible_select_menu != NULL) { + form_select_mouse_drag_end(bw->visible_select_menu, + mouse, x, y); + } + + if (bw->scrollbar != NULL) { + html_overflow_scroll_drag_end(bw->scrollbar, + mouse, x, y); + } + break; default: break; diff --git a/desktop/browser.h b/desktop/browser.h index 830b22b0a..cdf071645 100644 --- a/desktop/browser.h +++ b/desktop/browser.h @@ -55,6 +55,15 @@ typedef void (*browser_move_callback)(struct browser_window *bw, void *p); +typedef enum { + DRAGGING_NONE, + DRAGGING_SELECTION, + DRAGGING_PAGE_SCROLL, + DRAGGING_FRAME, + DRAGGING_OTHER +} browser_drag_type; + + /** Browser window data. */ struct browser_window { @@ -91,12 +100,7 @@ struct browser_window { char *frag_id; /** Current drag status. */ - enum { - DRAGGING_NONE, - DRAGGING_SELECTION, - DRAGGING_PAGE_SCROLL, - DRAGGING_FRAME - } drag_type; + browser_drag_type drag_type; /** Mouse position at start of current scroll drag. */ int drag_start_x; @@ -323,12 +327,22 @@ void browser_window_get_position(struct browser_window *bw, bool root, * Set the position of the current browser window with respect to the parent * browser window * - * \param bw browser window to get the position of + * \param bw browser window to set the position of * \param x x position of bw * \param y y position of bw */ void browser_window_set_position(struct browser_window *bw, int x, int y); +/* + * Set the position of the current browser window with respect to the parent + * browser window + * + * \param bw browser window to set the type of the current drag for + * \param type drag type + */ +void browser_window_set_drag_type(struct browser_window *bw, + browser_drag_type type); + /* In platform specific hotlist.c. */ void hotlist_visited(struct hlcache_handle *c); |