Content API: Make content_broadcast take pointer to content_msg_data.

This commit is contained in:
Michael Drake 2017-08-26 15:50:03 +01:00
parent aedd9b5513
commit d70beb28db
23 changed files with 98 additions and 94 deletions

View File

@ -163,7 +163,7 @@ nserror content_llcache_callback(llcache_handle *llcache,
content_set_status(c, messages_get("Processing"));
msg_data.explicit_status_text = NULL;
content_broadcast(c, CONTENT_MSG_STATUS, msg_data);
content_broadcast(c, CONTENT_MSG_STATUS, &msg_data);
content_convert(c);
}
@ -172,17 +172,17 @@ nserror content_llcache_callback(llcache_handle *llcache,
/** \todo Error page? */
c->status = CONTENT_STATUS_ERROR;
msg_data.error = event->data.msg;
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
break;
case LLCACHE_EVENT_PROGRESS:
content_set_status(c, event->data.msg);
msg_data.explicit_status_text = NULL;
content_broadcast(c, CONTENT_MSG_STATUS, msg_data);
content_broadcast(c, CONTENT_MSG_STATUS, &msg_data);
break;
case LLCACHE_EVENT_REDIRECT:
msg_data.redirect.from = event->data.redirect.from;
msg_data.redirect.to = event->data.redirect.to;
content_broadcast(c, CONTENT_MSG_REDIRECT, msg_data);
content_broadcast(c, CONTENT_MSG_REDIRECT, &msg_data);
break;
}
@ -292,8 +292,6 @@ void content_convert(struct content *c)
void content_set_ready(struct content *c)
{
union content_msg_data msg_data;
/* The content must be locked at this point, as it can only
* become READY after conversion. */
assert(c->locked);
@ -301,7 +299,7 @@ void content_set_ready(struct content *c)
c->status = CONTENT_STATUS_READY;
content_update_status(c);
content_broadcast(c, CONTENT_MSG_READY, msg_data);
content_broadcast(c, CONTENT_MSG_READY, NULL);
}
/**
@ -310,7 +308,6 @@ void content_set_ready(struct content *c)
void content_set_done(struct content *c)
{
union content_msg_data msg_data;
uint64_t now_ms;
nsu_getmonotonic_ms(&now_ms);
@ -318,7 +315,7 @@ void content_set_done(struct content *c)
c->status = CONTENT_STATUS_DONE;
c->time = now_ms - c->time;
content_update_status(c);
content_broadcast(c, CONTENT_MSG_DONE, msg_data);
content_broadcast(c, CONTENT_MSG_DONE, NULL);
}
/**
@ -363,7 +360,7 @@ void content__reformat(struct content *c, bool background,
c->locked = false;
data.background = background;
content_broadcast(c, CONTENT_MSG_REFORMAT, data);
content_broadcast(c, CONTENT_MSG_REFORMAT, &data);
}
}
@ -436,7 +433,7 @@ void content_mouse_track(hlcache_handle *h, struct browser_window *bw,
} else {
union content_msg_data msg_data;
msg_data.pointer = BROWSER_POINTER_AUTO;
content_broadcast(c, CONTENT_MSG_POINTER, msg_data);
content_broadcast(c, CONTENT_MSG_POINTER, &msg_data);
}
@ -540,7 +537,7 @@ void content__request_redraw(struct content *c,
data.redraw.object_width = c->width;
data.redraw.object_height = c->height;
content_broadcast(c, CONTENT_MSG_REDRAW, data);
content_broadcast(c, CONTENT_MSG_REDRAW, &data);
}
@ -753,15 +750,20 @@ bool content_is_shareable(struct content *c)
*/
void content_broadcast(struct content *c, content_msg msg,
union content_msg_data data)
const union content_msg_data *data)
{
struct content_user *user, *next;
union content_msg_data d = { 0 };
assert(c);
if (data != NULL) {
d = *data;
}
// LOG("%p -> msg:%d", c, msg);
for (user = c->user_list->next; user != 0; user = next) {
next = user->next; /* user may be destroyed during callback */
if (user->callback != 0)
user->callback(c, msg, data, user->pw);
user->callback(c, msg, d, user->pw);
}
}
@ -1040,7 +1042,7 @@ bool content__add_rfc5988_link(struct content *c,
/* broadcast the data */
msg_data.rfc5988_link = newlink;
content_broadcast(c, CONTENT_MSG_LINK, msg_data);
content_broadcast(c, CONTENT_MSG_LINK, &msg_data);
return true;
}

