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

#include <qdirectfbwindow.h>

Inheritance diagram for QDirectFbWindow:
QPlatformWindow

Public Functions

IDirectFBSurface * dfbSurface ()
 
IDirectFBWindow * dfbWindow () const
 
void lower ()
 Reimplement to be able to let Qt lower windows to the bottom of the desktop. More...
 
 QDirectFbWindow (QWidget *tlw, QDirectFbInput *inputhandler)
 
void raise ()
 Reimplement to be able to let Qt rais windows to the top of the desktop. More...
 
void setGeometry (const QRect &rect)
 This function is called by Qt whenever a window is moved or the window is resized. More...
 
bool setKeyboardGrabEnabled (bool grab)
 
bool setMouseGrabEnabled (bool grab)
 
void setOpacity (qreal level)
 Reimplement to be able to let Qt set the opacity level of a window. More...
 
void setVisible (bool visible)
 Reimplemented in subclasses to show the surface if visible is true, and hide it if visible is false. More...
 
Qt::WindowFlags setWindowFlags (Qt::WindowFlags flags)
 Requests setting the window flags of this surface to type. More...
 
WId winId () const
 Reimplement in subclasses to return a handle to the native window. More...
 
 ~QDirectFbWindow ()
 
- Public Functions inherited from QPlatformWindow
virtual QRect geometry () const
 Returnes the current geometry of a window. More...
 
virtual QPlatformGLContextglContext () const
 Reimplement to return the glContext associated with the window. More...
 
 QPlatformWindow (QWidget *tlw)
 Constructs a platform window with the given top level widget. More...
 
virtual void requestActivateWindow ()
 Reimplement to let Qt be able to request activation/focus for a window. More...
 
virtual void setParent (const QPlatformWindow *window)
 This function is called to enable native child widgets in QPA. 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...
 

Properties

QDirectFBPointer< IDirectFBSurface > m_dfbSurface
 
QDirectFBPointer< IDirectFBWindow > m_dfbWindow
 
QDirectFbInputm_inputHandler
 

Additional Inherited Members

- Protected Variables inherited from QPlatformWindow
QScopedPointer< QPlatformWindowPrivated_ptr
 

Detailed Description

Definition at line 52 of file qdirectfbwindow.h.

Constructors and Destructors

◆ QDirectFbWindow()

QDirectFbWindow::QDirectFbWindow ( QWidget tlw,
QDirectFbInput inputhandler 
)

Definition at line 52 of file qdirectfbwindow.cpp.

53  : QPlatformWindow(tlw), m_inputHandler(inputhandler)
54 {
55  DFBDisplayLayerConfig layerConfig;
56  IDirectFBDisplayLayer *layer;
57 
58  layer = toDfbScreen(tlw)->dfbLayer();
59  toDfbScreen(tlw)->dfbLayer()->GetConfiguration(layer, &layerConfig);
60 
61  DFBWindowDescription description;
62  memset(&description,0,sizeof(DFBWindowDescription));
63  description.flags = DFBWindowDescriptionFlags(DWDESC_WIDTH|DWDESC_HEIGHT|DWDESC_POSX|DWDESC_POSY|DWDESC_SURFACE_CAPS
64 #if DIRECTFB_MINOR_VERSION >= 1
65  |DWDESC_OPTIONS
66 #endif
67  |DWDESC_CAPS);
68  description.width = tlw->width();
69  description.height = tlw->height();
70  description.posx = tlw->x();
71  description.posy = tlw->y();
72 
73  if (layerConfig.surface_caps & DSCAPS_PREMULTIPLIED)
74  description.surface_caps = DSCAPS_PREMULTIPLIED;
75  description.pixelformat = layerConfig.pixelformat;
76 
77 #if DIRECTFB_MINOR_VERSION >= 1
78  description.options = DFBWindowOptions(DWOP_ALPHACHANNEL);
79 #endif
80  description.caps = DFBWindowCapabilities(DWCAPS_DOUBLEBUFFER|DWCAPS_ALPHACHANNEL);
81  description.surface_caps = DSCAPS_PREMULTIPLIED;
82 
83  DFBResult result = layer->CreateWindow(layer, &description, m_dfbWindow.outPtr());
84  if (result != DFB_OK) {
85  DirectFBError("QDirectFbGraphicsSystemScreen: failed to create window",result);
86  }
87 
88  m_dfbWindow->SetOpacity(m_dfbWindow.data(), 0xff);
89 
90  setVisible(widget()->isVisible());
91 
93 }
int width
the width of the widget excluding any window frame
Definition: qwidget.h:166
T * data() const
Returns the value of the pointer referenced by this object.
int x
the x coordinate of the widget relative to its parent including any window frame
Definition: qwidget.h:161
QPlatformWindow(QWidget *tlw)
Constructs a platform window with the given top level widget.
QDirectFbScreen * toDfbScreen(QWidget *window)
QDirectFBPointer< IDirectFBWindow > m_dfbWindow
int height
the height of the widget excluding any window frame
Definition: qwidget.h:167
void addWindow(IDirectFBWindow *window, QWidget *platformWindow)
IDirectFBDisplayLayer * dfbLayer() const
int y
the y coordinate of the widget relative to its parent and including any window frame ...
Definition: qwidget.h:162
QDirectFbInput * m_inputHandler
void setVisible(bool visible)
Reimplemented in subclasses to show the surface if visible is true, and hide it if visible is false...
QWidget * widget() const
Returnes the widget which belongs to the QPlatformWindow.

