Qt 4.8
Public Functions | Protected Functions | Properties | List of all members
QWaylandEglWindow Class Reference

#include <qwaylandeglwindow.h>

Inheritance diagram for QWaylandEglWindow:
QWaylandWindow QPlatformWindow

Public Functions

QPlatformGLContextglContext () const
 Reimplement to return the glContext associated with the window. More...
 
 QWaylandEglWindow (QWidget *window)
 
void setGeometry (const QRect &rect)
 This function is called by Qt whenever a window is moved or the window is resized. More...
 
void setParent (const QPlatformWindow *parent)
 This function is called to enable native child widgets in QPA. More...
 
WindowType windowType () const
 
 ~QWaylandEglWindow ()
 
- Public Functions inherited from QWaylandWindow
void attach (QWaylandBuffer *buffer)
 
void configure (uint32_t time, uint32_t edges, int32_t x, int32_t y, int32_t width, int32_t height)
 
void damage (const QRect &rect)
 
 QWaylandWindow (QWidget *window)
 
void setParent (const QPlatformWindow *parent)
 This function is called to enable native child widgets in QPA. More...
 
void setVisible (bool visible)
 Reimplemented in subclasses to show the surface if visible is true, and hide it if visible is false. More...
 
void waitForFrameSync ()
 
WId winId () const
 Reimplement in subclasses to return a handle to the native window. More...
 
struct wl_surface * wl_surface () const
 
 ~QWaylandWindow ()
 
- Public Functions inherited from QPlatformWindow
virtual QRect geometry () const
 Returnes the current geometry of a window. More...
 
virtual void lower ()
 Reimplement to be able to let Qt lower windows to the bottom of the desktop. More...
 
 QPlatformWindow (QWidget *tlw)
 Constructs a platform window with the given top level widget. More...
 
virtual void raise ()
 Reimplement to be able to let Qt rais windows to the top of the desktop. More...
 
virtual void requestActivateWindow ()
 Reimplement to let Qt be able to request activation/focus for a window. More...
 
virtual void setOpacity (qreal level)
 Reimplement to be able to let Qt set the opacity level of a window. More...
 
virtual Qt::WindowFlags setWindowFlags (Qt::WindowFlags flags)
 Requests setting the window flags of this surface to type. More...
 
virtual void setWindowTitle (const QString &title)
 Reimplement to set the window title to title. More...
 
QWidgetwidget () const
 Returnes the widget which belongs to the QPlatformWindow. More...
 
virtual Qt::WindowFlags windowFlags () const
 Returns the effective window flags for this surface. More...
 
virtual ~QPlatformWindow ()
 Virtual destructor does not delete its top level widget. More...
 

Protected Functions

void newSurfaceCreated ()
 

Properties

QWaylandEglIntegrationmEglIntegration
 
QWaylandGLContextmGLContext
 
const QWaylandWindowmParentWindow
 
struct wl_egl_window * mWaylandEglWindow
 

Additional Inherited Members

- Public Types inherited from QWaylandWindow
enum  WindowType { Shm, Egl }
 
- Protected Variables inherited from QWaylandWindow
QWaylandBuffermBuffer
 
QWaylandDisplaymDisplay
 
QWaitCondition mFrameSyncWait
 
struct wl_surfacemSurface
 
bool mWaitingForFrameSync
 
WId mWindowId
 
- Protected Variables inherited from QPlatformWindow
QScopedPointer< QPlatformWindowPrivated_ptr
 

Detailed Description

Definition at line 51 of file qwaylandeglwindow.h.

Constructors and Destructors

◆ QWaylandEglWindow()

QWaylandEglWindow::QWaylandEglWindow ( QWidget window)

Definition at line 47 of file qwaylandeglwindow.cpp.

48  : QWaylandWindow(window)
49  , mGLContext(0)
51 {
52  mEglIntegration = static_cast<QWaylandEglIntegration *>(mDisplay->eglIntegration());
53  //super creates a new surface
55 }
QWaylandEglIntegration * mEglIntegration
struct wl_egl_window * mWaylandEglWindow
QWaylandGLContext * mGLContext
QWaylandWindow(QWidget *window)
QWaylandDisplay * mDisplay

◆ ~QWaylandEglWindow()

QWaylandEglWindow::~QWaylandEglWindow ( )

Definition at line 57 of file qwaylandeglwindow.cpp.

58 {
59  delete mGLContext;
60 }
QWaylandGLContext * mGLContext

Functions

◆ glContext()

QPlatformGLContext * QWaylandEglWindow::glContext ( ) const
virtual

Reimplement to return the glContext associated with the window.

Reimplemented from QPlatformWindow.

Definition at line 82 of file qwaylandeglwindow.cpp.