View File

@ -166,7 +166,7 @@ void content_set_error(struct content *c);
void content_set_status(struct content *c, const char *status_message);
void content_broadcast(struct content *c, content_msg msg,
union content_msg_data data);
const union content_msg_data *data);
/**
* Send an errorcode message to all users.
*/

View File

@ -172,7 +172,7 @@ nscss_create(const content_handler *handler,
nscss_content_done, result);
if (error != NSERROR_OK) {
msg_data.error = messages_get("NoMemory");
content_broadcast(&result->base, CONTENT_MSG_ERROR, msg_data);
content_broadcast(&result->base, CONTENT_MSG_ERROR, &msg_data);
if (charset_value != NULL)
lwc_string_unref(charset_value);
free(result);
@ -256,7 +256,7 @@ bool nscss_process_data(struct content *c, const char *data, unsigned int size)
error = nscss_process_css_data(&css->data, data, size);
if (error != CSS_OK && error != CSS_NEEDDATA) {
msg_data.error = "?";
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
}
return (error == CSS_OK || error == CSS_NEEDDATA);
@ -292,7 +292,7 @@ bool nscss_convert(struct content *c)
error = nscss_convert_css_data(&css->data);
if (error != CSS_OK) {
msg_data.error = "?";
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
@ -485,7 +485,7 @@ void nscss_content_done(struct content_css_data *css, void *pw)
error = css_stylesheet_size(css->sheet, &size);
if (error != CSS_OK) {
msg_data.error = "?";
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
content_set_error(c);
return;
}

View File

@ -80,7 +80,7 @@ static nserror nsbmp_create_bmp_data(nsbmp_content *bmp)
bmp->bmp = calloc(sizeof(struct bmp_image), 1);
if (bmp->bmp == NULL) {
msg_data.error = messages_get("NoMemory");
content_broadcast(&bmp->base, CONTENT_MSG_ERROR, msg_data);
content_broadcast(&bmp->base, CONTENT_MSG_ERROR, &msg_data);
return NSERROR_NOMEM;
}
@ -139,12 +139,12 @@ static bool nsbmp_convert(struct content *c)
break;
case BMP_INSUFFICIENT_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;
case BMP_INSUFFICIENT_DATA:
case BMP_DATA_ERROR:
msg_data.error = messages_get("BadBMP");
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}

View File

@ -86,7 +86,7 @@ static nserror nsgif_create_gif_data(nsgif_content *c)
c->gif = calloc(sizeof(gif_animation), 1);
if (c->gif == NULL) {
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;
}
gif_create(c->gif, &gif_bitmap_callbacks);
@ -231,7 +231,7 @@ static void nsgif_animate(void *p)
data.redraw.object_width = gif->base.width;
data.redraw.object_height = gif->base.height;
content_broadcast(&gif->base, CONTENT_MSG_REDRAW, data);
content_broadcast(&gif->base, CONTENT_MSG_REDRAW, &data);
}
static bool nsgif_convert(struct content *c)
@ -261,7 +261,7 @@ static bool nsgif_convert(struct content *c)
msg_data.error = messages_get("NoMemory");
break;
}
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
} while (res != GIF_OK && res != GIF_INSUFFICIENT_FRAME_DATA);
@ -270,7 +270,7 @@ static bool nsgif_convert(struct content *c)
if ((gif->gif->frame_count_partial == 0) || (gif->gif->width == 0) ||
(gif->gif->height == 0)) {
msg_data.error = messages_get("BadGIF");
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}

View File