◆ ~QDirectFbWindow()

QDirectFbWindow::~QDirectFbWindow ( )

Definition at line 95 of file qdirectfbwindow.cpp.

96 {
98  m_dfbWindow->Destroy(m_dfbWindow.data());
99 }
T * data() const
Returns the value of the pointer referenced by this object.
QDirectFBPointer< IDirectFBWindow > m_dfbWindow
QDirectFbInput * m_inputHandler
void removeWindow(IDirectFBWindow *window)

Functions

◆ dfbSurface()

IDirectFBSurface * QDirectFbWindow::dfbSurface ( )

Definition at line 202 of file qdirectfbwindow.cpp.

203 {
204  if (!m_dfbSurface) {
205  DFBResult res = m_dfbWindow->GetSurface(m_dfbWindow.data(), m_dfbSurface.outPtr());
206  if (res != DFB_OK)
207  DirectFBError(QDFB_PRETTY, res);
208  }
209 
210  return m_dfbSurface.data();
211 }
T * data() const
Returns the value of the pointer referenced by this object.
#define QDFB_PRETTY
QDirectFBPointer< IDirectFBWindow > m_dfbWindow
QDirectFBPointer< IDirectFBSurface > m_dfbSurface

◆ dfbWindow()

IDirectFBWindow * QDirectFbWindow::dfbWindow ( ) const

Definition at line 197 of file qdirectfbwindow.cpp.

198 {
199  return m_dfbWindow.data();
200 }
T * data() const
Returns the value of the pointer referenced by this object.
QDirectFBPointer< IDirectFBWindow > m_dfbWindow

◆ lower()

void QDirectFbWindow::lower ( )
virtual

Reimplement to be able to let Qt lower windows to the bottom of the desktop.

Reimplemented from QPlatformWindow.

Definition at line 161 of file qdirectfbwindow.cpp.

162 {
163  m_dfbWindow->LowerToBottom(m_dfbWindow.data());
164 }
T * data() const
Returns the value of the pointer referenced by this object.
QDirectFBPointer< IDirectFBWindow > m_dfbWindow

◆ raise()

void QDirectFbWindow::raise ( )
virtual

Reimplement to be able to let Qt rais windows to the top of the desktop.

Reimplemented from QPlatformWindow.

Definition at line 156 of file qdirectfbwindow.cpp.

157 {
158  m_dfbWindow->RaiseToTop(m_dfbWindow.data());
159 }
T * data() const
Returns the value of the pointer referenced by this object.
QDirectFBPointer< IDirectFBWindow > m_dfbWindow

◆ setGeometry()

void QDirectFbWindow::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 101 of file qdirectfbwindow.cpp.

102 {
103  bool isMoveOnly = (rect.topLeft() != geometry().topLeft()) && (rect.size() == geometry().size());
104 
106  if (widget()->isVisible() && !(widget()->testAttribute(Qt::WA_DontShowOnScreen))) {
107  m_dfbWindow->SetBounds(m_dfbWindow.data(), rect.x(),rect.y(),
108  rect.width(), rect.height());
109  //Hack. When moving since the WindowSurface of a window becomes invalid when moved
110  if (isMoveOnly) { //if resize then windowsurface is updated.
111  widget()->windowSurface()->resize(rect.size());
112  widget()->update();
113  }
114  }
115 }
T * data() const
Returns the value of the pointer referenced by this object.
virtual void setGeometry(const QRect &rect)
This function is called by Qt whenever a window is moved or the window is resized.
virtual QRect geometry() const
Returnes the current geometry of a window.
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
void update()
Updates the widget unless updates are disabled or the widget is hidden.
Definition: qwidget.cpp:10883
QDirectFBPointer< IDirectFBWindow > m_dfbWindow
QSize size() const
Returns the size of the rectangle.
Definition: qrect.h:309
QWindowSurface * windowSurface() const
Returns the QWindowSurface this widget will be drawn into.
Definition: qwidget.cpp:12819
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
QWidget * widget() const
Returnes the widget which belongs to the QPlatformWindow.
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

◆ setKeyboardGrabEnabled()

bool QDirectFbWindow::setKeyboardGrabEnabled ( bool  grab)

Definition at line 173 of file qdirectfbwindow.cpp.

