summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wayland/qwaylandwindow.cpp
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@nokia.com>2011-01-21 15:52:02 +0100
committerJørgen Lind <jorgen.lind@nokia.com>2011-01-26 14:16:09 +0100
commit9075d224afb736e14014d5fa8001be03f79df267 (patch)
tree31fbf945de4db0c0d11bda13635916b595576fef /src/plugins/platforms/wayland/qwaylandwindow.cpp
parenta2d208c04a7db02f260be5b3e0ea82c769f69c0c (diff)
Making clearer separation between responsibility of different classes
Ie. Moving code into different files and refactoring some of the classes. The Drmbuffer was most affected. It has a depth and stencil buffer. QWaylandGLContext contain the context. The drm buffer class has to be bound to the context before used.
Diffstat (limited to 'src/plugins/platforms/wayland/qwaylandwindow.cpp')
-rw-r--r--src/plugins/platforms/wayland/qwaylandwindow.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp
index 4f696b05b..fa62330a6 100644
--- a/src/plugins/platforms/wayland/qwaylandwindow.cpp
+++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp
@@ -42,15 +42,19 @@
#include "qwaylandwindow.h"
#include "qwaylanddisplay.h"
-#include "qwaylandwindowsurface.h"
#include "qwaylandglcontext.h"
+#include "qwaylandbuffer.h"
+
+#include "qwaylanddrmsurface.h"
#include <QtGui/QWidget>
#include <QtGui/QWindowSystemInterface>
+#include <QDebug>
+
QWaylandWindow::QWaylandWindow(QWidget *window, QWaylandDisplay *display)
: QPlatformWindow(window)
- , mSurface(0)
+ , mSurface(display->createSurface())
, mDisplay(display)
, mGLContext(0)
, mBuffer(0)
@@ -81,9 +85,8 @@ void QWaylandWindow::setParent(const QPlatformWindow *parent)
void QWaylandWindow::setVisible(bool visible)
{
if (visible) {
- mSurface = mDisplay->createSurface();
wl_surface_set_user_data(mSurface, this);
- attach(mBuffer);
+ wl_surface_map_toplevel(mSurface);
} else {
wl_surface_destroy(mSurface);
mSurface = NULL;
@@ -92,12 +95,8 @@ void QWaylandWindow::setVisible(bool visible)
void QWaylandWindow::attach(QWaylandBuffer *buffer)
{
- QRect geometry = widget()->geometry();
-
- mBuffer = buffer;
if (mSurface) {
- wl_surface_attach(mSurface, mBuffer->mBuffer,geometry.x(),geometry.y());
- wl_surface_map_toplevel(mSurface);
+ wl_surface_attach(mSurface, buffer->buffer(),0,0);
}
}
@@ -111,3 +110,13 @@ void QWaylandWindow::configure(uint32_t time, uint32_t edges,
QWindowSystemInterface::handleGeometryChange(widget(), geometry);
}
+
+QPlatformGLContext *QWaylandWindow::glContext() const
+{
+ if (!mGLContext) {
+ QWaylandWindow *that = const_cast<QWaylandWindow *>(this);
+ that->mGLContext = new QWaylandGLContext(mDisplay, widget()->platformWindowFormat());
+ }
+
+ return mGLContext;
+}