Пример #1
0
WL_EXPORT int
module_init(struct weston_compositor *ec,
	    int *argc, char *argv[])
{
	struct cms_static *cms;
	struct weston_output *output;

	weston_log("cms-static: initialized\n");

	/* create local state object */
	cms = malloc(sizeof *cms);
	if (cms == NULL)
		return -1;
	memset(cms, 0, sizeof *cms);

	cms->ec = ec;
	cms->destroy_listener.notify = cms_notifier_destroy;
	wl_signal_add(&ec->destroy_signal, &cms->destroy_listener);

	cms->output_created_listener.notify = cms_notifier_output_created;
	wl_signal_add(&ec->output_created_signal, &cms->output_created_listener);

	/* discover outputs */
	wl_list_for_each(output, &ec->output_list, link)
		cms_output_created(cms, output);

	return 0;
}
Пример #2
0
static struct enumeration *
find_enumeration(struct protocol *protocol,
		 struct interface *interface,
		 char *enum_attribute)
{
	struct interface *i;
	struct enumeration *e;
	char *enum_name;
	uint32_t idx = 0, j;

	for (j = 0; j + 1 < strlen(enum_attribute); j++) {
		if (enum_attribute[j] == '.') {
			idx = j;
		}
	}

	if (idx > 0) {
		enum_name = enum_attribute + idx + 1;

		wl_list_for_each(i, &protocol->interface_list, link)
			if (strncmp(i->name, enum_attribute, idx) == 0)
				wl_list_for_each(e, &i->enumeration_list, link)
					if (strcmp(e->name, enum_name) == 0)
						return e;
	} else if (interface) {
Пример #3
0
void Compositor::setOutputGeometry(void *c, const QList<QVariant> &parameters)
{
    Compositor *compositor = static_cast<Compositor *>(c);
    compositor->m_outputGeometry = parameters.first().toRect();

    wl_resource *resource;
    wl_list_for_each(resource, &compositor->m_outputResources, link)
        compositor->sendOutputGeometry(resource);
}
Пример #4
0
static void
display_fatal_error(struct wl_display *display, int error)
{
	struct wl_event_queue *iter;

	if (display->last_error)
		return;

	if (!error)
		error = 1;

	display->last_error = error;

	wl_list_for_each(iter, &display->event_queue_list, link)
		pthread_cond_broadcast(&iter->cond);
}
Пример #5
0
static struct ss_shm_buffer *
shared_output_get_shm_buffer(struct shared_output *so)
{
	struct ss_shm_buffer *sb, *bnext;
	struct wl_shm_pool *pool;
	int width, height, stride;
	int fd;
	unsigned char *data;

	width = so->output->width;
	height = so->output->height;
	stride = width * 4;

	/* If the size of the output changed, we free the old buffers and
	 * make new ones. */
	if (so->shm.width != width ||
	    so->shm.height != height) {

		/* Destroy free buffers */
		wl_list_for_each_safe(sb, bnext, &so->shm.free_buffers, free_link)
			ss_shm_buffer_destroy(sb);

		/* Orphan in-use buffers so they get destroyed */
		wl_list_for_each(sb, &so->shm.buffers, link)
			sb->output = NULL;

		so->shm.width = width;
		so->shm.height = height;
	}

	if (!wl_list_empty(&so->shm.free_buffers)) {
		sb = container_of(so->shm.free_buffers.next,
				  struct ss_shm_buffer, free_link);
		wl_list_remove(&sb->free_link);
		wl_list_init(&sb->free_link);

		return sb;
	}