Exemple #1
0
static void
bind_drm(struct wl_client *client, void *data, uint32_t version, uint32_t id)
{
	struct wl_drm *drm = data;
	struct wl_resource *resource;
        uint32_t capabilities;

	resource = wl_client_add_object(client, &wl_drm_interface,
					&drm_interface, id, data);
	wl_resource_post_event(resource, WL_DRM_DEVICE, drm->device_name);
	wl_resource_post_event(resource, WL_DRM_FORMAT,
			       WL_DRM_FORMAT_ARGB8888);
	wl_resource_post_event(resource, WL_DRM_FORMAT,
			       WL_DRM_FORMAT_XRGB8888);
        wl_resource_post_event(resource, WL_DRM_FORMAT, WL_DRM_FORMAT_YUV410);
        wl_resource_post_event(resource, WL_DRM_FORMAT, WL_DRM_FORMAT_YUV411);
        wl_resource_post_event(resource, WL_DRM_FORMAT, WL_DRM_FORMAT_YUV420);
        wl_resource_post_event(resource, WL_DRM_FORMAT, WL_DRM_FORMAT_YUV422);
        wl_resource_post_event(resource, WL_DRM_FORMAT, WL_DRM_FORMAT_YUV444);
        wl_resource_post_event(resource, WL_DRM_FORMAT, WL_DRM_FORMAT_NV12);
        wl_resource_post_event(resource, WL_DRM_FORMAT, WL_DRM_FORMAT_NV16);
        wl_resource_post_event(resource, WL_DRM_FORMAT, WL_DRM_FORMAT_YUYV);

        capabilities = 0;
        if (drm->flags & WAYLAND_DRM_PRIME)
           capabilities |= WL_DRM_CAPABILITY_PRIME;

        if (version >= 2)
           wl_resource_post_event(resource, WL_DRM_CAPABILITIES, capabilities);
}
static void
seat_get_pointer (struct wl_client *client,
                  struct wl_resource *resource,
                  uint32_t id)
{
  ClaylandSeat *seat = wl_resource_get_user_data (resource);
  struct wl_resource *cr;

  cr = wl_client_add_object (client, &wl_pointer_interface,
                             &pointer_interface, id, seat);
  wl_list_insert (&seat->pointer.resource_list, wl_resource_get_link (cr));
  wl_resource_set_destructor (cr, unbind_resource);

  if (seat->pointer.focus &&
      wl_resource_get_client (seat->pointer.focus->resource) == client)
    {
      ClaylandSurface *surface;
      wl_fixed_t sx, sy;

      surface = (ClaylandSurface *) seat->pointer.focus;
      transform_stage_point_fixed (surface,
                                   seat->pointer.x,
                                   seat->pointer.y,
                                   &sx, &sy);
      clayland_pointer_set_focus (&seat->pointer,
                                  seat->pointer.focus,
                                  sx, sy);
    }
}
Exemple #3
0
static void
bind_manager(struct wl_client *client,
	     void *data, uint32_t version, uint32_t id)
{
	wl_client_add_object(client, &wl_data_device_manager_interface,
			     &manager_interface, id, NULL);
}
Exemple #4
0
static void
get_shell_surface (struct wl_client *client,
                   struct wl_resource *resource,
                   uint32_t id,
                   struct wl_resource *surface_resource)
{
  CoglandSurface *surface = wl_resource_get_user_data (surface_resource);
  CoglandShellSurface *shell_surface;

  if (surface->has_shell_surface)
    {
      wl_resource_post_error (surface_resource,
                              WL_DISPLAY_ERROR_INVALID_OBJECT,
                              "wl_shell::get_shell_surface already requested");
      return;
    }

  shell_surface = g_new0 (CoglandShellSurface, 1);

  shell_surface->surface = surface;
  shell_surface->surface_destroy_listener.notify =
    shell_handle_surface_destroy;
  wl_signal_add (&surface->destroy_signal,
                 &shell_surface->surface_destroy_listener);

  surface->has_shell_surface = TRUE;

