From d70beb28db6f978ae9fc674640f3101e20c05bb8 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sat, 26 Aug 2017 15:50:03 +0100 Subject: Content API: Make content_broadcast take pointer to content_msg_data. --- render/html.c | 9 +++++---- render/html_interaction.c | 31 ++++++++++++++++--------------- render/html_object.c | 10 +++++----- render/html_script.c | 8 ++++---- render/search.c | 4 ++-- render/textplain.c | 8 ++++---- 6 files changed, 36 insertions(+), 34 deletions(-) (limited to 'render') diff --git a/render/html.c b/render/html.c index a573ef5f5..62dec9e95 100644 --- a/render/html.c +++ b/render/html.c @@ -443,7 +443,7 @@ static nserror html_meta_refresh_process_element(html_content *c, dom_node *n) c->base.refresh = nsurl_ref( content_get_url(&c->base)); - content_broadcast(&c->base, CONTENT_MSG_REFRESH, msg_data); + content_broadcast(&c->base, CONTENT_MSG_REFRESH, &msg_data); return NSERROR_OK; } @@ -522,7 +522,8 @@ static nserror html_meta_refresh_process_element(html_content *c, dom_node *n) c->base.refresh = nsurl; - content_broadcast(&c->base, CONTENT_MSG_REFRESH, msg_data); + content_broadcast(&c->base, CONTENT_MSG_REFRESH, + &msg_data); c->refresh = true; } @@ -603,7 +604,7 @@ void html_finish_conversion(html_content *htmlc) LOG("DOM to box (%p)", htmlc); content_set_status(&htmlc->base, messages_get("Processing")); msg_data.explicit_status_text = NULL; - content_broadcast(&htmlc->base, CONTENT_MSG_STATUS, msg_data); + content_broadcast(&htmlc->base, CONTENT_MSG_STATUS, &msg_data); exc = dom_document_get_document_element(htmlc->document, (void *) &html); if ((exc != DOM_NO_ERR) || (html == NULL)) { @@ -685,7 +686,7 @@ dom_default_action_DOMNodeInserted_cb(struct dom_event *evt, void *pw) msg_data.jscontext = &htmlc->jscontext; content_broadcast(&htmlc->base, CONTENT_MSG_GETCTX, - msg_data); + &msg_data); LOG("javascript context: %p (htmlc: %p)", htmlc->jscontext, htmlc); diff --git a/render/html_interaction.c b/render/html_interaction.c index e727a9ffc..1ae9801c6 100644 --- a/render/html_interaction.c +++ b/render/html_interaction.c @@ -368,7 +368,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw, mouse, x - box_x, y - box_y); if (status != NULL) { msg_data.explicit_status_text = status; - content_broadcast(c, CONTENT_MSG_STATUS, msg_data); + content_broadcast(c, CONTENT_MSG_STATUS, &msg_data); } else { int width, height; form_select_get_dimensions(html->visible_select_menu, @@ -459,7 +459,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw, } msg_data.explicit_status_text = status; - content_broadcast(c, CONTENT_MSG_STATUS, msg_data); + content_broadcast(c, CONTENT_MSG_STATUS, &msg_data); return; } @@ -678,7 +678,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw, } else if (mouse & BROWSER_MOUSE_CLICK_1) { msg_data.select_menu.gadget = gadget; content_broadcast(c, CONTENT_MSG_SELECTMENU, - msg_data); + &msg_data); } break; case GADGET_CHECKBOX: @@ -768,7 +768,8 @@ void html_mouse_action(struct content *c, struct browser_window *bw, status = messages_get("FormFile"); if (mouse & BROWSER_MOUSE_CLICK_1) { msg_data.gadget_click.gadget = gadget; - content_broadcast(c, CONTENT_MSG_GADGETCLICK, msg_data); + content_broadcast(c, CONTENT_MSG_GADGETCLICK, + &msg_data); } break; case GADGET_BUTTON: @@ -782,12 +783,12 @@ void html_mouse_action(struct content *c, struct browser_window *bw, if (mouse & BROWSER_MOUSE_DRAG_2) { msg_data.dragsave.type = CONTENT_SAVE_NATIVE; msg_data.dragsave.content = object; - content_broadcast(c, CONTENT_MSG_DRAGSAVE, msg_data); + content_broadcast(c, CONTENT_MSG_DRAGSAVE, &msg_data); } else if (mouse & BROWSER_MOUSE_DRAG_1) { msg_data.dragsave.type = CONTENT_SAVE_ORIG; msg_data.dragsave.content = object; - content_broadcast(c, CONTENT_MSG_DRAGSAVE, msg_data); + content_broadcast(c, CONTENT_MSG_DRAGSAVE, &msg_data); } /* \todo should have a drag-saving object msg */ @@ -869,7 +870,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw, mouse & BROWSER_MOUSE_MOD_1) { msg_data.savelink.url = url; msg_data.savelink.title = title; - content_broadcast(c, CONTENT_MSG_SAVELINK, msg_data); + content_broadcast(c, CONTENT_MSG_SAVELINK, &msg_data); } else if (mouse & (BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_CLICK_2)) @@ -968,7 +969,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw, msg_data.dragsave.content = NULL; content_broadcast(c, CONTENT_MSG_DRAGSAVE, - msg_data); + &msg_data); } else { if (drag_candidate == NULL) { browser_window_page_drag_start( @@ -988,7 +989,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw, msg_data.dragsave.content = NULL; content_broadcast(c, CONTENT_MSG_DRAGSAVE, - msg_data); + &msg_data); } else { if (drag_candidate == NULL) { browser_window_page_drag_start( @@ -1013,10 +1014,10 @@ void html_mouse_action(struct content *c, struct browser_window *bw, if (!iframe && !html_object_box) { msg_data.explicit_status_text = status; - content_broadcast(c, CONTENT_MSG_STATUS, msg_data); + content_broadcast(c, CONTENT_MSG_STATUS, &msg_data); msg_data.pointer = pointer; - content_broadcast(c, CONTENT_MSG_POINTER, msg_data); + content_broadcast(c, CONTENT_MSG_POINTER, &msg_data); } /* fire dom click event */ @@ -1217,7 +1218,7 @@ void html_overflow_scroll_callback(void *client_data, html_set_drag_type(html, drag_type, drag_owner, NULL); msg_data.pointer = BROWSER_POINTER_AUTO; - content_broadcast(data->c, CONTENT_MSG_POINTER, msg_data); + content_broadcast(data->c, CONTENT_MSG_POINTER, &msg_data); break; } } @@ -1292,7 +1293,7 @@ void html_set_drag_type(html_content *html, html_drag_type drag_type, msg_data.drag.rect = rect; /* Inform of the content's drag status change */ - content_broadcast((struct content *)html, CONTENT_MSG_DRAG, msg_data); + content_broadcast((struct content *)html, CONTENT_MSG_DRAG, &msg_data); } /* Documented in html_internal.h */ @@ -1350,7 +1351,7 @@ void html_set_focus(html_content *html, html_focus_type focus_type, } /* Inform of the content's drag status change */ - content_broadcast((struct content *)html, CONTENT_MSG_CARET, msg_data); + content_broadcast((struct content *)html, CONTENT_MSG_CARET, &msg_data); } /* Documented in html_internal.h */ @@ -1426,5 +1427,5 @@ void html_set_selection(html_content *html, html_selection_type selection_type, /* Inform of the content's selection status change */ content_broadcast((struct content *)html, CONTENT_MSG_SELECTION, - msg_data); + &msg_data); } diff --git a/render/html_object.c b/render/html_object.c index e20cd6d63..12780ca8b 100644 --- a/render/html_object.c +++ b/render/html_object.c @@ -177,7 +177,7 @@ html_object_callback(hlcache_handle *object, data.redraw.height = box->height; data.redraw.full_redraw = true; - content_broadcast(&c->base, CONTENT_MSG_REDRAW, data); + content_broadcast(&c->base, CONTENT_MSG_REDRAW, &data); } break; @@ -276,7 +276,7 @@ html_object_callback(hlcache_handle *object, data.redraw.object_y += y; content_broadcast(&c->base, - CONTENT_MSG_REDRAW, data); + CONTENT_MSG_REDRAW, &data); break; } else { @@ -315,7 +315,7 @@ html_object_callback(hlcache_handle *object, data.redraw.object_y += y + box->padding[TOP]; } - content_broadcast(&c->base, CONTENT_MSG_REDRAW, data); + content_broadcast(&c->base, CONTENT_MSG_REDRAW, &data); } break; @@ -354,7 +354,7 @@ html_object_callback(hlcache_handle *object, msg_data.dragsave.content = event->data.dragsave.content; - content_broadcast(&c->base, CONTENT_MSG_DRAGSAVE, msg_data); + content_broadcast(&c->base, CONTENT_MSG_DRAGSAVE, &msg_data); } break; @@ -364,7 +364,7 @@ html_object_callback(hlcache_handle *object, case CONTENT_MSG_GADGETCLICK: /* These messages are for browser window layer. * we're not interested, so pass them on. */ - content_broadcast(&c->base, event->type, event->data); + content_broadcast(&c->base, event->type, &event->data); break; case CONTENT_MSG_CARET: diff --git a/render/html_script.c b/render/html_script.c index 37b0564d7..c07e5a372 100644 --- a/render/html_script.c +++ b/render/html_script.c @@ -355,7 +355,7 @@ exec_src_script(html_content *c, ns_error = nsurl_join(c->base_url, dom_string_data(src), &joined); if (ns_error != NSERROR_OK) { msg_data.error = messages_get("NoMemory"); - content_broadcast(&c->base, CONTENT_MSG_ERROR, msg_data); + content_broadcast(&c->base, CONTENT_MSG_ERROR, &msg_data); return DOM_HUBBUB_NOMEM; } @@ -411,7 +411,7 @@ exec_src_script(html_content *c, if (nscript == NULL) { nsurl_unref(joined); msg_data.error = messages_get("NoMemory"); - content_broadcast(&c->base, CONTENT_MSG_ERROR, msg_data); + content_broadcast(&c->base, CONTENT_MSG_ERROR, &msg_data); return DOM_HUBBUB_NOMEM; } @@ -483,7 +483,7 @@ exec_inline_script(html_content *c, dom_node *node, dom_string *mimetype) dom_string_unref(script); msg_data.error = messages_get("NoMemory"); - content_broadcast(&c->base, CONTENT_MSG_ERROR, msg_data); + content_broadcast(&c->base, CONTENT_MSG_ERROR, &msg_data); return DOM_HUBBUB_NOMEM; } @@ -526,7 +526,7 @@ html_process_script(void *ctx, dom_node *node) union content_msg_data msg_data; msg_data.jscontext = &c->jscontext; - content_broadcast(&c->base, CONTENT_MSG_GETCTX, msg_data); + content_broadcast(&c->base, CONTENT_MSG_GETCTX, &msg_data); LOG("javascript context %p ", c->jscontext); if (c->jscontext == NULL) { /* no context and it could not be created, abort */ diff --git a/render/search.c b/render/search.c index 4af6706a0..8f21d8758 100644 --- a/render/search.c +++ b/render/search.c @@ -538,7 +538,7 @@ static void search_text(const char *string, int string_len, msg_data.scroll.y0 = bounds.y0; msg_data.scroll.x1 = bounds.x1; msg_data.scroll.y1 = bounds.y1; - content_broadcast(context->c, CONTENT_MSG_SCROLL, msg_data); + content_broadcast(context->c, CONTENT_MSG_SCROLL, &msg_data); } @@ -571,7 +571,7 @@ void search_step(struct search_context *context, search_flags_t flags, msg_data.scroll.area = false; msg_data.scroll.x0 = 0; msg_data.scroll.y0 = 0; - content_broadcast(context->c, CONTENT_MSG_SCROLL, msg_data); + content_broadcast(context->c, CONTENT_MSG_SCROLL, &msg_data); return; } search_text(string, string_len, context, flags); diff --git a/render/textplain.c b/render/textplain.c index 5d28d9c54..35e3e4ba4 100644 --- a/render/textplain.c +++ b/render/textplain.c @@ -186,7 +186,7 @@ textplain_create_internal(textplain_content *c, lwc_string *encoding) no_memory: msg_data.error = messages_get("NoMemory"); - content_broadcast(&c->base, CONTENT_MSG_ERROR, msg_data); + content_broadcast(&c->base, CONTENT_MSG_ERROR, &msg_data); return NSERROR_NOMEM; } @@ -363,7 +363,7 @@ textplain_process_data(struct content *c, const char *data, unsigned int size) no_memory: msg_data.error = messages_get("NoMemory"); - content_broadcast(c, CONTENT_MSG_ERROR, msg_data); + content_broadcast(c, CONTENT_MSG_ERROR, &msg_data); return false; } @@ -647,10 +647,10 @@ textplain_mouse_action(struct content *c, } msg_data.explicit_status_text = status; - content_broadcast(c, CONTENT_MSG_STATUS, msg_data); + content_broadcast(c, CONTENT_MSG_STATUS, &msg_data); msg_data.pointer = pointer; - content_broadcast(c, CONTENT_MSG_POINTER, msg_data); + content_broadcast(c, CONTENT_MSG_POINTER, &msg_data); } -- cgit v1.2.3