@ -77,7 +77,7 @@ static nserror nsico_create_ico_data(nsico_content *c)
c->ico = calloc(sizeof(ico_collection), 1);
if (c->ico == NULL) {
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;
}
ico_collection_create(c->ico, &bmp_bitmap_callbacks);
@ -138,12 +138,12 @@ static bool nsico_convert(struct content *c)
break;
case BMP_INSUFFICIENT_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;
case BMP_INSUFFICIENT_DATA:
case BMP_DATA_ERROR:
msg_data.error = messages_get("BadICO");
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}

View File

@ -301,7 +301,7 @@ static bool nsjpeg_convert(struct content *c)
jpeg_destroy_decompress(&cinfo);
msg_data.error = nsjpeg_error_buffer;
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}

View File

@ -119,13 +119,13 @@ static bool nssprite_convert(struct content *c)
nssprite->bitmap = guit->bitmap->create(sprite->width, sprite->height, BITMAP_NEW);
if (!nssprite->bitmap) {
msg_data.error = messages_get("NoMemory");
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
uint32_t* imagebuf = (uint32_t *)guit->bitmap->get_buffer(nssprite->bitmap);
if (!imagebuf) {
msg_data.error = messages_get("NoMemory");
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
unsigned char *spritebuf = (unsigned char *)sprite->image;

View File

@ -247,7 +247,7 @@ static nserror nspng_create_png_data(nspng_content *png_c)
png_c->png = png_create_read_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0);
if (png_c->png == NULL) {
msg_data.error = messages_get("NoMemory");
content_broadcast(&png_c->base, CONTENT_MSG_ERROR, msg_data);
content_broadcast(&png_c->base, CONTENT_MSG_ERROR, &msg_data);
return NSERROR_NOMEM;
}
@ -258,7 +258,7 @@ static nserror nspng_create_png_data(nspng_content *png_c)
png_destroy_read_struct(&png_c->png, &png_c->info, 0);
msg_data.error = messages_get("NoMemory");
content_broadcast(&png_c->base, CONTENT_MSG_ERROR, msg_data);
content_broadcast(&png_c->base, CONTENT_MSG_ERROR, &msg_data);
return NSERROR_NOMEM;
}
@ -269,7 +269,7 @@ static nserror nspng_create_png_data(nspng_content *png_c)
png_c->info = NULL;
msg_data.error = messages_get("PNGError");
content_broadcast(&png_c->base, CONTENT_MSG_ERROR, msg_data);
content_broadcast(&png_c->base, CONTENT_MSG_ERROR, &msg_data);
return NSERROR_NOMEM;
}
@ -363,7 +363,7 @@ static bool nspng_process_data(struct content *c, const char *data,
png_c->info = NULL;
msg_data.error = messages_get("PNGError");
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
ret = false;

View File

@ -72,7 +72,7 @@ static nserror rsvg_create_svg_data(rsvg_content *c)
if ((c->rsvgh = rsvg_handle_new()) == NULL) {
LOG("rsvg_handle_new() returned NULL.");
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;
}
@ -122,7 +122,7 @@ static bool rsvg_process_data(struct content *c, const char *data,
&err) == FALSE) {
LOG("rsvg_handle_write returned an error: %s", err->message);
msg_data.error = err->message;
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
@ -168,7 +168,7 @@ static bool rsvg_convert(struct content *c)
if (rsvg_handle_close(d->rsvgh, &err) == FALSE) {
LOG("rsvg_handle_close returned an error: %s", err->message);
msg_data.error = err->message;
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
@ -186,7 +186,7 @@ static bool rsvg_convert(struct content *c)
BITMAP_NEW)) == NULL) {
LOG("Failed to create bitmap for rsvg render.");
msg_data.error = messages_get("NoMemory");
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
@ -197,14 +197,14 @@ static bool rsvg_convert(struct content *c)
guit->bitmap->get_rowstride(d->bitmap))) == NULL) {
LOG("Failed to create Cairo image surface for rsvg render.");
msg_data.error = messages_get("NoMemory");
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
if ((d->ct = cairo_create(d->cs)) == NULL) {
LOG("Failed to create Cairo drawing context for rsvg render.");
msg_data.error = messages_get("NoMemory");
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}

View File

@ -62,7 +62,7 @@ static nserror svg_create_svg_data(svg_content *c)
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;
}