174 {
175  DFBResult res;
176 
177  if (grab)
178  res = m_dfbWindow->GrabKeyboard(m_dfbWindow.data());
179  else
180  res = m_dfbWindow->UngrabKeyboard(m_dfbWindow.data());
181 
182  return res == DFB_OK;
183 }
T * data() const
Returns the value of the pointer referenced by this object.
QDirectFBPointer< IDirectFBWindow > m_dfbWindow

◆ setMouseGrabEnabled()

bool QDirectFbWindow::setMouseGrabEnabled ( bool  grab)

Definition at line 185 of file qdirectfbwindow.cpp.

186 {
187  DFBResult res;
188 
189  if (grab)
190  res = m_dfbWindow->GrabPointer(m_dfbWindow.data());
191  else
192  res = m_dfbWindow->UngrabPointer(m_dfbWindow.data());
193 
194  return res == DFB_OK;
195 }
T * data() const
Returns the value of the pointer referenced by this object.
QDirectFBPointer< IDirectFBWindow > m_dfbWindow

◆ setOpacity()

void QDirectFbWindow::setOpacity ( qreal  level)
virtual

Reimplement to be able to let Qt set the opacity level of a window.

Reimplemented from QPlatformWindow.

Definition at line 117 of file qdirectfbwindow.cpp.

118 {
119  const quint8 windowOpacity = quint8(level * 0xff);
120  m_dfbWindow->SetOpacity(m_dfbWindow.data(), windowOpacity);
121 }
T * data() const
Returns the value of the pointer referenced by this object.
unsigned char quint8
Definition: qglobal.h:934
QDirectFBPointer< IDirectFBWindow > m_dfbWindow

◆ setVisible()

void QDirectFbWindow::setVisible ( bool  visible)
virtual

Reimplemented in subclasses to show the surface if visible is true, and hide it if visible is false.

Reimplemented from QPlatformWindow.

Definition at line 123 of file qdirectfbwindow.cpp.

Referenced by QDirectFbWindow().

124 {
125  if (visible) {
126  int x = geometry().x();
127  int y = geometry().y();
128  m_dfbWindow->MoveTo(m_dfbWindow.data(), x, y);
129  } else {
131  QDirectFbConvenience::dfbInterface()->GetDisplayLayer(QDirectFbConvenience::dfbInterface(), DLID_PRIMARY, displayLayer.outPtr());
132 
133  DFBDisplayLayerConfig config;
134  displayLayer->GetConfiguration(displayLayer.data(), &config);
135  m_dfbWindow->MoveTo(m_dfbWindow.data(), config. width + 1, config.height + 1);
136  }
137 }
T * data() const
Returns the value of the pointer referenced by this object.
virtual QRect geometry() const
Returnes the current geometry of a window.
QDirectFBPointer< IDirectFBWindow > m_dfbWindow
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
static IDirectFB * dfbInterface()

◆ setWindowFlags()

Qt::WindowFlags QDirectFbWindow::setWindowFlags ( Qt::WindowFlags  flags)
virtual

Requests setting the window flags of this surface to type.

Returns the actual flags set.

Reimplemented from QPlatformWindow.

Definition at line 139 of file qdirectfbwindow.cpp.

140 {
141  switch (flags & Qt::WindowType_Mask) {
142  case Qt::ToolTip: {
143  DFBWindowOptions options;
144  m_dfbWindow->GetOptions(m_dfbWindow.data(), &options);
145  options = DFBWindowOptions(options | DWOP_GHOST);
146  m_dfbWindow->SetOptions(m_dfbWindow.data(), options);
147  break; }
148  default:
149  break;
150  }
151 
152  m_dfbWindow->SetStackingClass(m_dfbWindow.data(), flags & Qt::WindowStaysOnTopHint ? DWSC_UPPER : DWSC_MIDDLE);
153  return flags;
154 }
T * data() const
Returns the value of the pointer referenced by this object.
QDirectFBPointer< IDirectFBWindow > m_dfbWindow

◆ winId()

WId QDirectFbWindow::winId ( ) const
virtual

Reimplement in subclasses to return a handle to the native window.

Reimplemented from QPlatformWindow.

Definition at line 166 of file qdirectfbwindow.cpp.

167 {
168  DFBWindowID id;
169  m_dfbWindow->GetID(m_dfbWindow.data(), &id);
170  return WId(id);
171 }
unsigned long WId
Definition: qwindowdefs.h:119
T * data() const
Returns the value of the pointer referenced by this object.
QDirectFBPointer< IDirectFBWindow > m_dfbWindow

Properties

◆ m_dfbSurface

QDirectFBPointer<IDirectFBSurface> QDirectFbWindow::m_dfbSurface
private

Definition at line 76 of file qdirectfbwindow.h.

Referenced by dfbSurface().

◆ m_dfbWindow

QDirectFBPointer<IDirectFBWindow> QDirectFbWindow::m_dfbWindow
private

◆ m_inputHandler

QDirectFbInput* QDirectFbWindow::m_inputHandler
private

Definition at line 78 of file qdirectfbwindow.h.

Referenced by QDirectFbWindow(), and ~QDirectFbWindow().


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