Example #1
0
static void
display_handle_global(struct wl_display *display, uint32_t id,
		      const char *interface, uint32_t version, void *data)
{
	struct display *d = data;

	if (strcmp(interface, "compositor") == 0) {
		d->compositor = wl_compositor_create(display, id);
	} else if (strcmp(interface, "output") == 0) {
		d->output = wl_output_create(display, id);
		wl_output_add_listener(d->output, &output_listener, d);
	} else if (strcmp(interface, "input_device") == 0) {
		display_add_input(d, id);
	} else if (strcmp(interface, "shell") == 0) {
		d->shell = wl_shell_create(display, id);
		wl_shell_add_listener(d->shell, &shell_listener, d);
	} else if (strcmp(interface, "drm") == 0) {
		d->drm = wl_drm_create(display, id);
		wl_drm_add_listener(d->drm, &drm_listener, d);
	} else if (strcmp(interface, "shm") == 0) {
		d->shm = wl_shm_create(display, id);
	} else if (strcmp(interface, "selection_offer") == 0) {
		add_selection_offer(d, id);
	} else if (d->global_handler) {
		d->global_handler(d, interface, id, version);
	}
}
Example #2
0
void QWaylandDisplay::displayHandleGlobal(uint32_t id,
        const QByteArray &interface,
        uint32_t version)
{
    Q_UNUSED(version);
    if (interface == "wl_output") {
        struct wl_output *output = wl_output_create(mDisplay, id, 1);
        wl_output_add_listener(output, &outputListener, this);
    } else if (interface == "wl_compositor") {
        mCompositor = wl_compositor_create(mDisplay, id, 1);
        wl_compositor_add_listener(mCompositor,
                                   &compositorListener, this);
    } else if (interface == "wl_shm") {
        mShm = wl_shm_create(mDisplay, id, 1);
    } else if (interface == "wl_shell") {
        mShell = wl_shell_create(mDisplay, id, 1);
        wl_shell_add_listener(mShell, &shellListener, this);
    } else if (interface == "wl_input_device") {
        QWaylandInputDevice *inputDevice =
            new QWaylandInputDevice(mDisplay, id);
        mInputDevices.append(inputDevice);
    } else if (interface == "wl_selection_offer") {
        QPlatformIntegration *plat = QApplicationPrivate::platformIntegration();
        QWaylandClipboard *clipboard = static_cast<QWaylandClipboard *>(plat->clipboard());
        clipboard->createSelectionOffer(id);
    }
}
Example #3
0
void QWaylandDisplay::displayHandleGlobal(uint32_t id,
                                          const QByteArray &interface,
                                          uint32_t version)
{
    Q_UNUSED(version);
    if (interface == "wl_output") {
        struct wl_output *output = wl_output_create(mDisplay, id, 1);
        wl_output_add_listener(output, &outputListener, this);
    } else if (interface == "wl_compositor") {
        mCompositor = wl_compositor_create(mDisplay, id, 1);
        wl_compositor_add_listener(mCompositor,
                                   &compositorListener, this);
    } else if (interface == "wl_shm") {
        mShm = wl_shm_create(mDisplay, id, 1);
    } else if (interface == "wl_shell"){
        mShell = wl_shell_create(mDisplay, id, 1);
        wl_shell_add_listener(mShell, &shellListener, this);
    } else if (interface == "wl_input_device") {
        QWaylandInputDevice *inputDevice =
            new QWaylandInputDevice(this, id);
        mInputDevices.append(inputDevice);
    } else if (interface == "wl_selection_offer") {
        QWaylandClipboard::instance(display)->createSelectionOffer(id);
    }
}
Example #4
0
static void
gdk_display_handle_global(struct wl_display *display, uint32_t id,
			  const char *interface, uint32_t version, void *data)
{
  GdkDisplayWayland *display_wayland = data;
  GdkDisplay *gdk_display = GDK_DISPLAY_OBJECT (data);
  struct wl_input_device *input;

  if (strcmp(interface, "wl_compositor") == 0) {
    display_wayland->compositor = wl_compositor_create(display, id, 1);
    wl_compositor_add_listener(display_wayland->compositor,
					   &compositor_listener, display_wayland);
  } else if (strcmp(interface, "wl_shm") == 0) {
    display_wayland->shm = wl_shm_create(display, id, 1);
  } else if (strcmp(interface, "wl_shell") == 0) {
    display_wayland->shell = wl_shell_create(display, id, 1);
    wl_shell_add_listener(display_wayland->shell,
			  &shell_listener, display_wayland);
  } else if (strcmp(interface, "wl_output") == 0) {
    display_wayland->output = wl_output_create(display, id, 1);
    wl_output_add_listener(display_wayland->output,
			   &output_listener, display_wayland);
  } else if (strcmp(interface, "wl_input_device") == 0) {
    input = wl_input_device_create(display, id, 1);
    _gdk_wayland_device_manager_add_device (gdk_display->device_manager,
					    input);
  }
}
Example #5
0
static void
display_handle_global (struct wl_display *display,
                       uint32_t id,
		       const char *interface,
                       uint32_t version,
                       void *data)
{
  ClutterBackendWayland *backend_wayland = data;

  if (strcmp (interface, "compositor") == 0)
    {
      backend_wayland->wayland_compositor = wl_compositor_create (display, id);
    }
  else if (strcmp (interface, "output") == 0)
    {
      backend_wayland->wayland_output = wl_output_create (display, id);
      wl_output_add_listener (backend_wayland->wayland_output,
                              &output_listener, backend_wayland);
    }
  else if (strcmp (interface, "input_device") == 0)
    {
      _clutter_backend_add_input_device (backend_wayland, id);
    }
  else if (strcmp (interface, "shell") == 0)
    {
      backend_wayland->wayland_shell = wl_shell_create (display, id);
      wl_shell_add_listener (backend_wayland->wayland_shell,
                             &shell_listener, backend_wayland);
    }
  else if (strcmp (interface, "drm") == 0)
    {
      backend_wayland->wayland_drm = wl_drm_create (display, id);
      wl_drm_add_listener (backend_wayland->wayland_drm,
                           &drm_listener, backend_wayland);
    }
  else if (strcmp (interface, "shm") == 0)
    {
      backend_wayland->wayland_shm = wl_shm_create (display, id);
    }
}