83 {
84  if (!mGLContext) {
85  QWaylandEglWindow *that = const_cast<QWaylandEglWindow *>(this);
86  that->mGLContext = new QWaylandGLContext(mEglIntegration->eglDisplay(),widget()->platformWindowFormat());
87 
88  EGLNativeWindowType window(reinterpret_cast<EGLNativeWindowType>(mWaylandEglWindow));
89  EGLSurface surface = eglCreateWindowSurface(mEglIntegration->eglDisplay(),mGLContext->eglConfig(),window,NULL);
90  that->mGLContext->setEglSurface(surface);
91  }
92 
93  return mGLContext;
94 }
QWaylandEglIntegration * mEglIntegration
NativeWindowType EGLNativeWindowType
Definition: qegl_p.h:116
NSWindow * window
void setEglSurface(EGLSurface surface)
struct wl_egl_window * mWaylandEglWindow
QWaylandGLContext * mGLContext
EGLConfig eglConfig() const
QWidget * widget() const
Returnes the widget which belongs to the QPlatformWindow.

◆ newSurfaceCreated()

void QWaylandEglWindow::newSurfaceCreated ( )
protectedvirtual

Reimplemented from QWaylandWindow.

Definition at line 96 of file qwaylandeglwindow.cpp.

Referenced by QWaylandEglWindow().

97 {
98  if (mWaylandEglWindow) {
99  wl_egl_window_destroy(mWaylandEglWindow);
100  }
101  wl_visual *visual = QWaylandScreen::waylandScreenFromWidget(widget())->visual();
102  QSize size = geometry().size();
103  if (!size.isValid())
104  size = QSize(0,0);
105 
106  mWaylandEglWindow = wl_egl_window_create(mSurface,size.width(),size.height(),visual);
107  if (mGLContext) {
108  EGLNativeWindowType window(reinterpret_cast<EGLNativeWindowType>(mWaylandEglWindow));
109  EGLSurface surface = eglCreateWindowSurface(mEglIntegration->eglDisplay(),mGLContext->eglConfig(),window,NULL);
110  mGLContext->setEglSurface(surface);
111  }
112 }
QWaylandEglIntegration * mEglIntegration
virtual QRect geometry() const
Returnes the current geometry of a window.
struct wl_surface * mSurface
NativeWindowType EGLNativeWindowType
Definition: qegl_p.h:116
NSWindow * window
int width() const
Returns the width.
Definition: qsize.h:126
void setEglSurface(EGLSurface surface)
wl_visual * visual() const
struct wl_egl_window * mWaylandEglWindow
QSize size() const
Returns the size of the rectangle.
Definition: qrect.h:309
QWaylandGLContext * mGLContext
EGLConfig eglConfig() const
int height() const
Returns the height.
Definition: qsize.h:129
bool isValid() const
Returns true if both the width and height is equal to or greater than 0; otherwise returns false...
Definition: qsize.h:123
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
static QWaylandScreen * waylandScreenFromWidget(QWidget *widget)
QWidget * widget() const
Returnes the widget which belongs to the QPlatformWindow.

◆ setGeometry()

void QWaylandEglWindow::setGeometry ( const QRect rect)
virtual

This function is called by Qt whenever a window is moved or the window is resized.

The resize can happen programatically(from ie. user application) or by the window manager. This means that there is no need to call this function specifically from the window manager callback, instead call QWindowSystemInterface::handleGeometryChange(QWidget *w, const QRect &newRect);

Reimplemented from QPlatformWindow.

Definition at line 67 of file qwaylandeglwindow.cpp.

68 {
70  if (mWaylandEglWindow) {
71  wl_egl_window_resize(mWaylandEglWindow,rect.width(),rect.height(),0,0);
72  }
73 }
virtual void setGeometry(const QRect &rect)
This function is called by Qt whenever a window is moved or the window is resized.
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
struct wl_egl_window * mWaylandEglWindow

◆ setParent()

void QWaylandEglWindow::setParent ( const QPlatformWindow parent)
virtual

This function is called to enable native child widgets in QPA.

It is common not to support this feature in Window systems, but can be faked. When this function is called all geometry of this platform window will be relative to the parent.

Reimplemented from QPlatformWindow.

Definition at line 75 of file qwaylandeglwindow.cpp.

76 {
77  const QWaylandWindow *wParent = static_cast<const QWaylandWindow *>(parent);
78 
79  mParentWindow = wParent;
80 }
const QWaylandWindow * mParentWindow

◆ windowType()

QWaylandWindow::WindowType QWaylandEglWindow::windowType ( ) const
virtual

Implements QWaylandWindow.

Definition at line 62 of file qwaylandeglwindow.cpp.

63 {
64  return QWaylandWindow::Egl;
65 }

Properties

◆ mEglIntegration

QWaylandEglIntegration* QWaylandEglWindow::mEglIntegration
private

Definition at line 63 of file qwaylandeglwindow.h.

Referenced by glContext(), newSurfaceCreated(), and QWaylandEglWindow().

◆ mGLContext

QWaylandGLContext* QWaylandEglWindow::mGLContext
private

Definition at line 64 of file qwaylandeglwindow.h.

Referenced by glContext(), newSurfaceCreated(), and ~QWaylandEglWindow().

◆ mParentWindow

const QWaylandWindow* QWaylandEglWindow::mParentWindow
private

Definition at line 67 of file qwaylandeglwindow.h.

Referenced by setParent().

◆ mWaylandEglWindow

struct wl_egl_window* QWaylandEglWindow::mWaylandEglWindow
private

Definition at line 65 of file qwaylandeglwindow.h.

Referenced by glContext(), newSurfaceCreated(), and setGeometry().


The documentation for this class was generated from the following files: