Ejemplo n.º 1
0
static void
buffer_destroy(struct wl_client *client, struct wl_resource *resource)
{
#ifdef HAS_WAYLAND_0_85
	wl_resource_destroy(resource, 0);
#else
	wl_resource_destroy(resource);
#endif
}
Ejemplo n.º 2
0
XdgBaseSurface::~XdgBaseSurface()
{
    if (m_resource && wl_resource_get_client(m_resource)) {
        wl_resource_set_destructor(m_resource, nullptr);
        wl_resource_destroy(m_resource);
    }
}
Ejemplo n.º 3
0
Archivo: cogland.c Proyecto: 3v1n0/cogl
static void
cogland_surface_free (CoglandSurface *surface)
{
  CoglandCompositor *compositor = surface->compositor;
  CoglandFrameCallback *cb, *next;

  wl_signal_emit (&surface->destroy_signal, &surface->resource);

  compositor->surfaces = g_list_remove (compositor->surfaces, surface);

  cogland_buffer_reference (&surface->buffer_ref, NULL);
  if (surface->texture)
    cogl_object_unref (surface->texture);

  if (surface->pending.buffer)
    wl_list_remove (&surface->pending.buffer_destroy_listener.link);

  wl_list_for_each_safe (cb, next,
                         &surface->pending.frame_callback_list, link)
    wl_resource_destroy (cb->resource);

  g_slice_free (CoglandSurface, surface);

  cogland_queue_redraw (compositor);
}
Ejemplo n.º 4
0
RelativePointerInterface::Private::~Private()
{
    if (resource) {
        wl_resource_destroy(resource);
        resource = nullptr;
    }
}
Ejemplo n.º 5
0
        void shoot(wl_resource *resource)
        {
            if (!wl_shm_buffer_get(resource)) {
                failed();
                return;
            }

            wl_shm_buffer *shm = wl_shm_buffer_get(resource);
            int width = wl_shm_buffer_get_width(shm);
            int height = wl_shm_buffer_get_height(shm);
            int stride = wl_shm_buffer_get_stride(shm);
            QSize size = m_surface->contentSize();

            if (stride != size.width() * 4 || height != size.height()) {
                failed();
                return;
            }

            wl_shm_buffer_begin_access(shm);

            void *data = wl_shm_buffer_get_data(shm);
            m_surface->copyContent(data, stride * height, QRect(0, 0, width, height));

            wl_shm_buffer_end_access(shm);

            orbital_surface_screenshot_send_done(m_resource);
            wl_resource_destroy(m_resource);
            delete this;
        }
