Fix Wayland plugin so it works with the wayland bind api

This is mostly for the xcomposite api, but also we needed to readEvents
after doing a connect
(cherry picked from commit 16c054125949b8f8ceec9626156d8790254a63a2)
This commit is contained in:
Jørgen Lind 2011-05-03 08:57:49 +02:00 committed by Paul Olav Tvete
parent 1e3e3980da
commit 03aafc9d48
5 changed files with 26 additions and 50 deletions

View File

@ -111,9 +111,9 @@ const struct wl_xcomposite_listener QWaylandXCompositeEGLIntegration::xcomposite
void QWaylandXCompositeEGLIntegration::wlDisplayHandleGlobal(wl_display *display, uint32_t id, const char *interface, uint32_t version, void *data)
{
Q_UNUSED(version);
if (strcmp(interface, "xcomposite") == 0) {
if (strcmp(interface, "wl_xcomposite") == 0) {
QWaylandXCompositeEGLIntegration *integration = static_cast<QWaylandXCompositeEGLIntegration *>(data);
integration->mWaylandComposite = wl_xcomposite_create(display,id);
integration->mWaylandComposite = wl_xcomposite_create(display,id,1);
wl_xcomposite_add_listener(integration->mWaylandComposite,&xcomposite_listener,integration);
}

View File

@ -106,9 +106,9 @@ const struct wl_xcomposite_listener QWaylandXCompositeGLXIntegration::xcomposite
void QWaylandXCompositeGLXIntegration::wlDisplayHandleGlobal(wl_display *display, uint32_t id, const char *interface, uint32_t version, void *data)
{
Q_UNUSED(version);
if (strcmp(interface, "xcomposite") == 0) {
if (strcmp(interface, "wl_xcomposite") == 0) {
QWaylandXCompositeGLXIntegration *integration = static_cast<QWaylandXCompositeGLXIntegration *>(data);
integration->mWaylandComposite = wl_xcomposite_create(display,id);
integration->mWaylandComposite = wl_xcomposite_create(display,id,1);
wl_xcomposite_add_listener(integration->mWaylandComposite,&xcomposite_listener,integration);
}

View File

@ -39,7 +39,6 @@
**
****************************************************************************/
#ifndef XCOMPOSITE_CLIENT_PROTOCOL_H
#define XCOMPOSITE_CLIENT_PROTOCOL_H
@ -55,84 +54,63 @@ struct wl_client;
struct wl_xcomposite;
struct wl_proxy;
extern void
wl_proxy_marshal(struct wl_proxy *p, uint32_t opcode, ...);
extern struct wl_proxy *
wl_proxy_create(struct wl_proxy *factory,
const struct wl_interface *interface);
extern struct wl_proxy *
wl_proxy_create_for_id(struct wl_display *display,
const struct wl_interface *interface, uint32_t id);
extern void
wl_proxy_destroy(struct wl_proxy *proxy);
extern int
wl_proxy_add_listener(struct wl_proxy *proxy,
void (**implementation)(void), void *data);
extern void
wl_proxy_set_user_data(struct wl_proxy *proxy, void *user_data);
extern void *
wl_proxy_get_user_data(struct wl_proxy *proxy);
extern const struct wl_interface wl_xcomposite_interface;
struct wl_xcomposite_listener {
void (*root)(void *data,
struct wl_xcomposite *xcomposite,
struct wl_xcomposite *wl_xcomposite,
const char *display_name,
uint32_t root_window);
};
static inline int
wl_xcomposite_add_listener(struct wl_xcomposite *xcomposite,
const struct wl_xcomposite_listener *listener, void *data)
wl_xcomposite_add_listener(struct wl_xcomposite *wl_xcomposite,
const struct wl_xcomposite_listener *listener, void *data)
{
return wl_proxy_add_listener((struct wl_proxy *) xcomposite,
return wl_proxy_add_listener((struct wl_proxy *) wl_xcomposite,
(void (**)(void)) listener, data);
}
#define WL_XCOMPOSITE_CREATE_BUFFER 0
static inline struct wl_xcomposite *
wl_xcomposite_create(struct wl_display *display, uint32_t id)
wl_xcomposite_create(struct wl_display *display, uint32_t id, uint32_t version)
{
wl_display_bind(display, id, "wl_xcomposite", version);
return (struct wl_xcomposite *)
wl_proxy_create_for_id(display, &wl_xcomposite_interface, id);
}
static inline void
wl_xcomposite_set_user_data(struct wl_xcomposite *xcomposite, void *user_data)
wl_xcomposite_set_user_data(struct wl_xcomposite *wl_xcomposite, void *user_data)
{
wl_proxy_set_user_data((struct wl_proxy *) xcomposite, user_data);
wl_proxy_set_user_data((struct wl_proxy *) wl_xcomposite, user_data);
}
static inline void *
wl_xcomposite_get_user_data(struct wl_xcomposite *xcomposite)
wl_xcomposite_get_user_data(struct wl_xcomposite *wl_xcomposite)
{
return wl_proxy_get_user_data((struct wl_proxy *) xcomposite);
return wl_proxy_get_user_data((struct wl_proxy *) wl_xcomposite);
}
static inline void
wl_xcomposite_destroy(struct wl_xcomposite *xcomposite)
wl_xcomposite_destroy(struct wl_xcomposite *wl_xcomposite)
{
wl_proxy_destroy((struct wl_proxy *) xcomposite);
wl_proxy_destroy((struct wl_proxy *) wl_xcomposite);
}
static inline struct wl_buffer *
wl_xcomposite_create_buffer(struct wl_xcomposite *xcomposite, uint32_t x_window, int width, int height, struct wl_visual *visual)
wl_xcomposite_create_buffer(struct wl_xcomposite *wl_xcomposite, uint32_t x_window, int width, int height, struct wl_visual *visual)
{
struct wl_proxy *id;
id = wl_proxy_create((struct wl_proxy *) xcomposite,
id = wl_proxy_create((struct wl_proxy *) wl_xcomposite,
&wl_buffer_interface);
if (!id)
return NULL;
wl_proxy_marshal((struct wl_proxy *) xcomposite,
wl_proxy_marshal((struct wl_proxy *) wl_xcomposite,
WL_XCOMPOSITE_CREATE_BUFFER, id, x_window, width, height, visual);
return (struct wl_buffer *) id;

View File

@ -43,17 +43,17 @@
#include <stdint.h>
#include "wayland-util.h"
static const struct wl_message xcomposite_requests[] = {
static const struct wl_message wl_xcomposite_requests[] = {
{ "create_buffer", "nuiio" },
};
static const struct wl_message xcomposite_events[] = {
static const struct wl_message wl_xcomposite_events[] = {
{ "root", "su" },
};
WL_EXPORT const struct wl_interface wl_xcomposite_interface = {
"xcomposite", 1,
ARRAY_LENGTH(xcomposite_requests), xcomposite_requests,
ARRAY_LENGTH(xcomposite_events), xcomposite_events,
"wl_xcomposite", 1,
ARRAY_LENGTH(wl_xcomposite_requests), wl_xcomposite_requests,
ARRAY_LENGTH(wl_xcomposite_events), wl_xcomposite_events,
};

View File

@ -126,6 +126,7 @@ QWaylandDisplay::QWaylandDisplay(void)
#ifdef QT_WAYLAND_GL_SUPPORT
mEglIntegration = QWaylandGLIntegration::createGLIntegration(this);
#endif
blockingReadEvents();
qRegisterMetaType<uint32_t>("uint32_t");
@ -216,9 +217,6 @@ void QWaylandDisplay::outputHandleGeometry(void *data,
int32_t x, int32_t y,
int32_t width, int32_t height)
{
//call back function called from another thread;
//but its safe to call createScreen from another thread since
//QWaylandScreen does a moveToThread
QWaylandDisplay *waylandDisplay = static_cast<QWaylandDisplay *>(data);
QRect outputRect = QRect(x, y, width, height);
waylandDisplay->createNewScreen(output,outputRect);