From 185d0343236afbd1d900339b45c02985bd2d4ecb Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Tue, 12 Nov 2019 22:48:00 +0000 Subject: make mouse track and mouse action content handlers return an error code --- content/content_protected.h | 4 ++-- content/handlers/html/interaction.c | 9 +++++---- content/handlers/text/textplain.c | 8 ++++++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/content/content_protected.h b/content/content_protected.h index f0a95b64d..ec62a2183 100644 --- a/content/content_protected.h +++ b/content/content_protected.h @@ -52,9 +52,9 @@ struct content_handler { void (*reformat)(struct content *c, int width, int height); void (*destroy)(struct content *c); void (*stop)(struct content *c); - void (*mouse_track)(struct content *c, struct browser_window *bw, + nserror (*mouse_track)(struct content *c, struct browser_window *bw, browser_mouse_state mouse, int x, int y); - void (*mouse_action)(struct content *c, struct browser_window *bw, + nserror (*mouse_action)(struct content *c, struct browser_window *bw, browser_mouse_state mouse, int x, int y); bool (*keypress)(struct content *c, uint32_t key); bool (*redraw)(struct content *c, struct content_redraw_data *data, diff --git a/content/handlers/html/interaction.c b/content/handlers/html/interaction.c index 37951b666..930c79593 100644 --- a/content/handlers/html/interaction.c +++ b/content/handlers/html/interaction.c @@ -585,7 +585,7 @@ html_mouse_action(struct content *c, x - box_x, y - box_y); /* TODO: Set appropriate statusbar message */ - return; + return NSERROR_OK; } if (html->drag_type == HTML_DRAG_CONTENT_SELECTION || @@ -596,7 +596,7 @@ html_mouse_action(struct content *c, box_coords(box, &box_x, &box_y); content_mouse_track(box->object, bw, mouse, x - box_x, y - box_y); - return; + return NSERROR_OK; } /* Content related drags handled by now */ @@ -809,7 +809,7 @@ html_mouse_action(struct content *c, /** \todo Find a way to not ignore errors */ coords = calloc(1, sizeof(*coords)); if (coords == NULL) { - return; + return NSERROR_OK; } coords->x = x - gadget_box_x; coords->y = y - gadget_box_y; @@ -818,7 +818,7 @@ html_mouse_action(struct content *c, corestring_dom___ns_key_image_coords_node_data, coords, html__image_coords_dom_user_data_handler, &oldcoords) != DOM_NO_ERR) - return; + return NSERROR_OK; free(oldcoords); } /* Fall through */ @@ -1165,6 +1165,7 @@ html_mouse_action(struct content *c, NSLOG(netsurf, ERROR, "%s", messages_get_errorcode(res)); } + return res; } diff --git a/content/handlers/text/textplain.c b/content/handlers/text/textplain.c index e5cd45143..86122ff73 100644 --- a/content/handlers/text/textplain.c +++ b/content/handlers/text/textplain.c @@ -611,7 +611,7 @@ static content_type textplain_content_type(void) * \param x coordinate of mouse * \param y coordinate of mouse */ -static void +static nserror textplain_mouse_action(struct content *c, struct browser_window *bw, browser_mouse_state mouse, @@ -647,6 +647,8 @@ textplain_mouse_action(struct content *c, msg_data.pointer = pointer; content_broadcast(c, CONTENT_MSG_POINTER, &msg_data); + + return NSERROR_OK; } @@ -659,7 +661,7 @@ textplain_mouse_action(struct content *c, * \param x coordinate of mouse * \param y coordinate of mouse */ -static void +static nserror textplain_mouse_track(struct content *c, struct browser_window *bw, browser_mouse_state mouse, @@ -697,6 +699,8 @@ textplain_mouse_track(struct content *c, textplain_mouse_action(c, bw, mouse, x, y); break; } + + return NSERROR_OK; } -- cgit v1.2.3