  shell_surface->resource = wl_client_add_object (client,
                                                  &wl_shell_surface_interface,
                                                  &cogl_shell_surface_interface,
                                                  id,
                                                  shell_surface);
  wl_resource_set_destructor (shell_surface->resource,
                              destroy_shell_surface_cb);
}
Exemple #5
0
static void
bind_output (struct wl_client *client,
             void *data,
             uint32_t version,
             uint32_t id)
{
  CoglandOutput *output = data;
  struct wl_resource *resource =
    wl_client_add_object (client, &wl_output_interface, NULL, id, data);
  GList *l;

  wl_resource_post_event (resource,
                          WL_OUTPUT_GEOMETRY,
                          output->x, output->y,
                          output->width_mm,
                          output->height_mm,
                          0, /* subpixel: unknown */
                          "unknown", /* make */
                          "unknown"); /* model */

  for (l = output->modes; l; l = l->next)
    {
      CoglandMode *mode = l->data;
      wl_resource_post_event (resource,
                              WL_OUTPUT_MODE,
                              mode->flags,
                              mode->width,
                              mode->height,
                              mode->refresh);
    }
}
Exemple #6
0
static void
cogland_compositor_create_surface (struct wl_client *wayland_client,
                                   struct wl_resource *wayland_compositor_resource,
                                   uint32_t id)
{
  CoglandCompositor *compositor =
    wl_resource_get_user_data (wayland_compositor_resource);
  CoglandSurface *surface = g_slice_new0 (CoglandSurface);

  surface->compositor = compositor;

  wl_signal_init (&surface->destroy_signal);

  surface->resource = wl_client_add_object (wayland_client,
                                            &wl_surface_interface,
                                            &cogland_surface_interface,
                                            id,
                                            surface);
  wl_resource_set_destructor (surface->resource,
                              cogland_surface_resource_destroy_cb);

  surface->pending.buffer_destroy_listener.notify =
    surface_handle_pending_buffer_destroy;
  wl_list_init (&surface->pending.frame_callback_list);
  region_init (&surface->pending.damage);

  compositor->surfaces = g_list_prepend (compositor->surfaces,
                                         surface);
}
static void
seat_get_keyboard (struct wl_client *client,
                   struct wl_resource *resource,
                   uint32_t id)
{
  ClaylandSeat *seat = wl_resource_get_user_data (resource);
  struct wl_resource *cr;

  cr = wl_client_add_object (client, &wl_keyboard_interface, NULL, id, seat);
  wl_list_insert (&seat->keyboard.resource_list, wl_resource_get_link (cr));
  wl_resource_set_destructor (cr, unbind_resource);

  wl_keyboard_send_keymap (cr,
                           WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1,
                           seat->keyboard.xkb_info.keymap_fd,
                           seat->keyboard.xkb_info.keymap_size);

  if (seat->keyboard.focus &&
      wl_resource_get_client (seat->keyboard.focus->resource) == client)
    {
      clayland_keyboard_set_focus (&seat->keyboard,
                                   seat->keyboard.focus);
      clayland_data_device_set_keyboard_focus (seat);
    }
}
DataSource::DataSource(struct wl_client *client, uint32_t id, uint32_t time)
    : m_time(time)
{
    m_data_source_resource = wl_client_add_object(client, &wl_data_source_interface, &DataSource::data_source_interface,id,this);
    m_data_source_resource->destroy = resource_destroy;
    m_data_offer = new DataOffer(this);
    m_manager = 0;
}
Exemple #9
0
void TouchExtensionGlobal::bind_func(wl_client *client, void *data, uint32_t version, uint32_t id)
{
    Q_UNUSED(version);
    wl_resource *resource = wl_client_add_object(client, &qt_touch_extension_interface, &touch_interface, id, data);
    resource->destroy = destroy_resource;
    TouchExtensionGlobal *self = static_cast<TouchExtensionGlobal *>(resource->data);
    self->m_resources.append(resource);
    qt_touch_extension_send_configure(resource, self->m_flags);
}
Exemple #10
0
void Compositor::bindShell(wl_client *client, void *compositorData, uint32_t version, uint32_t id)
{
    static const struct wl_shell_interface shellInterface = {
        get_shell_surface
    };

    Q_UNUSED(version);
    wl_client_add_object(client, &wl_shell_interface, &shellInterface, id, compositorData);
}
Exemple #11
0
static void
bind_shell (struct wl_client *client,
            void *data,
            uint32_t version,
            uint32_t id)
{
  wl_client_add_object (client, &wl_shell_interface,
                        &cogland_shell_interface, id, data);
}
Exemple #12
0
void Compositor::bindCompositor(wl_client *client, void *compositorData, uint32_t version, uint32_t id)
{
    static const struct wl_compositor_interface compositorInterface = {
        compositor_create_surface,
        compositor_create_region
    };

    Q_UNUSED(version);
    wl_client_add_object(client, &wl_compositor_interface, &compositorInterface, id, compositorData);
}
Exemple #13
0
DataDevice::DataDevice(DataDeviceManager *data_device_manager, struct wl_client *client, uint32_t id)
    : m_data_device_manager(data_device_manager)
    , m_sent_selection_time(0)
{

    //static int i = 0;
    //qDebug() << "data device" << ++i;
    m_data_device_resource =
            wl_client_add_object(client,&wl_data_device_interface,&data_device_interface,id, this);
}
Exemple #14
0
SubSurface::SubSurface(wl_client *client, uint32_t id, Surface *surface)
    : m_surface(surface)
    , m_parent(0)
{
    surface->setSubSurface(this);
    m_sub_surface_resource = wl_client_add_object(client,
                                                       &qt_sub_surface_interface,
                                                       &sub_surface_interface,
                                                       id,
                                                       this);
}
Exemple #15
0
static void
compositor_bind (struct wl_client *client,
                 void *data,
                 uint32_t version,
                 uint32_t id)
{
  CoglandCompositor *compositor = data;

  wl_client_add_object (client, &wl_compositor_interface,
                        &cogland_compositor_interface, id, compositor);
}
ShellSurface::ShellSurface(wl_client *client, uint32_t id, Surface *surface)
    : m_surface(surface)
    , m_resizeGrabber(0)
    , m_moveGrabber(0)
    , m_transientParent(0)
    , m_xOffset(0)
    , m_yOffset(0)
{
    m_shellSurface = wl_client_add_object(client,&wl_shell_surface_interface,&shell_surface_interface,id,this);
    surface->setShellSurface(this);
}
Exemple #17
0
void Compositor::bindOutput(wl_client *client, void *compositorData, uint32_t version, uint32_t id)
{
    Q_UNUSED(version);

    wl_resource *resource = wl_client_add_object(client, &wl_output_interface, 0, id, compositorData);

    Compositor *compositor = static_cast<Compositor *>(compositorData);
    registerResource(&compositor->m_outputResources, resource);

    compositor->sendOutputGeometry(resource);
    compositor->sendOutputMode(resource);
}
ExtendedOutput::ExtendedOutput(struct wl_client *client, uint32_t id, Output *output, Compositor *compositor)
    : m_output(output)
    , m_compositor(compositor)
{
    static const struct wl_extended_output_interface extended_output_interface = {
        set_orientation_update_mask
    };
    Q_ASSERT(m_output->extendedOutput() == 0);
    m_output->setExtendedOutput(this);
    m_extended_output_resource = wl_client_add_object(client,&wl_extended_output_interface,&extended_output_interface,id,this);
    m_extended_output_resource->destroy = ExtendedOutput::destroy_resource;

    sendOutputOrientation(m_compositor->screenOrientation());
}
Exemple #19
0
static void
bind_drm(struct wl_client *client, void *data, uint32_t version, uint32_t id)
{
	struct wl_drm *drm = data;
	struct wl_resource *resource;

	resource = wl_client_add_object(client, &wl_drm_interface,
					&drm_interface, id, data);
	wl_resource_post_event(resource, WL_DRM_DEVICE, drm->device_name);
	wl_resource_post_event(resource, WL_DRM_FORMAT,
			       WL_DRM_FORMAT_ARGB8888);
	wl_resource_post_event(resource, WL_DRM_FORMAT,
			       WL_DRM_FORMAT_XRGB8888);
}
Exemple #20
0
static void
get_data_device(struct wl_client *client,
		struct wl_resource *manager_resource,
		uint32_t id, struct wl_resource *input_device)
{
	struct wl_input_device *device = input_device->data;
	struct wl_resource *resource;

	resource =
		wl_client_add_object(client, &wl_data_device_interface,
				     &data_device_interface, id, device);
				     
	wl_list_insert(&device->drag_resource_list, &resource->link);
	resource->destroy = unbind_data_device;
}
Exemple #21
0
/* local functions */
static void
_e_mod_comp_wl_output_bind(struct wl_client *client, void *data, uint32_t version __UNUSED__, uint32_t id)
{
   Wayland_Output *output;
   struct wl_resource *resource;

   LOGFN(__FILE__, __LINE__, __FUNCTION__);

   if (!(output = data)) return;
   resource =
     wl_client_add_object(client, &wl_output_interface, NULL, id, data);
   wl_resource_post_event(resource, WL_OUTPUT_GEOMETRY, output->x, output->y,
                          output->w, output->h, output->subpixel,
                          output->make, output->model);
   wl_resource_post_event(resource, WL_OUTPUT_MODE, output->mode.flags,
                          output->mode.w, output->mode.h, output->mode.refresh);
}
Exemple #22
0
static void
cogland_compositor_create_region (struct wl_client *wayland_client,
                                  struct wl_resource *compositor_resource,
                                  uint32_t id)
{
  CoglandSharedRegion *region = g_slice_new0 (CoglandSharedRegion);

  region->resource = wl_client_add_object (wayland_client,
                                           &wl_region_interface,
                                           &cogland_region_interface,
                                           id,
                                           region);
  wl_resource_set_destructor (region->resource,
                              cogland_region_resource_destroy_cb);

  region_init (&region->region);
}
Exemple #23
0
static void get_shell_surface(wl_client *client, wl_resource *compositorResource, uint32_t id, wl_resource *surfaceResource)
{
    static const struct wl_shell_surface_interface shellSurfaceInterface = {
        shell_surface_pong,
        shell_surface_move,
        shell_surface_resize,
        shell_surface_set_toplevel,
        shell_surface_set_transient,
        shell_surface_set_fullscreen,
        shell_surface_set_popup,
        shell_surface_set_maximized,
        shell_surface_set_title,
        shell_surface_set_class
    };

    Q_UNUSED(compositorResource);
    wl_client_add_object(client, &wl_shell_surface_interface, &shellSurfaceInterface, id, surfaceResource->data);
}
Exemple #24
0
static void
cogland_surface_frame (struct wl_client *client,
                       struct wl_resource *surface_resource,
                       uint32_t callback_id)
{
  CoglandFrameCallback *callback;
  CoglandSurface *surface = wl_resource_get_user_data (surface_resource);

  callback = g_slice_new0 (CoglandFrameCallback);
  callback->compositor = surface->compositor;
  callback->resource = wl_client_add_object (client,
                                             &wl_callback_interface,
                                             NULL, /* no implementation */
                                             callback_id,
                                             callback);
  wl_resource_set_destructor (callback->resource, destroy_frame_callback);

  wl_list_insert (surface->pending.frame_callback_list.prev, &callback->link);
}
static void
bind_seat (struct wl_client *client,
           void *data,
           guint32 version,
           guint32 id)
{
  ClaylandSeat *seat = data;
  struct wl_resource *resource;

  resource = wl_client_add_object (client,
                                   &wl_seat_interface,
                                   &seat_interface,
                                   id,
                                   data);
  wl_list_insert (&seat->base_resource_list,
                  wl_resource_get_link (resource));
  wl_resource_set_destructor (resource, unbind_resource);

  wl_seat_send_capabilities (resource,
                             WL_SEAT_CAPABILITY_POINTER |
                             WL_SEAT_CAPABILITY_KEYBOARD);
}
Exemple #26
0
static void
bind_xserver(struct wl_client *client,
	     void *data, uint32_t version, uint32_t id)
{
	struct weston_xserver *wxs = data;

	/* If it's a different client than the xserver we launched,
	 * don't start the wm. */
	if (client != wxs->client)
		return;

	wxs->resource = 
		wl_client_add_object(client, &xserver_interface,
				     &xserver_implementation, id, wxs);

	wxs->wm = weston_wm_create(wxs);
	if (wxs->wm == NULL) {
		weston_log("failed to create wm\n");
	}

	xserver_send_listen_socket(wxs->resource, wxs->abstract_fd);
	xserver_send_listen_socket(wxs->resource, wxs->unix_fd);
}
Exemple #27
0
void Compositor::bind_func(struct wl_client *client, void *data,
                           uint32_t version, uint32_t id)
{
    Q_UNUSED(version);
    wl_client_add_object(client,&wl_compositor_interface, &compositor_interface, id,data);
}
Exemple #28
0
void SubSurfaceExtensionGlobal::bind_func(wl_client *client, void *data, uint32_t version, uint32_t id)
{
    Q_UNUSED(version);
    wl_client_add_object(client, &qt_sub_surface_extension_interface,&sub_surface_extension_interface,id,data);
}
void Shell::bind_func(struct wl_client *client, void *data,
                            uint32_t version, uint32_t id)
{
    Q_UNUSED(version);
    wl_client_add_object(client,&wl_shell_interface,&shell_interface,id,data);
}
void DataDeviceManager::bind_func_drag(struct wl_client *client, void *data, uint32_t version, uint32_t id)
{
    Q_UNUSED(version);
    wl_client_add_object(client,&wl_data_device_manager_interface,&drag_interface,id,data);
}