Ejemplo n.º 1
0
void
location_goto(struct document_view *doc_view, unsigned char *url)
{
	unsigned char *new_abs_url;
	struct uri *new_uri;
	struct delayed_goto *deg;

	/* Workaround for bug 611. Does not crash, but may lead to infinite loop.*/
	if (!doc_view) return;
	new_abs_url = join_urls(doc_view->document->uri,
	                        trim_chars(url, ' ', 0));
	if (!new_abs_url)
		return;
	new_uri = get_uri(new_abs_url, 0);
	mem_free(new_abs_url);
	if (!new_uri)
		return;
	deg = mem_calloc(1, sizeof(*deg));
	if (!deg) {
		done_uri(new_uri);
		return;
	}
	assert(doc_view->vs);
	deg->vs = doc_view->vs;
	deg->uri = new_uri;
	/* It does not seem to be very safe inside of frames to
	 * call goto_uri() right away. */
	register_bottom_half(delayed_goto, deg);
}
Ejemplo n.º 2
0
Archivo: kbd.c Proyecto: Efreak/elinks
void
itrm_queue_event(struct itrm *itrm, unsigned char *data, int len)
{
	int w = 0;

	if (!len) return;

	if (!itrm->out.queue.len && can_write(itrm->out.sock)) {
		w = safe_write(itrm->out.sock, data, len);
		if (w <= 0 && HPUX_PIPE) {
			register_bottom_half(free_itrm, itrm);
			return;
		}
	}

	if (w < len) {
		int left = len - w;
		unsigned char *c = mem_realloc(itrm->out.queue.data,
					       itrm->out.queue.len + left);

		if (!c) {
			free_itrm(itrm);
			return;
		}

		itrm->out.queue.data = c;
		memcpy(itrm->out.queue.data + itrm->out.queue.len, data + w, left);
		itrm->out.queue.len += left;
		set_handlers(itrm->out.sock,
			     get_handler(itrm->out.sock, SELECT_HANDLER_READ),
			     (select_handler_T) itrm_queue_write,
			     (select_handler_T) free_itrm, itrm);
	}
}
Ejemplo n.º 3
0
Archivo: x.c Proyecto: lince/ginga-srpp
static inline void X_FLUSH(void)
{
	if (!flush_in_progress)
	{
		register_bottom_half(x_do_flush,NULL);
		flush_in_progress=1;
	}
}
Ejemplo n.º 4
0
static void
delete_file_download(struct listbox_item *item, int last)
{
	struct file_download *file_download = item->udata;

	assert(!is_object_used(file_download));
	register_bottom_half(do_abort_download, file_download);
}
Ejemplo n.º 5
0
static widget_handler_status_T
dlg_abort_download(struct dialog_data *dlg_data, struct widget_data *widget_data)
{
	struct file_download *file_download = dlg_data->dlg->udata;

	object_unlock(file_download);
	register_bottom_half(do_abort_download, file_download);
	return EVENT_PROCESSED;
}
Ejemplo n.º 6
0
static void
sig_intr(struct terminal *term)
{
    unhandle_basic_signals(term);

    if (!term)
        program.terminate = 1;
    else
        register_bottom_half(destroy_terminal, term);
}
Ejemplo n.º 7
0
static void lxynth_surface_update (struct graphics_device *dev, int x, int y, int w, int h)
{
	s_rect_t rect;
	lxynth_device_t *wd;
	wd = (lxynth_device_t *) dev->driver_data;
	rect = wd->update;
	if (rect.x >= 0) { wd->update.x = MIN(rect.x, x); } else { wd->update.x = x; }
	if (rect.y >= 0) { wd->update.y = MIN(rect.y, y); } else { wd->update.y = y; }
	if (rect.w >= 0) { wd->update.w = MAX(rect.x + rect.w, x + w) - wd->update.x; } else { wd->update.w = w; }
	if (rect.h >= 0) { wd->update.h = MAX(rect.y + rect.h, y + h) - wd->update.y; } else { wd->update.h = h; }
	register_bottom_half(lxynth_surface_register_update, dev);
}
Ejemplo n.º 8
0
static widget_handler_status_T
push_delete_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
{
	struct file_download *file_download = dlg_data->dlg->udata;

	file_download->delete_ = 1;
#if CONFIG_BITTORRENT
	if (file_download->uri->protocol == PROTOCOL_BITTORRENT)
		set_bittorrent_files_for_deletion(&file_download->download);
#endif
	object_unlock(file_download);
	register_bottom_half(do_abort_download, file_download);
	return EVENT_PROCESSED;
}