Ejemplo n.º 6
0
void data_device_finalize(struct data_device * data_device)
{
    struct wl_resource * resource, * tmp;

    wl_list_for_each_safe(resource, tmp, &data_device->resources, link)
        wl_resource_destroy(resource);
}
Ejemplo n.º 7
0
void InputMethod::input_method_bind_resource(Resource *resource)
{
    if (m_resource) {
        wl_resource_post_error(resource->handle, WL_DISPLAY_ERROR_INVALID_OBJECT, "interface object already bound");
        wl_resource_destroy(resource->handle);
        return;
    }

    m_resource = resource;
}
Ejemplo n.º 8
0
static void
drm_buffer_destroy(struct wl_client *client, struct wl_resource *resource)
{
	trace(TRACE_DRM, "");
/*
 * struct drm_buffer = return wl_resource_get_user_data(resource);
	struct wl_drm_buffer *buffer;
 */

	wl_resource_destroy(resource);
}
Ejemplo n.º 9
0
void
meta_wayland_compositor_paint_finished (MetaWaylandCompositor *compositor)
{
  while (!wl_list_empty (&compositor->frame_callbacks))
    {
      MetaWaylandFrameCallback *callback =
        wl_container_of (compositor->frame_callbacks.next, callback, link);

      wl_callback_send_done (callback->resource, get_time ());
      wl_resource_destroy (callback->resource);
    }
}
Ejemplo n.º 10
0
static void
shell_handle_surface_destroy (struct wl_listener *listener,
                              struct wl_resource *resource,
                              uint32_t time)
{
  CoglandShellSurface *shell_surface = container_of (listener,
                                                     CoglandShellSurface,
                                                     surface_destroy_listener);

  shell_surface->surface->has_shell_surface = FALSE;
  shell_surface->surface = NULL;
  wl_resource_destroy (&shell_surface->resource, time);
}
Ejemplo n.º 11
0
Archivo: shm.c Proyecto: Kinokoio/swc
static void create_buffer(struct wl_client * client,
                          struct wl_resource * resource, uint32_t id,
                          int32_t offset, int32_t width, int32_t height,
                          int32_t stride, uint32_t format)
{
    struct pool * pool = wl_resource_get_user_data(resource);
    struct pool_reference * reference;
    struct wld_buffer * buffer;
    struct wl_resource * buffer_resource;
    union wld_object object;

    if (offset > pool->size || offset < 0)
    {
        wl_resource_post_error(resource, WL_SHM_ERROR_INVALID_STRIDE,
                               "offset is too big or negative");
        return;
    }

    object.ptr = (void *)((uintptr_t) pool->data + offset);
    buffer = wld_import_buffer(swc.shm->context, WLD_OBJECT_DATA, object,
                               width, height, format_shm_to_wld(format),
                               stride);

    if (!buffer)
        goto error0;

    buffer_resource = wayland_buffer_create_resource
        (client, wl_resource_get_version(resource), id, buffer);

    if (!buffer_resource)
        goto error1;

    if (!(reference = malloc(sizeof *reference)))
        goto error2;

    reference->pool = pool;
    reference->destructor.destroy = &handle_buffer_destroy;
    wld_buffer_add_destructor(buffer, &reference->destructor);
    ++pool->references;

    return;

  error2:
    wl_resource_destroy(buffer_resource);
  error1:
    wld_buffer_unreference(buffer);
  error0:
    wl_resource_post_no_memory(resource);
}
Ejemplo n.º 12
0
Archivo: cogland.c Proyecto: 3v1n0/cogl
static void
shell_handle_surface_destroy (struct wl_listener *listener,
                              void *data)
{
  CoglandShellSurface *shell_surface =
    wl_container_of (listener, shell_surface, surface_destroy_listener);

  shell_surface->surface->has_shell_surface = FALSE;
  shell_surface->surface = NULL;

  if (shell_surface->resource)
    wl_resource_destroy (shell_surface->resource);
  else
    destroy_shell_surface (shell_surface);
}
Ejemplo n.º 13
0
Archivo: cogland.c Proyecto: 3v1n0/cogl
static CoglBool
paint_cb (void *user_data)
{
  CoglandCompositor *compositor = user_data;
  GList *l;

  for (l = compositor->outputs; l; l = l->next)
    {
      CoglandOutput *output = l->data;
      CoglFramebuffer *fb = output->onscreen;
      GList *l2;

      cogl_framebuffer_clear4f (fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1);

      cogl_primitive_draw (compositor->triangle,
                           fb, compositor->triangle_pipeline);

      for (l2 = compositor->surfaces; l2; l2 = l2->next)
        {
          CoglandSurface *surface = l2->data;

          if (surface->texture)
            {
              CoglTexture2D *texture = surface->texture;
              CoglPipeline *pipeline =
                cogl_pipeline_new (compositor->cogl_context);
              cogl_pipeline_set_layer_texture (pipeline, 0, texture);
              cogl_framebuffer_draw_rectangle (fb, pipeline, -1, 1, 1, -1);
              cogl_object_unref (pipeline);
            }
        }
      cogl_onscreen_swap_buffers (COGL_ONSCREEN (fb));
    }

  while (!wl_list_empty (&compositor->frame_callbacks))
    {
      CoglandFrameCallback *callback =
        wl_container_of (compositor->frame_callbacks.next, callback, link);

      wl_callback_send_done (callback->resource, get_time ());
      wl_resource_destroy (callback->resource);
    }

  compositor->redraw_idle = 0;

  return G_SOURCE_REMOVE;
}
Ejemplo n.º 14
0
static CoglBool
paint_cb (void *user_data)
{
  CoglandCompositor *compositor = user_data;
  GList *l;

  for (l = compositor->outputs; l; l = l->next)
    {
      CoglandOutput *output = l->data;
      CoglFramebuffer *fb = COGL_FRAMEBUFFER (output->onscreen);
      GList *l2;

      cogl_framebuffer_clear4f (fb, COGL_BUFFER_BIT_COLOR, 0, 0, 0, 1);

      cogl_framebuffer_draw_primitive (fb, compositor->triangle_pipeline,
                                       compositor->triangle);

      for (l2 = compositor->surfaces; l2; l2 = l2->next)
        {
          CoglandSurface *surface = l2->data;

          if (surface->buffer)
            {
              CoglTexture2D *texture = surface->buffer->texture;
              CoglPipeline *pipeline =
                cogl_pipeline_new (compositor->cogl_context);
              cogl_pipeline_set_layer_texture (pipeline, 0,
                                               COGL_TEXTURE (texture));
              cogl_framebuffer_draw_rectangle (fb, pipeline, -1, 1, 1, -1);
              cogl_object_unref (pipeline);
            }
        }
      cogl_onscreen_swap_buffers (COGL_ONSCREEN (fb));
    }

  while (!g_queue_is_empty (&compositor->frame_callbacks))
    {
      CoglandFrameCallback *callback =
        g_queue_peek_head (&compositor->frame_callbacks);

      wl_resource_post_event (&callback->resource,
                              WL_CALLBACK_DONE, get_time ());
      wl_resource_destroy (&callback->resource, 0);
    }

  return TRUE;
}
Ejemplo n.º 15
0
RestrictedGlobal::RestrictedGlobal(Compositor *c, const wl_interface *i, uint32_t v)
                : m_authorizer(c->authorizer())
                , m_interface(i)
{
    m_global = wl_global_create(c->m_display, i, v, this,
                                [](wl_client *client, void *data, uint32_t version, uint32_t id) {
                                    RestrictedGlobal *_this = static_cast<RestrictedGlobal *>(data);
                                    if (_this->m_authorizer->isClientTrusted(_this->m_interface->name, client)) {
                                        _this->bind(client, version, id);
                                    } else {
                                        wl_resource *resource = wl_resource_create(client, _this->m_interface, version, id);
                                        wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
                                                               "permission to bind the global interface '%s' denied", _this->m_interface->name);
                                        wl_resource_destroy(resource);
                                    }
                                });
    m_authorizer->addRestrictedInterface(i->name);
}
Ejemplo n.º 16
0
        static void done(void *data, weston_screenshooter_outcome outcome)
        {
            Screenshot *ss = static_cast<Screenshot *>(data);

            switch (outcome) {
                case WESTON_SCREENSHOOTER_SUCCESS:
                    orbital_screenshot_send_done(ss->resource);
                    break;
                case WESTON_SCREENSHOOTER_NO_MEMORY:
                    wl_resource_post_no_memory(ss->resource);
                    break;
                case WESTON_SCREENSHOOTER_BAD_BUFFER:
                    orbital_screenshot_send_failed(ss->resource);
                    break;
            }

            wl_resource_destroy(ss->resource);
            delete ss;
        }
