#include "waylandsurfaceitem.h"
#endif
-WaylandCompositor::WaylandCompositor(QWindow *topLevelWidget, QGLContext *context, const char *socketName)
+WaylandCompositor::WaylandCompositor(QWindow *window, QGLContext *context, const char *socketName)
: m_compositor(0)
, m_glContext(context)
- , m_toplevel_widget(topLevelWidget)
+ , m_toplevel_widget(window)
, m_socket_name(socketName)
{
QStringList arguments = QCoreApplication::instance()->arguments();
return m_glContext;
}
-QWindow * WaylandCompositor::topLevelWidget() const
+QWindow * WaylandCompositor::window() const
{
return m_toplevel_widget;
}
class WaylandCompositor
{
public:
- WaylandCompositor(QWindow *topLevelWidget = 0, QGLContext *context = 0, const char *socketName = 0);
+ WaylandCompositor(QWindow *window = 0, QGLContext *context = 0, const char *socketName = 0);
virtual ~WaylandCompositor();
void frameFinished(WaylandSurface *surface = 0);
WaylandSurface *directRenderSurface() const;
QGLContext *glContext() const;
- QWindow *topLevelWidget()const;
+ QWindow *window()const;
virtual void surfaceCreated(WaylandSurface *surface) = 0;
class DrmObject : public Wayland::Object<struct wl_object>
{
public:
- DrmObject(Wayland::Compositor *compositor, QWidget *topLevelWidget)
+ DrmObject(Wayland::Compositor *compositor, QWidget *window)
:m_compositor(compositor)
{
QPlatformNativeInterface *nativeInterface = QApplicationPrivate::platformIntegration()->nativeInterface();
- char *deviceName = static_cast<char *>(nativeInterface->nativeResourceForWidget("GraphicsDevice",topLevelWidget));
+ char *deviceName = static_cast<char *>(nativeInterface->nativeResourceForWidget("GraphicsDevice",window));
m_device_name = QByteArray(deviceName);
- m_connection = static_cast<xcb_connection_t *>(nativeInterface->nativeResourceForWidget("Connection",topLevelWidget));
- m_egl_display = static_cast<EGLDisplay>(nativeInterface->nativeResourceForWidget("EglDisplay",topLevelWidget));
+ m_connection = static_cast<xcb_connection_t *>(nativeInterface->nativeResourceForWidget("Connection",window));
+ m_egl_display = static_cast<EGLDisplay>(nativeInterface->nativeResourceForWidget("EglDisplay",window));
}
QByteArray deviceName()
{
void Dri2XcbHWIntegration::initializeHardware(Wayland::Display *waylandDisplay)
{
//we need a winId now.
- m_compositor->topLevelWidget()->winId();
+ m_compositor->window()->winId();
- m_drm_object = new DrmObject(m_compositor->handle(),m_compositor->topLevelWidget());
+ m_drm_object = new DrmObject(m_compositor->handle(),m_compositor->window());
waylandDisplay->addGlobalObject(m_drm_object->base(),&wl_drm_interface,&drm_interface,post_drm_device);
}
{
Q_D(MesaEglIntegration);
//We need a window id now :)
- m_compositor->topLevelWidget()->winId();
+ m_compositor->window()->winId();
QPlatformNativeInterface *nativeInterface = QApplicationPrivate::platformIntegration()->nativeInterface();
if (nativeInterface) {
- d->egl_display = nativeInterface->nativeResourceForWindow("EglDisplay", m_compositor->topLevelWidget()->windowHandle());
+ d->egl_display = nativeInterface->nativeResourceForWindow("EglDisplay", m_compositor->window()->windowHandle());
if (d->egl_display) {
const char *extensionString = eglQueryString(d->egl_display, EGL_EXTENSIONS);
if (extensionString && strstr(extensionString, "EGL_WL_bind_wayland_display")
{
QPlatformNativeInterface *nativeInterface = QApplication::platformNativeInterface();
if (nativeInterface) {
- mDisplay = static_cast<Display *>(nativeInterface->nativeResourceForWidget("Display",m_compositor->topLevelWidget()));
+ mDisplay = static_cast<Display *>(nativeInterface->nativeResourceForWidget("Display",m_compositor->window()));
if (!mDisplay)
qFatal("could not retireve Display from platform integration");
- mEglDisplay = static_cast<EGLDisplay>(nativeInterface->nativeResourceForWidget("EGLDisplay",m_compositor->topLevelWidget()));
+ mEglDisplay = static_cast<EGLDisplay>(nativeInterface->nativeResourceForWidget("EGLDisplay",m_compositor->window()));
if (!mEglDisplay)
qFatal("could not retrieve EGLDisplay from plaform integration");
} else {
void XCompositeEglIntegration::initializeHardware(Wayland::Display *waylandDisplay)
{
- XCompositeHandler *handler = new XCompositeHandler(m_compositor->handle(),mDisplay,m_compositor->topLevelWidget());
+ XCompositeHandler *handler = new XCompositeHandler(m_compositor->handle(),mDisplay,m_compositor->window());
waylandDisplay->addGlobalObject(handler->base(), &wl_xcomposite_interface, &XCompositeHandler::xcomposite_interface,XCompositeHandler::send_root_information);
}
{
QPlatformNativeInterface *nativeInterface = QGuiApplicationPrivate::platformIntegration()->nativeInterface();
if (nativeInterface) {
- mDisplay = static_cast<Display *>(nativeInterface->nativeResourceForWindow("Display",m_compositor->topLevelWidget()->windowHandle()));
+ mDisplay = static_cast<Display *>(nativeInterface->nativeResourceForWindow("Display",m_compositor->window()));
if (!mDisplay)
qFatal("could not retireve Display from platform integration");
} else {
void XCompositeGLXIntegration::initializeHardware(Wayland::Display *waylandDisplay)
{
- XCompositeHandler *handler = new XCompositeHandler(m_compositor->handle(),mDisplay,m_compositor->topLevelWidget());
+ XCompositeHandler *handler = new XCompositeHandler(m_compositor->handle(),mDisplay,m_compositor->window());
waylandDisplay->addGlobalObject(handler->base(), &wl_xcomposite_interface, &XCompositeHandler::xcomposite_interface,XCompositeHandler::send_root_information);
QGuiGLContext *glContext = new QGuiGLContext();
#include "xcompositebuffer.h"
#include <X11/extensions/Xcomposite.h>
-XCompositeHandler::XCompositeHandler(Wayland::Compositor *compositor, Display *display, QWidget *topLevelWidget)
+XCompositeHandler::XCompositeHandler(Wayland::Compositor *compositor, Display *display, QWindow *window)
: mCompositor(compositor)
- , mTopLevelWidget(topLevelWidget)
+ , mwindow(window)
, mDisplay(display)
{
- mFakeRootWidget = new QWidget(mCompositor->topLevelWidget());
- mFakeRootWidget->setGeometry(-1,-1,1,1);
- mFakeRootWidget->setAttribute(Qt::WA_NativeWindow);
+ mFakeRootWidget = new QWindow(mCompositor->window());
+ mFakeRootWidget->setGeometry(QRect(-1,-1,1,1));
int composite_event_base, composite_error_base;
if (XCompositeQueryExtension(mDisplay, &composite_event_base, &composite_error_base)) {
class XCompositeHandler : public Wayland::Object<struct wl_object>
{
public:
- XCompositeHandler(Wayland::Compositor *compositor, Display *display, QWidget *topLevelWidget);
+ XCompositeHandler(Wayland::Compositor *compositor, Display *display, QWindow *window);
void createBuffer(struct wl_client *client, uint32_t id, Window window, const QSize &size, struct wl_visual *visual);
static void send_root_information(struct wl_client *client, struct wl_object *global, uint32_t version);
private:
Wayland::Compositor *mCompositor;
- QWidget *mTopLevelWidget;
- QWidget *mFakeRootWidget;
+ QWindow *mwindow;
+ QWindow *mFakeRootWidget;
Display *mDisplay;
static void create_buffer(struct wl_client *client,
m_shm.addDestroyCallback(shmBufferDestroyed);
#if defined (QT_COMPOSITOR_WAYLAND_GL)
- QWindow *window = qt_compositor->topLevelWidget()->windowHandle();
+ QWindow *window = qt_compositor->window();
if (window && window->surfaceType() != QWindow::RasterSurface)
m_graphics_hw_integration = GraphicsHardwareIntegration::createGraphicsHardwareIntegration(qt_compositor);
#endif
return m_pointerFocusSurface;
}
-QWidget * Compositor::topLevelWidget() const
+QWindow *Compositor::window() const
{
- return m_qt_compositor->topLevelWidget();
+ return m_qt_compositor->window();
}
GraphicsHardwareIntegration * Compositor::graphicsHWIntegration() const
class WaylandCompositor;
class GraphicsHardwareIntegration;
-class QWidget;
class WindowManagerServerIntegration;
namespace Wayland {
static uint currentTimeMsecs();
- QWidget *topLevelWidget() const;
+ QWindow *window() const;
GraphicsHardwareIntegration *graphicsHWIntegration() const;
void initializeHardwareIntegration();