View File

@ -190,7 +190,7 @@ bool amiga_dt_anim_convert(struct content *c)
plugin->bitmap = amiga_bitmap_create(width, height, bm_flags);
if (!plugin->bitmap) {
msg_data.error = messages_get("NoMemory");
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}

View File

@ -187,7 +187,7 @@ static struct bitmap *amiga_dt_picture_cache_convert(struct content *c)
bitmap = amiga_bitmap_create(c->width, c->height, BITMAP_NEW);
if (!bitmap) {
msg_data.error = messages_get("NoMemory");
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return NULL;
}

View File

@ -155,7 +155,7 @@ bool amiga_icon_convert(struct content *c)
if(filename == NULL)
{
msg_data.error = messages_get("NoMemory");
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
@ -167,7 +167,7 @@ bool amiga_icon_convert(struct content *c)
if(dobj == NULL)
{
msg_data.error = messages_get("NoMemory");
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
@ -187,14 +187,14 @@ bool amiga_icon_convert(struct content *c)
icon_c->bitmap = amiga_bitmap_create(width, height, BITMAP_NEW);
if (!icon_c->bitmap) {
msg_data.error = messages_get("NoMemory");
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
if(dobj) FreeDiskObject(dobj);
return false;
}
imagebuf = (ULONG *) amiga_bitmap_get_buffer(icon_c->bitmap);
if (!imagebuf) {
msg_data.error = messages_get("NoMemory");
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
if(dobj) FreeDiskObject(dobj);
return false;
}

View File

@ -185,7 +185,7 @@ bool artworks_convert(struct content *c)
if (used >= 0) {
LOG("Alias$LoadArtWorksModules not defined");
msg_data.error = messages_get("AWNotSeen");
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
@ -194,7 +194,7 @@ bool artworks_convert(struct content *c)
if (error) {
LOG("xos_cli: 0x%x: %s", error->errnum, error->errmess);
msg_data.error = error->errmess;
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
@ -204,7 +204,7 @@ bool artworks_convert(struct content *c)
if (error) {
LOG("AWRender_FileInitAddress: 0x%x: %s", error->errnum, error->errmess);
msg_data.error = error->errmess;
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
@ -214,7 +214,7 @@ bool artworks_convert(struct content *c)
if (error) {
LOG("AWRender_RenderAddress: 0x%x: %s", error->errnum, error->errmess);
msg_data.error = error->errmess;
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
@ -226,7 +226,7 @@ bool artworks_convert(struct content *c)
if (error) {
LOG("awrender_init: 0x%x : %s", error->errnum, error->errmess);
msg_data.error = error->errmess;
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
@ -241,7 +241,7 @@ bool artworks_convert(struct content *c)
if (error) {
LOG("AWRender_DocBounds: 0x%x: %s", error->errnum, error->errmess);
msg_data.error = error->errmess;
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
@ -255,7 +255,7 @@ bool artworks_convert(struct content *c)
if (!aw->block) {
LOG("failed to create block for ArtworksRenderer");
msg_data.error = messages_get("NoMemory");
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}

View File

@ -128,7 +128,7 @@ bool draw_convert(struct content *c)
if (error) {
LOG("xdrawfile_bbox: 0x%x: %s", error->errnum, error->errmess);
msg_data.error = error->errmess;
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}

View File

@ -126,7 +126,7 @@ bool sprite_convert(struct content *c)
/* check for bad data */
if ((int)source_size + 4 != area->used) {
msg_data.error = messages_get("BadSprite");
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}
@ -137,7 +137,7 @@ bool sprite_convert(struct content *c)
if (error) {
LOG("xosspriteop_read_sprite_info: 0x%x: %s", error->errnum, error->errmess);
msg_data.error = error->errmess;
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
return false;
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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:

View File

@ -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 */

View File

@ -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);

View File

@ -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);
}