Ejemplo n.º 17
0
Archivo: shm.c Proyecto: C0DEHERO/swc
static void create_pool(struct wl_client * client,
                        struct wl_resource * resource, uint32_t id,
                        int32_t fd, int32_t size)
{
    struct pool * pool;

    if (!(pool = malloc(sizeof *pool)))
    {
        wl_resource_post_no_memory(resource);
        return;
    }

    pool->resource = wl_resource_create(client, &wl_shm_pool_interface,
                                        wl_resource_get_version(resource), id);

    if (!pool->resource)
    {
        wl_resource_post_no_memory(resource);
        goto error0;
    }

    wl_resource_set_implementation(pool->resource, &shm_pool_implementation,
                                   pool, &destroy_pool_resource);
    pool->data = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);

    if (pool->data == MAP_FAILED)
    {
        wl_resource_post_error(resource, WL_SHM_ERROR_INVALID_FD,
                               "mmap failed: %s", strerror(errno));
        goto error1;
    }

    pool->size = size;
    pool->references = 1;

    return;

  error1:
    wl_resource_destroy(pool->resource);
  error0:
    free(pool);
}
Ejemplo n.º 18
0
WL_EXPORT void
wlb_keyboard_destroy(struct wlb_keyboard *keyboard)
{
	struct wl_resource *resource, *rnext;

	wl_resource_for_each_safe(resource, rnext, &keyboard->resource_list)
		wl_resource_destroy(resource);
	
	if (keyboard->focus)
		wl_list_remove(&keyboard->surface_destroy_listener.link);

	keyboard->seat->keyboard = NULL;
	
	if (keyboard->keymap.data) {
		munmap(keyboard->keymap.data, keyboard->keymap.size);
		close(keyboard->keymap.fd);
	}

	free(keyboard);
}
Ejemplo n.º 19
0
static void
server_wlegl_get_server_buffer_handle(wl_client *client, wl_resource *res, uint32_t id, int32_t width, int32_t height, int32_t format, int32_t usage)
{
	if (width == 0 || height == 0) {
		wl_resource_post_error(res, 0, "invalid buffer size: %u,%u\n", width, height);
		return;
	}

	server_wlegl *wlegl = server_wlegl_from(res);

	wl_resource *resource = wl_resource_create(client, &android_wlegl_server_buffer_handle_interface, wl_resource_get_version(res), id);

	buffer_handle_t _handle;
	int _stride;

	usage |= GRALLOC_USAGE_HW_COMPOSER;

	int r = hybris_gralloc_allocate(width, height, format, usage, &_handle, (uint32_t*)&_stride);
        if (r) {
            HYBRIS_ERROR_LOG(SERVER_WLEGL, "failed to allocate buffer\n");
        }
	server_wlegl_buffer *buffer = server_wlegl_buffer_create_server(client, width, height, _stride, format, usage, _handle, wlegl);

	struct wl_array ints;
	int *ints_data;
	wl_array_init(&ints);
	ints_data = (int*) wl_array_add(&ints, _handle->numInts * sizeof(int));
	memcpy(ints_data, _handle->data + _handle->numFds, _handle->numInts * sizeof(int));

	android_wlegl_server_buffer_handle_send_buffer_ints(resource, &ints);
	wl_array_release(&ints);

	for (int i = 0; i < _handle->numFds; i++) {
		android_wlegl_server_buffer_handle_send_buffer_fd(resource, _handle->data[i]);
	}

	android_wlegl_server_buffer_handle_send_buffer(resource, buffer->resource, format, _stride);
	wl_resource_destroy(resource);
}
Ejemplo n.º 20
0
struct xdg_popup *
xdg_popup_new(struct wl_client *client, uint32_t version,
              uint32_t id, struct surface *surface, struct surface *parent_surface, int32_t x, int32_t y)
{
	struct xdg_popup *popup;
	struct compositor_view *parent = compositor_view(parent_surface->view);

	if (!parent)
		goto error0;

	popup = malloc(sizeof *popup);

	if (!popup)
		goto error0;

	popup->resource = wl_resource_create(client, &xdg_popup_interface, version, id);

	if (!popup->resource)
		goto error1;

	popup->surface_destroy_listener.notify = &handle_surface_destroy;
	wl_resource_add_destroy_listener(surface->resource, &popup->surface_destroy_listener);
	wl_resource_set_implementation(popup->resource, &xdg_popup_implementation, popup, &destroy_popup);

	if (!(popup->view = compositor_create_view(surface)))
		goto error2;

	view_move(&popup->view->base, parent->base.geometry.x + x, parent->base.geometry.y + y);
	compositor_view_set_parent(popup->view, parent);

	return popup;

error2:
	wl_resource_destroy(popup->resource);
error1:
	free(popup);
error0:
	return NULL;
}
Ejemplo n.º 21
0
Archivo: shm.c Proyecto: C0DEHERO/swc
static void destroy(struct wl_client * client, struct wl_resource * resource)
{
    wl_resource_destroy(resource);
}
Ejemplo n.º 22
0
void Region::region_destroy(Resource *resource)
{
    wl_resource_destroy(resource->handle);
}
Ejemplo n.º 23
0
void QWaylandSurface::destroySurfaceByForce()
{
    Q_D(QWaylandSurface);
   wl_resource *surface_resource = d->surface->resource()->handle;
   wl_resource_destroy(surface_resource);
}
Ejemplo n.º 24
0
Archivo: cogland.c Proyecto: 3v1n0/cogl
static void
cogland_region_destroy (struct wl_client *client,
			struct wl_resource *resource)
{
  wl_resource_destroy (resource);
}
Ejemplo n.º 25
0
void QWaylandTouchPrivate::touch_release(Resource *resource)
{
    wl_resource_destroy(resource->handle);
}
Ejemplo n.º 26
0
Archivo: cogland.c Proyecto: 3v1n0/cogl
static void
cogland_surface_destroy (struct wl_client *wayland_client,
                         struct wl_resource *wayland_resource)
{
  wl_resource_destroy (wayland_resource);
}
Ejemplo n.º 27
0
static void
data_offer_destroy(struct wl_client *client, struct wl_resource *resource)
{
	wl_resource_destroy(resource, 0);
}
Ejemplo n.º 28
0
static void
data_device_release(struct wl_client *client, struct wl_resource *resource)
{
  wl_resource_destroy(resource);
}
Ejemplo n.º 29
0
void ClipboardManager::destroy(wl_client *client, wl_resource *res)
{
    wl_resource_destroy(res);
}
Ejemplo n.º 30
0
static void
runner_destroy_handler(struct wl_client *client, struct wl_resource *resource)
{
	wl_resource_destroy(resource);
}