summaryrefslogtreecommitdiff
path: root/content/handlers
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2019-11-17 10:13:56 +0000
committerVincent Sanders <vince@kyllikki.org>2019-11-17 10:13:56 +0000
commite34f9d3a387fba655a8dcc47d7659655dc4b5fb3 (patch)
tree10ee34bc55fabd9463cf464145f2d9d81f961f87 /content/handlers
parentae39b9f9551f39a07780453832fdf229fdea3552 (diff)
downloadnetsurf-e34f9d3a387fba655a8dcc47d7659655dc4b5fb3.tar.gz
netsurf-e34f9d3a387fba655a8dcc47d7659655dc4b5fb3.tar.bz2
move remaining mouse action drag handling into separate functions
Diffstat (limited to 'content/handlers')
-rw-r--r--content/handlers/html/interaction.c81
1 files changed, 60 insertions, 21 deletions
diff --git a/content/handlers/html/interaction.c b/content/handlers/html/interaction.c
index f238341f7..9e59aed3f 100644
--- a/content/handlers/html/interaction.c
+++ b/content/handlers/html/interaction.c
@@ -504,6 +504,62 @@ mouse_action_drag_scrollbar(html_content *html,
}
+/**
+ * handle mouse actions while dragging in a text area
+ */
+static nserror
+mouse_action_drag_textarea(html_content *html,
+ struct browser_window *bw,
+ browser_mouse_state mouse,
+ int x, int y)
+{
+ struct box *box;
+ int box_x = 0;
+ int box_y = 0;
+
+ box = html->drag_owner.textarea;
+
+ assert(box->gadget != NULL);
+ assert(box->gadget->type == GADGET_TEXTAREA ||
+ box->gadget->type == GADGET_PASSWORD ||
+ box->gadget->type == GADGET_TEXTBOX);
+
+ box_coords(box, &box_x, &box_y);
+ textarea_mouse_action(box->gadget->data.text.ta,
+ mouse,
+ x - box_x,
+ y - box_y);
+
+ /* TODO: Set appropriate statusbar message */
+ return NSERROR_OK;
+}
+
+
+/**
+ * handle mouse actions while dragging in a content
+ */
+static nserror
+mouse_action_drag_content(html_content *html,
+ struct browser_window *bw,
+ browser_mouse_state mouse,
+ int x, int y)
+{
+ struct box *box;
+ int box_x = 0;
+ int box_y = 0;
+
+ box = html->drag_owner.content;
+ assert(box->object != NULL);
+
+ box_coords(box, &box_x, &box_y);
+ content_mouse_track(box->object,
+ bw, mouse,
+ x - box_x,
+ y - box_y);
+ return NSERROR_OK;
+}
+
+
/* exported interface documented in html/interaction.h */
nserror html_mouse_track(struct content *c,
struct browser_window *bw,
@@ -572,30 +628,13 @@ html_mouse_action(struct content *c,
}
if (html->drag_type == HTML_DRAG_TEXTAREA_SELECTION ||
- html->drag_type == HTML_DRAG_TEXTAREA_SCROLLBAR) {
- box = html->drag_owner.textarea;
- assert(box->gadget != NULL);
- assert(box->gadget->type == GADGET_TEXTAREA ||
- box->gadget->type == GADGET_PASSWORD ||
- box->gadget->type == GADGET_TEXTBOX);
-
- box_coords(box, &box_x, &box_y);
- textarea_mouse_action(box->gadget->data.text.ta, mouse,
- x - box_x, y - box_y);
-
- /* TODO: Set appropriate statusbar message */
- return NSERROR_OK;
+ html->drag_type == HTML_DRAG_TEXTAREA_SCROLLBAR) {
+ return mouse_action_drag_textarea(html, bw, mouse, x, y);
}
if (html->drag_type == HTML_DRAG_CONTENT_SELECTION ||
- html->drag_type == HTML_DRAG_CONTENT_SCROLL) {
- box = html->drag_owner.content;
- assert(box->object != NULL);
-
- box_coords(box, &box_x, &box_y);
- content_mouse_track(box->object, bw, mouse,
- x - box_x, y - box_y);
- return NSERROR_OK;
+ html->drag_type == HTML_DRAG_CONTENT_SCROLL) {
+ return mouse_action_drag_content(html, bw, mouse, x, y);
}
/* Content related drags handled by now */