mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-23 14:59:47 +03:00
Fix bw->drag_type to be aware of remaining drag types.
svn path=/trunk/netsurf/; revision=12514
This commit is contained in:
parent
311080ff54
commit
23eea5de9f
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -1295,6 +1295,8 @@ void form_select_menu_scroll_callback(void *client_data,
|
||||
menu->height);
|
||||
break;
|
||||
case SCROLLBAR_MSG_SCROLL_START:
|
||||
browser_window_set_drag_type(menu->bw, DRAGGING_OTHER);
|
||||
|
||||
menu->scroll_capture = true;
|
||||
gui_window_box_scroll_start(menu->bw->window,
|
||||
scrollbar_data->x0, scrollbar_data->y0,
|
||||
|
@ -789,6 +789,8 @@ void html_overflow_scroll_callback(void *client_data,
|
||||
html_redraw_a_box(bw->current_content, box);
|
||||
break;
|
||||
case SCROLLBAR_MSG_SCROLL_START:
|
||||
browser_window_set_drag_type(bw, DRAGGING_OTHER);
|
||||
|
||||
bw->scrollbar = scrollbar_data->scrollbar;
|
||||
gui_window_box_scroll_start(bw->window,
|
||||
scrollbar_data->x0, scrollbar_data->y0,
|
||||
|
Loading…
Reference in New Issue
Block a user