Qt 4.8
Public Functions | Private Types | Private Functions | Static Private Functions | Properties | Friends | List of all members
QBBWindow Class Reference

#include <qbbwindow.h>

Inheritance diagram for QBBWindow:
QPlatformWindow

Public Functions

QSize bufferSize () const
 
const QList< QBBWindow * > & children () const
 
QBBWindowfindWindow (screen_window_t windowHandle)
 
QBBBufferfrontBuffer ()
 
void gainedFocus ()
 
virtual QPlatformGLContextglContext () const
 Reimplement to return the glContext associated with the window. More...
 
bool hasBuffers () const
 
virtual void lower ()
 Reimplement to be able to let Qt lower windows to the bottom of the desktop. More...
 
void post (const QRegion &dirty)
 
 QBBWindow (QWidget *window, screen_context_t context, QBBScreen *screen)
 
virtual void raise ()
 Reimplement to be able to let Qt rais windows to the top of the desktop. More...
 
QBBBufferrenderBuffer ()
 
virtual void requestActivateWindow ()
 Reimplement to let Qt be able to request activation/focus for a window. More...
 
QBBScreenscreen () const
 
void scroll (const QRegion &region, int dx, int dy, bool flush=false)
 
void setBufferSize (const QSize &size)
 
virtual void setGeometry (const QRect &rect)
 This function is called by Qt whenever a window is moved or the window is resized. More...
 
virtual void setOpacity (qreal level)
 Reimplement to be able to let Qt set the opacity level of a window. More...
 
virtual void setParent (const QPlatformWindow *window)
 This function is called to enable native child widgets in QPA. More...
 
void setScreen (QBBScreen *platformScreen)
 
virtual void setVisible (bool visible)
 Reimplemented in subclasses to show the surface if visible is true, and hide it if visible is false. More...
 
virtual WId winId () const
 Reimplement in subclasses to return a handle to the native window. More...
 
virtual ~QBBWindow ()
 
- Public Functions inherited from QPlatformWindow
virtual QRect geometry () const
 Returnes the current geometry of a window. More...
 
 QPlatformWindow (QWidget *tlw)
 Constructs a platform window with the given top level widget. 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...
 

Private Types

enum  Buffer { BACK_BUFFER, FRONT_BUFFER, MAX_BUFFER_COUNT }
 

Private Functions

QBBBufferbuffer (QBBWindow::Buffer bufferIndex)
 
void copyBack (const QRegion &region, int dx, int dy, bool flush=false)
 
void fetchBuffers ()
 
void offset (const QPoint &offset)
 
void removeFromParent ()
 
void updateVisibility (bool parentVisible)
 
void updateZorder (int &topZorder)
 

Static Private Functions

static int platformWindowFormatToNativeFormat (const QPlatformWindowFormat &format)
 

Properties

QBBBuffer mBuffers [MAX_BUFFER_COUNT]
 
QSize mBufferSize
 
QList< QBBWindow * > mChildren
 
screen_context_t mContext
 
int mCurrentBufferIndex
 
QBBWindowmParent
 
QBBGLContextmPlatformGlContext
 
int mPreviousBufferIndex
 
QRegion mPreviousDirty
 
QBBScreenmScreen
 
QRegion mScrolled
 
bool mVisible
 
screen_window_t mWindow
 

Friends

class QBBScreen
 

Additional Inherited Members

- Protected Variables inherited from QPlatformWindow
QScopedPointer< QPlatformWindowPrivated_ptr
 

Detailed Description

Definition at line 59 of file qbbwindow.h.

Enumerations

◆ Buffer

enum QBBWindow::Buffer
private
Enumerator
BACK_BUFFER 
FRONT_BUFFER 
MAX_BUFFER_COUNT 

Definition at line 100 of file qbbwindow.h.

Constructors and Destructors

◆ QBBWindow()

QBBWindow::QBBWindow ( QWidget window,
screen_context_t  context,
QBBScreen screen 
)

Definition at line 57 of file qbbwindow.cpp.

58  : QPlatformWindow(window),
59  mContext(context),
62  mPlatformGlContext(NULL),
63  mScreen(NULL),
64  mParent(NULL),
65  mVisible(true)
66 {
67 #if defined(QBBWINDOW_DEBUG)
68  qDebug() << "QBBWindow::QBBWindow - w=" << window << ", s=" << window->size();
69 #endif
70  int result;
71 
72  // create child QNX window
73  errno = 0;
74  result = screen_create_window_type(&mWindow, mContext, SCREEN_CHILD_WINDOW);
75  if (result != 0) {
76  qFatal("QBBWindow: failed to create window, errno=%d", errno);
77  }
78 
79  // set window buffer usage based on rendering API
80  int val;
81  QPlatformWindowFormat format = widget()->platformWindowFormat();
82  switch (format.windowApi()) {
84  val = SCREEN_USAGE_NATIVE | SCREEN_USAGE_READ | SCREEN_USAGE_WRITE;
85  break;
87  val = SCREEN_USAGE_OPENGL_ES2;
88  break;
89  default:
90  qFatal("QBBWindow: unsupported window API");
91  break;
92  }
93 
94  errno = 0;
95  result = screen_set_window_property_iv(mWindow, SCREEN_PROPERTY_USAGE, &val);
96  if (result != 0) {
97  qFatal("QBBWindow: failed to set window buffer usage, errno=%d", errno);
98  }
99 
100  // alpha channel is always pre-multiplied if present
101  errno = 0;
102  val = SCREEN_PRE_MULTIPLIED_ALPHA;
103  result = screen_set_window_property_iv(mWindow, SCREEN_PROPERTY_ALPHA_MODE, &val);
104  if (result != 0) {
105  qFatal("QBBWindow: failed to set window alpha mode, errno=%d", errno);
106  }
107 
108  // make the window opaque
109  errno = 0;
110  val = SCREEN_TRANSPARENCY_NONE;
111  result = screen_set_window_property_iv(mWindow, SCREEN_PROPERTY_TRANSPARENCY, &val);
112  if (result != 0) {
113  qFatal("QBBWindow: failed to set window transparency, errno=%d", errno);
114  }
115 
116  // set the window swap interval
117  errno = 0;
118  val = 1;
119  result = screen_set_window_property_iv(mWindow, SCREEN_PROPERTY_SWAP_INTERVAL, &val);
120  if (result != 0) {
121  qFatal("QBBWindow: failed to set window swap interval, errno=%d", errno);
122  }
123 
124  // Set the screen to the primary display (this is the default specified by screen).
125  setScreen(screen);
126 
127  // Qt somtimes doesn't call these setters after creating the window, so we need to do that
128  // ourselves here
129  if (window->parentWidget() && window->parentWidget()->platformWindow())
130  setParent(window->parentWidget()->platformWindow());
131  setGeometry(window->geometry());
132  setVisible(window->isVisible());
133 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
void setScreen(QBBScreen *platformScreen)
Definition: qbbwindow.cpp:474
bool isVisible() const
Definition: qwidget.h:1005
virtual void setParent(const QPlatformWindow *window)
This function is called to enable native child widgets in QPA.
Definition: qbbwindow.cpp:532
The QPlatformWindowFormat class specifies the display format of an OpenGL rendering context and if po...
QBBWindow * mParent
Definition: qbbwindow.h:120
QPlatformWindow(QWidget *tlw)
Constructs a platform window with the given top level widget.
bool mVisible
Definition: qbbwindow.h:121
Q_CORE_EXPORT void qDebug(const char *,...)
int mPreviousBufferIndex
Definition: qbbwindow.h:113
screen_window_t mWindow
Definition: qbbwindow.h:109
int mCurrentBufferIndex
Definition: qbbwindow.h:112
QSize size
the size of the widget excluding any window frame
Definition: qwidget.h:165
virtual void setVisible(bool visible)
Reimplemented in subclasses to show the surface if visible is true, and hide it if visible is false...
Definition: qbbwindow.cpp:232
virtual void setGeometry(const QRect &rect)
This function is called by Qt whenever a window is moved or the window is resized.
Definition: qbbwindow.cpp:157
Q_CORE_EXPORT void qFatal(const char *,...)
screen_context_t mContext
Definition: qbbwindow.h:108
QBBScreen * mScreen
Definition: qbbwindow.h:118
QRect geometry
the geometry of the widget relative to its parent and excluding the window frame
Definition: qwidget.h:158
QBBGLContext * mPlatformGlContext
Definition: qbbwindow.h:117
int errno
QWidget * widget() const
Returnes the widget which belongs to the QPlatformWindow.

◆ ~QBBWindow()

QBBWindow::~QBBWindow ( )
virtual

Definition at line 135 of file qbbwindow.cpp.

136 {
137 #if defined(QBBWINDOW_DEBUG)
138  qDebug() << "QBBWindow::~QBBWindow - w=" << widget();
139 #endif
140 
141  // Qt should have already deleted the children before deleting the parent.
142  Q_ASSERT(mChildren.size() == 0);
143 
144  // Remove from parent's Hierarchy.
147 
148  // cleanup OpenGL/OpenVG context if it exists
149  if (mPlatformGlContext != NULL) {
150  delete mPlatformGlContext;
151  }
152 
153  // cleanup QNX window and its buffers
154  screen_destroy_window(mWindow);
155 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
Q_CORE_EXPORT void qDebug(const char *,...)
QList< QBBWindow * > mChildren
Definition: qbbwindow.h:119
screen_window_t mWindow
Definition: qbbwindow.h:109
void updateHierarchy()
Definition: qbbscreen.cpp:456
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
QBBScreen * mScreen
Definition: qbbwindow.h:118
void removeFromParent()
Definition: qbbwindow.cpp:519
QBBGLContext * mPlatformGlContext
Definition: qbbwindow.h:117
QWidget * widget() const
Returnes the widget which belongs to the QPlatformWindow.

Functions

◆ buffer()

QBBBuffer & QBBWindow::buffer ( QBBWindow::Buffer  bufferIndex)
private

Definition at line 368 of file qbbwindow.cpp.

Referenced by frontBuffer(), and renderBuffer().

369 {
370 #if defined(QBBWINDOW_DEBUG)
371  qDebug() << "QBBWindow::buffer - w=" << widget();
372 #endif
373 
374  // check if render buffer is invalid
375  if (mCurrentBufferIndex == -1) {
376  // get all buffers available for rendering
377  errno = 0;
378  screen_buffer_t buffers[MAX_BUFFER_COUNT];
379  const int result = screen_get_window_property_pv(mWindow, SCREEN_PROPERTY_RENDER_BUFFERS, (void **)buffers);
380  if (result != 0) {
381  qFatal("QBBWindow: failed to query window buffers, errno=%d", errno);
382  }
383 
384  // wrap each buffer
385  for (int i = 0; i < MAX_BUFFER_COUNT; i++) {
386  mBuffers[i] = QBBBuffer(buffers[i]);
387  }
388 
389  // use the first available render buffer
392  }
393 
394  if (bufferIndex == BACK_BUFFER) {
396  } else if (bufferIndex == FRONT_BUFFER) {
397  int buf = mCurrentBufferIndex - 1;
398 
399  if (buf < 0)
400  buf = MAX_BUFFER_COUNT - 1;
401 
402  return mBuffers[buf];
403  }
404 
405  qFatal("QBBWindow::buffer() - invalid buffer index. Aborting");
406 
407  // never happens
409 }
Q_CORE_EXPORT void qDebug(const char *,...)
int mPreviousBufferIndex
Definition: qbbwindow.h:113
screen_window_t mWindow
Definition: qbbwindow.h:109
int mCurrentBufferIndex
Definition: qbbwindow.h:112
QBBBuffer mBuffers[MAX_BUFFER_COUNT]
Definition: qbbwindow.h:111
Q_CORE_EXPORT void qFatal(const char *,...)
int errno
QWidget * widget() const
Returnes the widget which belongs to the QPlatformWindow.

◆ bufferSize()

QSize QBBWindow::bufferSize ( ) const
inline

Definition at line 73 of file qbbwindow.h.

Referenced by QBBRasterWindowSurface::beginPaint().

73 { return mBufferSize; }
QSize mBufferSize
Definition: qbbwindow.h:110

◆ children()

const QList<QBBWindow*>& QBBWindow::children ( ) const
inline

Definition at line 94 of file qbbwindow.h.

94 { return mChildren; }
QList< QBBWindow * > mChildren
Definition: qbbwindow.h:119

◆ copyBack()

void QBBWindow::copyBack ( const QRegion region,
int  dx,
int  dy,
bool  flush = false 
)
private

Definition at line 646 of file qbbwindow.cpp.

Referenced by post(), and scroll().

647 {
648  int result;
649 
650  // abort if previous buffer is invalid
651  if (mPreviousBufferIndex == -1) {
652  return;
653  }
654 
655  // abort if nothing to copy
656  if (region.isEmpty()) {
657  return;
658  }
659 
660  QBBBuffer &currentBuffer = mBuffers[mCurrentBufferIndex];
661  QBBBuffer &previousBuffer = mBuffers[mPreviousBufferIndex];
662 
663  // break down region into non-overlapping rectangles
664  QVector<QRect> rects = region.rects();
665  for (int i = rects.size() - 1; i >= 0; i--) {
666 
667  // clip rectangle to bounds of target
668  QRect rect = rects[i].intersected( currentBuffer.rect() );
669 
670  if (rect.isEmpty())
671  continue;
672 
673  // setup blit operation
674  int attribs[] = { SCREEN_BLIT_SOURCE_X, rect.x(),
675  SCREEN_BLIT_SOURCE_Y, rect.y(),
676  SCREEN_BLIT_SOURCE_WIDTH, rect.width(),
677  SCREEN_BLIT_SOURCE_HEIGHT, rect.height(),
678  SCREEN_BLIT_DESTINATION_X, rect.x() + dx,
679  SCREEN_BLIT_DESTINATION_Y, rect.y() + dy,
680  SCREEN_BLIT_DESTINATION_WIDTH, rect.width(),
681  SCREEN_BLIT_DESTINATION_HEIGHT, rect.height(),
682  SCREEN_BLIT_END };
683 
684  // queue blit operation
685  errno = 0;
686  result = screen_blit(mContext, currentBuffer.nativeBuffer(), previousBuffer.nativeBuffer(), attribs);
687  if (result != 0) {
688  qFatal("QBBWindow: failed to blit buffers, errno=%d", errno);
689  }
690  }
691 
692  // check if flush requested
693  if (flush) {
694 
695  // wait for all blits to complete
696  errno = 0;
697  result = screen_flush_blits(mContext, SCREEN_WAIT_IDLE);
698  if (result != 0) {
699  qFatal("QBBWindow: failed to flush blits, errno=%d", errno);
700  }
701 
702  // buffer was modified outside the CPU
703  currentBuffer.invalidateInCache();
704  }
705 }
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
int mPreviousBufferIndex
Definition: qbbwindow.h:113
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Definition: qregion.cpp:4098
int mCurrentBufferIndex
Definition: qbbwindow.h:112
QBBBuffer mBuffers[MAX_BUFFER_COUNT]
Definition: qbbwindow.h:111
bool isEmpty() const
Returns true if the rectangle is empty, otherwise returns false.
Definition: qrect.h:234
Q_CORE_EXPORT void qFatal(const char *,...)
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
QVector< QRect > rects() const
Returns an array of non-overlapping rectangles that make up the region.
Definition: qregion.cpp:4412
screen_context_t mContext
Definition: qbbwindow.h:108
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QRect rect() const
Definition: qbbbuffer.h:63
void invalidateInCache()
Definition: qbbbuffer.cpp:149
Q_CORE_EXPORT QTextStream & flush(QTextStream &s)
screen_buffer_t nativeBuffer() const
Definition: qbbbuffer.h:59
int size() const
Returns the number of items in the vector.
Definition: qvector.h:137
int errno

◆ fetchBuffers()

void QBBWindow::fetchBuffers ( )
private

◆ findWindow()

QBBWindow * QBBWindow::findWindow ( screen_window_t  windowHandle)

Definition at line 617 of file qbbwindow.cpp.

Referenced by children(), QBBScreen::findWindow(), and findWindow().

618 {
619  if (mWindow == windowHandle)
620  return this;
621 
623  QBBWindow * const result = window->findWindow(windowHandle);
624  if (result)
625  return result;
626  }
627 
628  return 0;
629 }
NSWindow * window
QList< QBBWindow * > mChildren
Definition: qbbwindow.h:119
screen_window_t mWindow
Definition: qbbwindow.h:109
#define Q_FOREACH(variable, container)
Same as foreach(variable, container).
Definition: qglobal.h:2435
QBBWindow * findWindow(screen_window_t windowHandle)
Definition: qbbwindow.cpp:617

◆ frontBuffer()

QBBBuffer & QBBWindow::frontBuffer ( )

Definition at line 359 of file qbbwindow.cpp.

Referenced by hasBuffers(), and QBBRasterWindowSurface::paintDevice().

360 {
361 #if defined(QBBWINDOW_DEBUG)
362  qDebug() << "QBBWindow::frontBuffer - w=" << widget();
363 #endif
364 
365  return buffer(FRONT_BUFFER);
366 }
Q_CORE_EXPORT void qDebug(const char *,...)
QBBBuffer & buffer(QBBWindow::Buffer bufferIndex)
Definition: qbbwindow.cpp:368
QWidget * widget() const
Returnes the widget which belongs to the QPlatformWindow.

◆ gainedFocus()

void QBBWindow::gainedFocus ( )

Definition at line 607 of file qbbwindow.cpp.

Referenced by hasBuffers(), and requestActivateWindow().

608 {
609 #if defined(QBBWINDOW_DEBUG)
610  qDebug() << "QBBWindow::gainedFocus - w=" << widget();
611 #endif
612 
613  // Got focus
615 }
Q_CORE_EXPORT void qDebug(const char *,...)
static void handleWindowActivated(QWidget *w)
QWidget * widget() const
Returnes the widget which belongs to the QPlatformWindow.

◆ glContext()

QPlatformGLContext * QBBWindow::glContext ( ) const
virtual

Reimplement to return the glContext associated with the window.

Reimplemented from QPlatformWindow.

Definition at line 461 of file qbbwindow.cpp.

Referenced by hasBuffers().

462 {
463 #if defined(QBBWINDOW_DEBUG)
464  qDebug() << "QBBWindow::glContext - w=" << widget();
465 #endif
466  // create opengl context on first access if rendering API is correct
467  QPlatformWindowFormat format = widget()->platformWindowFormat();
468  if (mPlatformGlContext == NULL && format.windowApi() == QPlatformWindowFormat::OpenGL) {
469  mPlatformGlContext = new QBBGLContext( const_cast<QBBWindow*>(this) );
470  }
471  return mPlatformGlContext;
472 }
The QPlatformWindowFormat class specifies the display format of an OpenGL rendering context and if po...
Q_CORE_EXPORT void qDebug(const char *,...)
QBBGLContext * mPlatformGlContext
Definition: qbbwindow.h:117
QWidget * widget() const
Returnes the widget which belongs to the QPlatformWindow.

◆ hasBuffers()

bool QBBWindow::hasBuffers ( ) const
inline

Definition at line 74 of file qbbwindow.h.

Referenced by QBBGLContext::makeCurrent(), QBBRasterWindowSurface::paintDevice(), and setBufferSize().

74 { return !mBufferSize.isEmpty(); }
QSize mBufferSize
Definition: qbbwindow.h:110
bool isEmpty() const
Returns true if either of the width and height is less than or equal to 0; otherwise returns false...
Definition: qsize.h:120

◆ lower()

void QBBWindow::lower ( )
virtual

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

Reimplemented from QPlatformWindow.

Definition at line 579 of file qbbwindow.cpp.

Referenced by hasBuffers().

580 {
581 #if defined(QBBWINDOW_DEBUG)
582  qDebug() << "QBBWindow::lower - w=" << widget();
583 #endif
584 
585  if (mParent) {
586  mParent->mChildren.removeAll(this);
588  } else {
589  mScreen->lowerWindow(this);
590  }
591 
593 }
void push_front(const T &t)
This function is provided for STL compatibility.
Definition: qlist.h:297
QBBWindow * mParent
Definition: qbbwindow.h:120
void lowerWindow(QBBWindow *window)
Definition: qbbscreen.cpp:445
Q_CORE_EXPORT void qDebug(const char *,...)
QList< QBBWindow * > mChildren
Definition: qbbwindow.h:119
void updateHierarchy()
Definition: qbbscreen.cpp:456
QBBScreen * mScreen
Definition: qbbwindow.h:118
QWidget * widget() const
Returnes the widget which belongs to the QPlatformWindow.
int removeAll(const T &t)
Removes all occurrences of value in the list and returns the number of entries removed.
Definition: qlist.h:770

◆ offset()

void QBBWindow::offset ( const QPoint offset)
private

Definition at line 207 of file qbbwindow.cpp.

Referenced by setGeometry().

208 {
209  // Move self and then children.
210  QRect newGeometry = geometry();
211  newGeometry.translate(offset);
212 
213  // call the base class
214  QPlatformWindow::setGeometry(newGeometry);
215 
216  int val[2];
217 
218  errno = 0;
219  val[0] = newGeometry.x();
220  val[1] = newGeometry.y();
221  int result = screen_set_window_property_iv(mWindow, SCREEN_PROPERTY_POSITION, val);
222  if (result != 0) {
223  qFatal("QBBWindow: failed to set window position, errno=%d", errno);
224  }
225 
227  for (it = mChildren.begin(); it != mChildren.end(); it++) {
228  (*it)->offset(offset);
229  }
230 }
#define it(className, varName)
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.
iterator begin()
Returns an STL-style iterator pointing to the first item in the list.
Definition: qlist.h:267
QList< QBBWindow * > mChildren
Definition: qbbwindow.h:119
screen_window_t mWindow
Definition: qbbwindow.h:109
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the list...
Definition: qlist.h:270
The QList::iterator class provides an STL-style non-const iterator for QList and QQueue.
Definition: qlist.h:181
Q_CORE_EXPORT void qFatal(const char *,...)
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
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
void translate(int dx, int dy)
Moves the rectangle dx along the x axis and dy along the y axis, relative to the current position...
Definition: qrect.h:312
int errno

◆ platformWindowFormatToNativeFormat()

int QBBWindow::platformWindowFormatToNativeFormat ( const QPlatformWindowFormat format)
staticprivate

Definition at line 707 of file qbbwindow.cpp.

Referenced by setBufferSize().

708 {
709  // extract size of colour channels from window format
710  int redSize = format.redBufferSize();
711  if (redSize == -1) {
712  qFatal("QBBWindow: red size not defined");
713  }
714 
715  int greenSize = format.greenBufferSize();
716  if (greenSize == -1) {
717  qFatal("QBBWindow: green size not defined");
718  }
719 
720  int blueSize = format.blueBufferSize();
721  if (blueSize == -1) {
722  qFatal("QBBWindow: blue size not defined");
723  }
724 
725  // select matching native format
726  if (redSize == 5 && greenSize == 6 && blueSize == 5) {
727  return SCREEN_FORMAT_RGB565;
728  } else if (redSize == 8 && greenSize == 8 && blueSize == 8) {
729  return SCREEN_FORMAT_RGBA8888;
730  } else {
731  qFatal("QBBWindow: unsupported pixel format");
732  return 0;
733  }
734 }
int greenBufferSize() const
Returns the green buffer size.
Q_CORE_EXPORT void qFatal(const char *,...)
int blueBufferSize() const
Returns the blue buffer size.
int redBufferSize() const
Returns the red buffer size.

◆ post()

void QBBWindow::post ( const QRegion dirty)

Definition at line 417 of file qbbwindow.cpp.

Referenced by QBBRasterWindowSurface::flush(), and hasBuffers().

418 {
419  // check if render buffer exists and something was rendered
420  if (mCurrentBufferIndex != -1 && !dirty.isEmpty()) {
421 
422 #if defined(QBBWINDOW_DEBUG)
423  qDebug() << "QBBWindow::post - w=" << widget();
424 #endif
425  QBBBuffer &currentBuffer = mBuffers[mCurrentBufferIndex];
426 
427  // copy unmodified region from old render buffer to new render buffer;
428  // required to allow partial updates
429  QRegion preserve = mPreviousDirty - dirty - mScrolled;
430  copyBack(preserve, 0, 0);
431 
432  // calculate region that changed
433  QRegion modified = preserve + dirty + mScrolled;
434  QRect rect = modified.boundingRect();
435  int dirtyRect[4] = { rect.x(), rect.y(), rect.x() + rect.width(), rect.y() + rect.height() };
436 
437  // update the display with contents of render buffer
438  errno = 0;
439  int result = screen_post_window(mWindow, currentBuffer.nativeBuffer(), 1, dirtyRect, 0);
440  if (result != 0) {
441  qFatal("QBBWindow: failed to post window buffer, errno=%d", errno);
442  }
443 
444  // advance to next nender buffer
448  }
449 
450  // save modified region and clear scrolled region
451  mPreviousDirty = dirty;
452  mScrolled = QRegion();
453 
454  // notify screen that window posted
455  if (mScreen != NULL) {
456  mScreen->onWindowPost(this);
457  }
458  }
459 }
void onWindowPost(QBBWindow *window)
Definition: qbbscreen.cpp:483
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
QRect boundingRect() const
Returns the bounding rectangle of this region.
Definition: qregion.cpp:4363
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
Q_CORE_EXPORT void qDebug(const char *,...)
int mPreviousBufferIndex
Definition: qbbwindow.h:113
screen_window_t mWindow
Definition: qbbwindow.h:109
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Definition: qregion.cpp:4098
int mCurrentBufferIndex
Definition: qbbwindow.h:112
QBBBuffer mBuffers[MAX_BUFFER_COUNT]
Definition: qbbwindow.h:111
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
Q_CORE_EXPORT void qFatal(const char *,...)
void copyBack(const QRegion &region, int dx, int dy, bool flush=false)
Definition: qbbwindow.cpp:646
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
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QRegion mScrolled
Definition: qbbwindow.h:115
QBBScreen * mScreen
Definition: qbbwindow.h:118
screen_buffer_t nativeBuffer() const
Definition: qbbbuffer.h:59
QRegion mPreviousDirty
Definition: qbbwindow.h:114
int errno
QWidget * widget() const
Returnes the widget which belongs to the QPlatformWindow.

◆ raise()

void QBBWindow::raise ( )
virtual

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

Reimplemented from QPlatformWindow.

Definition at line 563 of file qbbwindow.cpp.

564 {
565 #if defined(QBBWINDOW_DEBUG)
566  qDebug() << "QBBWindow::raise - w=" << widget();
567 #endif
568 
569  if (mParent) {
570  mParent->mChildren.removeAll(this);
571  mParent->mChildren.push_back(this);
572  } else {
573  mScreen->raiseWindow(this);
574  }
575 
577 }
void push_back(const T &t)
This function is provided for STL compatibility.
Definition: qlist.h:296
QBBWindow * mParent
Definition: qbbwindow.h:120
Q_CORE_EXPORT void qDebug(const char *,...)
void raiseWindow(QBBWindow *window)
Definition: qbbscreen.cpp:434
QList< QBBWindow * > mChildren
Definition: qbbwindow.h:119
void updateHierarchy()
Definition: qbbscreen.cpp:456
QBBScreen * mScreen
Definition: qbbwindow.h:118
QWidget * widget() const
Returnes the widget which belongs to the QPlatformWindow.
int removeAll(const T &t)
Removes all occurrences of value in the list and returns the number of entries removed.
Definition: qlist.h:770

◆ removeFromParent()

void QBBWindow::removeFromParent ( )
private

Definition at line 519 of file qbbwindow.cpp.

Referenced by setParent(), and ~QBBWindow().

520 {
521  // Remove from old Hierarchy position
522  if (mParent) {
523  if (mParent->mChildren.removeAll(this))
524  mParent = 0;
525  else
526  qFatal("QBBWindow: Window Hierarchy broken; window has parent, but parent hasn't got child.");
527  } else {
528  mScreen->removeWindow(this);
529  }
530 }
QBBWindow * mParent
Definition: qbbwindow.h:120
QList< QBBWindow * > mChildren
Definition: qbbwindow.h:119
Q_CORE_EXPORT void qFatal(const char *,...)
void removeWindow(QBBWindow *child)
Definition: qbbscreen.cpp:423
QBBScreen * mScreen
Definition: qbbwindow.h:118
int removeAll(const T &t)
Removes all occurrences of value in the list and returns the number of entries removed.
Definition: qlist.h:770

◆ renderBuffer()

QBBBuffer & QBBWindow::renderBuffer ( )

Definition at line 350 of file qbbwindow.cpp.

Referenced by hasBuffers(), and QBBRasterWindowSurface::paintDevice().

351 {
352 #if defined(QBBWINDOW_DEBUG)
353  qDebug() << "QBBWindow::renderBuffer - w=" << widget();
354 #endif
355 
356  return buffer(BACK_BUFFER);
357 }
Q_CORE_EXPORT void qDebug(const char *,...)
QBBBuffer & buffer(QBBWindow::Buffer bufferIndex)
Definition: qbbwindow.cpp:368
QWidget * widget() const
Returnes the widget which belongs to the QPlatformWindow.

◆ requestActivateWindow()

void QBBWindow::requestActivateWindow ( )
virtual

Reimplement to let Qt be able to request activation/focus for a window.

Some window systems will probably not have callbacks for this functionality, and then calling QWindowSystemInterface::handleWindowActivated(QWidget *w) would be sufficient.

If the window system has some event handling/callbacks then call QWindowSystemInterface::handleWindowActivated(QWidget *w) when the window system gives the notification.

Default implementation calls QWindowSystem::handleWindowActivated(QWidget *w)

Reimplemented from QPlatformWindow.

Definition at line 595 of file qbbwindow.cpp.

Referenced by hasBuffers().

596 {
597 #if defined(QBBWINDOW_DEBUG)
598  qDebug() << "QBBWindow::requestActivateWindow - w=" << widget();
599 #endif
600 
601  // TODO: Tell screen to set keyboard focus to this window.
602 
603  // Notify that we gained focus.
604  gainedFocus();
605 }
Q_CORE_EXPORT void qDebug(const char *,...)
void gainedFocus()
Definition: qbbwindow.cpp:607
QWidget * widget() const
Returnes the widget which belongs to the QPlatformWindow.

◆ screen()

QBBScreen* QBBWindow::screen ( ) const
inline

Definition at line 93 of file qbbwindow.h.

Referenced by QBBGLContext::QBBGLContext().

93 { return mScreen; }
QBBScreen * mScreen
Definition: qbbwindow.h:118

◆ scroll()

void QBBWindow::scroll ( const QRegion region,
int  dx,
int  dy,
bool  flush = false 
)

Definition at line 411 of file qbbwindow.cpp.

Referenced by QBBRasterWindowSurface::flush(), and hasBuffers().

412 {
413  copyBack(region, dx, dy, flush);
414  mScrolled += region;
415 }
void copyBack(const QRegion &region, int dx, int dy, bool flush=false)
Definition: qbbwindow.cpp:646
QRegion mScrolled
Definition: qbbwindow.h:115
Q_CORE_EXPORT QTextStream & flush(QTextStream &s)

◆ setBufferSize()

void QBBWindow::setBufferSize ( const QSize size)

Definition at line 288 of file qbbwindow.cpp.

Referenced by QBBRasterWindowSurface::beginPaint(), QBBGLContext::makeCurrent(), QBBGLContext::resizeSurface(), and winId().

289 {
290 #if defined(QBBWINDOW_DEBUG)
291  qDebug() << "QBBWindow::setBufferSize - w=" << widget() << ", s=" << size;
292 #endif
293 
294  // set window buffer size
295  errno = 0;
296  int val[2] = { size.width(), size.height() };
297  int result = screen_set_window_property_iv(mWindow, SCREEN_PROPERTY_BUFFER_SIZE, val);
298  if (result != 0) {
299  qFatal("QBBWindow: failed to set window buffer size, errno=%d", errno);
300  }
301 
302  // create window buffers if they do not exist
303  if (!hasBuffers()) {
304 #if defined(QBBWINDOW_DEBUG)
305  qDebug() << "QBBWindow::setBufferSize - create buffers";
306 #endif
307 
308  // get pixel format from EGL config if using OpenGL;
309  // otherwise inherit pixel format of window's screen
310  if (mPlatformGlContext != NULL) {
312  } else {
313  val[0] = mScreen->nativeFormat();
314  }
315 
316  errno = 0;
317  result = screen_set_window_property_iv(mWindow, SCREEN_PROPERTY_FORMAT, val);
318  if (result != 0) {
319  qFatal("QBBWindow: failed to set window pixel format, errno=%d", errno);
320  }
321 
322  errno = 0;
323  result = screen_create_window_buffers(mWindow, MAX_BUFFER_COUNT);
324  if (result != 0) {
325  qFatal("QBBWindow: failed to create window buffers, errno=%d", errno);
326  }
327 
328  // check if there are any buffers available
329  int bufferCount = 0;
330  result = screen_get_window_property_iv(mWindow, SCREEN_PROPERTY_RENDER_BUFFER_COUNT, &bufferCount);
331 
332  if (result != 0) {
333  qFatal("QBBWindow: failed to query window buffer count, errno=%d", errno);
334  }
335 
336  if (bufferCount != MAX_BUFFER_COUNT) {
337  qFatal("QBBWindow: invalid buffer count. Expected = %d, got = %d", MAX_BUFFER_COUNT, bufferCount);
338  }
339  }
340 
341  // cache new buffer size
342  mBufferSize = size;
343 
344  // buffers were destroyed; reacquire them
345  mCurrentBufferIndex = -1;
347  mScrolled = QRegion();
348 }
bool hasBuffers() const
Definition: qbbwindow.h:74
int nativeFormat() const
Definition: qbbscreen.h:71
virtual QPlatformWindowFormat platformWindowFormat() const
QWidget has the function qplatformWindowFormat().
Definition: qbbglcontext.h:69
QSize mBufferSize
Definition: qbbwindow.h:110
Q_CORE_EXPORT void qDebug(const char *,...)
int width() const
Returns the width.
Definition: qsize.h:126
screen_window_t mWindow
Definition: qbbwindow.h:109
int mCurrentBufferIndex
Definition: qbbwindow.h:112
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
static int platformWindowFormatToNativeFormat(const QPlatformWindowFormat &format)
Definition: qbbwindow.cpp:707
Q_CORE_EXPORT void qFatal(const char *,...)
int height() const
Returns the height.
Definition: qsize.h:129
QRegion mScrolled
Definition: qbbwindow.h:115
QBBScreen * mScreen
Definition: qbbwindow.h:118
QRegion mPreviousDirty
Definition: qbbwindow.h:114
QBBGLContext * mPlatformGlContext
Definition: qbbwindow.h:117
int errno
QWidget * widget() const
Returnes the widget which belongs to the QPlatformWindow.

◆ setGeometry()

void QBBWindow::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 157 of file qbbwindow.cpp.

Referenced by QBBWindow().

158 {
159  int val[2];
160 
161 #if defined(QBBWINDOW_DEBUG)
162  qDebug() << "QBBWindow::setGeometry - w=" << widget() << ", (" << rect.x() << "," << rect.y() << "," << rect.width() << "," << rect.height() << ")";
163 #endif
164 
165  QRect oldGeometry = geometry();
166 
167  // call parent method
169 
170  // set window geometry equal to widget geometry
171  errno = 0;
172  val[0] = rect.x();
173  val[1] = rect.y();
174  int result = screen_set_window_property_iv(mWindow, SCREEN_PROPERTY_POSITION, val);
175  if (result != 0) {
176  qFatal("QBBWindow: failed to set window position, errno=%d", errno);
177  }
178 
179  errno = 0;
180  val[0] = rect.width();
181  val[1] = rect.height();
182  result = screen_set_window_property_iv(mWindow, SCREEN_PROPERTY_SIZE, val);
183  if (result != 0) {
184  qFatal("QBBWindow: failed to set window size, errno=%d", errno);
185  }
186 
187  // set viewport size equal to window size
188  errno = 0;
189  result = screen_set_window_property_iv(mWindow, SCREEN_PROPERTY_SOURCE_SIZE, val);
190  if (result != 0) {
191  qFatal("QBBWindow: failed to set window source size, errno=%d", errno);
192  }
193 
194  // Now move all children.
195  QPoint offset;
196  if (!oldGeometry.isEmpty()) {
197  offset = rect.topLeft();
198  offset -= oldGeometry.topLeft();
199 
201  for (it = mChildren.begin(); it != mChildren.end(); it++) {
202  (*it)->offset(offset);
203  }
204  }
205 }
#define it(className, varName)
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.
void offset(const QPoint &offset)
Definition: qbbwindow.cpp:207
iterator begin()
Returns an STL-style iterator pointing to the first item in the list.
Definition: qlist.h:267
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
Q_CORE_EXPORT void qDebug(const char *,...)
QList< QBBWindow * > mChildren
Definition: qbbwindow.h:119
screen_window_t mWindow
Definition: qbbwindow.h:109
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the list...
Definition: qlist.h:270
The QList::iterator class provides an STL-style non-const iterator for QList and QQueue.
Definition: qlist.h:181
bool isEmpty() const
Returns true if the rectangle is empty, otherwise returns false.
Definition: qrect.h:234
Q_CORE_EXPORT void qFatal(const char *,...)
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
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
int errno
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

◆ setOpacity()

void QBBWindow::setOpacity ( qreal  level)
virtual

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

Reimplemented from QPlatformWindow.

Definition at line 270 of file qbbwindow.cpp.

271 {
272 #if defined(QBBWINDOW_DEBUG)
273  qDebug() << "QBBWindow::setOpacity - w=" << widget() << ", o=" << level;
274 #endif
275 
276  // set window global alpha
277  errno = 0;
278  int val = (int)(level * 255);
279  int result = screen_set_window_property_iv(mWindow, SCREEN_PROPERTY_GLOBAL_ALPHA, &val);
280  if (result != 0) {
281  qFatal("QBBWindow: failed to set window global alpha, errno=%d", errno);
282  }
283 
284  // TODO: How to handle children of this window? If we change all the visibilities, then
285  // the transparency will look wrong...
286 }
Q_CORE_EXPORT void qDebug(const char *,...)
screen_window_t mWindow
Definition: qbbwindow.h:109
Q_CORE_EXPORT void qFatal(const char *,...)
int errno
QWidget * widget() const
Returnes the widget which belongs to the QPlatformWindow.

◆ setParent()

void QBBWindow::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 532 of file qbbwindow.cpp.

Referenced by hasBuffers(), and QBBWindow().

533 {
534 #if defined(QBBWINDOW_DEBUG)
535  qDebug() << "QBBWindow::setParent - w=" << widget() << " p=" << window;
536 #endif
537 
538  // Cast away the const, we need to modify the Hierarchy.
539  QBBWindow* newParent = 0;
540 
541  if (window)
542  newParent = static_cast<QBBWindow*>((QPlatformWindow *)window);
543 
544  if (newParent == mParent)
545  return;
546 
548  mParent = newParent;
549 
550  // Add to new Hierarchy position.
551  if (mParent) {
552  if (mParent->mScreen != mScreen)
554 
555  mParent->mChildren.push_back(this);
556  } else {
557  mScreen->addWindow(this);
558  }
559 
561 }
void push_back(const T &t)
This function is provided for STL compatibility.
Definition: qlist.h:296
void setScreen(QBBScreen *platformScreen)
Definition: qbbwindow.cpp:474
QBBWindow * mParent
Definition: qbbwindow.h:120
The QPlatformWindow class provides an abstraction for top-level windows.
Q_CORE_EXPORT void qDebug(const char *,...)
NSWindow * window
void addWindow(QBBWindow *child)
Definition: qbbscreen.cpp:400
QList< QBBWindow * > mChildren
Definition: qbbwindow.h:119
void updateHierarchy()
Definition: qbbscreen.cpp:456
QBBScreen * mScreen
Definition: qbbwindow.h:118
void removeFromParent()
Definition: qbbwindow.cpp:519
QWidget * widget() const
Returnes the widget which belongs to the QPlatformWindow.

◆ setScreen()

void QBBWindow::setScreen ( QBBScreen platformScreen)

Definition at line 474 of file qbbwindow.cpp.

Referenced by hasBuffers(), QBBIntegration::moveToScreen(), QBBWindow(), and setParent().

475 {
476 #if defined(QBBWINDOW_DEBUG)
477  qDebug() << "QBBWindow::setScreen - w=" << widget();
478 #endif
479 
480  if (mScreen == platformScreen)
481  return;
482 
483  if (mScreen)
484  mScreen->removeWindow(this);
485  platformScreen->addWindow(this);
486  mScreen = platformScreen;
487 
488  // The display may not have a root (desktop) window yet so we must ensure that one has been
489  // created before we can join its group or get its native display property.
491 
492  // move window to proper display
493  errno = 0;
494  screen_display_t display = platformScreen->nativeDisplay();
495  int result = screen_set_window_property_pv(mWindow, SCREEN_PROPERTY_DISPLAY, (void **)&display);
496  if (result != 0) {
497  qFatal("QBBWindow: failed to set window display, errno=%d", errno);
498  }
499 
500  // add window to display's window group
501  errno = 0;
502  result = screen_join_window_group(mWindow, platformScreen->windowGroupName());
503  if (result != 0) {
504  qFatal("QBBWindow: failed to join window group, errno=%d", errno);
505  }
506 
508  for (it = mChildren.begin(); it != mChildren.end(); it++) {
509  // Only subwindows and tooltips need necessarily be moved to another display with
510  // the window.
511  if ((widget()->windowType() & Qt::WindowType_Mask) == Qt::SubWindow ||
513  (*it)->setScreen(platformScreen);
514  }
515 
517 }
#define it(className, varName)
iterator begin()
Returns an STL-style iterator pointing to the first item in the list.
Definition: qlist.h:267
void ensureDisplayCreated()
Definition: qbbscreen.cpp:178
Q_CORE_EXPORT void qDebug(const char *,...)
void addWindow(QBBWindow *child)
Definition: qbbscreen.cpp:400
Q_GUI_EXPORT EGLDisplay display()
Definition: qegl.cpp:589
const char * windowGroupName() const
Definition: qbbscreen.h:74
QList< QBBWindow * > mChildren
Definition: qbbwindow.h:119
screen_window_t mWindow
Definition: qbbwindow.h:109
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the list...
Definition: qlist.h:270
void updateHierarchy()
Definition: qbbscreen.cpp:456
The QList::iterator class provides an STL-style non-const iterator for QList and QQueue.
Definition: qlist.h:181
screen_display_t nativeDisplay() const
Definition: qbbscreen.h:72
Q_CORE_EXPORT void qFatal(const char *,...)
void removeWindow(QBBWindow *child)
Definition: qbbscreen.cpp:423
QBBScreen * mScreen
Definition: qbbwindow.h:118
Qt::WindowType windowType() const
Returns the window type of this widget.
Definition: qwidget.h:937
int errno
QWidget * widget() const
Returnes the widget which belongs to the QPlatformWindow.

◆ setVisible()

void QBBWindow::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 232 of file qbbwindow.cpp.

Referenced by QBBWindow().

233 {
234 #if defined(QBBWINDOW_DEBUG)
235  qDebug() << "QBBWindow::setVisible - w=" << widget() << ", v=" << visible;
236 #endif
237 
238  mVisible = visible;
239 
240  QBBWindow* root = this;
241  while (root->mParent)
242  root = root->mParent;
243 
244  root->updateVisibility(root->mVisible);
245 
246  widget()->activateWindow();
247 
248  // Flush the context when invisible, otherwise it won't disappear immediately,
249  // but still allow navigator to capture screenshot (thumbnail) when minimized
250  if (!visible && !(widget()->windowState() & Qt::WindowMinimized))
251  screen_flush_context(mContext, 0);
252 }
QBBWindow * mParent
Definition: qbbwindow.h:120
void updateVisibility(bool parentVisible)
Definition: qbbwindow.cpp:254
bool mVisible
Definition: qbbwindow.h:121
Q_CORE_EXPORT void qDebug(const char *,...)
screen_context_t mContext
Definition: qbbwindow.h:108
void activateWindow()
Sets the top-level widget containing this widget to be the active window.
QWidget * widget() const
Returnes the widget which belongs to the QPlatformWindow.

◆ updateVisibility()

void QBBWindow::updateVisibility ( bool  parentVisible)
private

Definition at line 254 of file qbbwindow.cpp.

Referenced by setVisible().

255 {
256  // set window visibility
257  errno = 0;
258  int val = (mVisible && parentVisible) ? 1 : 0;
259  int result = screen_set_window_property_iv(mWindow, SCREEN_PROPERTY_VISIBLE, &val);
260  if (result != 0) {
261  qFatal("QBBWindow: failed to set window visibility, errno=%d", errno);
262  }
263 
265  for (it = mChildren.begin(); it != mChildren.end(); it++) {
266  (*it)->updateVisibility(mVisible && parentVisible);
267  }
268 }
#define it(className, varName)
iterator begin()
Returns an STL-style iterator pointing to the first item in the list.
Definition: qlist.h:267
bool mVisible
Definition: qbbwindow.h:121
QList< QBBWindow * > mChildren
Definition: qbbwindow.h:119
screen_window_t mWindow
Definition: qbbwindow.h:109
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the list...
Definition: qlist.h:270
The QList::iterator class provides an STL-style non-const iterator for QList and QQueue.
Definition: qlist.h:181
Q_CORE_EXPORT void qFatal(const char *,...)
int errno

◆ updateZorder()

void QBBWindow::updateZorder ( int &  topZorder)
private

Definition at line 631 of file qbbwindow.cpp.

632 {
633  errno = 0;
634  int result = screen_set_window_property_iv(mWindow, SCREEN_PROPERTY_ZORDER, &topZorder);
635  topZorder++;
636 
637  if (result != 0)
638  qFatal("QBBWindow: failed to set window z-order=%d, errno=%d, mWindow=0x%08x", topZorder, errno, mWindow);
639 
641 
642  for (it = mChildren.begin(); it != mChildren.end(); it++)
643  (*it)->updateZorder(topZorder);
644 }
#define it(className, varName)
iterator begin()
Returns an STL-style iterator pointing to the first item in the list.
Definition: qlist.h:267
The QList::const_iterator class provides an STL-style const iterator for QList and QQueue...
Definition: qlist.h:228
QList< QBBWindow * > mChildren
Definition: qbbwindow.h:119
screen_window_t mWindow
Definition: qbbwindow.h:109
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the list...
Definition: qlist.h:270
Q_CORE_EXPORT void qFatal(const char *,...)
int errno

◆ winId()

virtual WId QBBWindow::winId ( ) const
inlinevirtual

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

Reimplemented from QPlatformWindow.

Definition at line 70 of file qbbwindow.h.

Referenced by QBBGLContext::createSurface().

70 { return (WId)mWindow; }
unsigned long WId
Definition: qwindowdefs.h:119
screen_window_t mWindow
Definition: qbbwindow.h:109

Friends and Related Functions

◆ QBBScreen

friend class QBBScreen
friend

Definition at line 61 of file qbbwindow.h.

Properties

◆ mBuffers

QBBBuffer QBBWindow::mBuffers[MAX_BUFFER_COUNT]
private

Definition at line 111 of file qbbwindow.h.

Referenced by buffer(), copyBack(), and post().

◆ mBufferSize

QSize QBBWindow::mBufferSize
private

Definition at line 110 of file qbbwindow.h.

Referenced by bufferSize(), hasBuffers(), and setBufferSize().

◆ mChildren

QList<QBBWindow*> QBBWindow::mChildren
private

◆ mContext

screen_context_t QBBWindow::mContext
private

Definition at line 108 of file qbbwindow.h.

Referenced by copyBack(), QBBWindow(), and setVisible().

◆ mCurrentBufferIndex

int QBBWindow::mCurrentBufferIndex
private

Definition at line 112 of file qbbwindow.h.

Referenced by buffer(), copyBack(), post(), and setBufferSize().

◆ mParent

QBBWindow* QBBWindow::mParent
private

Definition at line 120 of file qbbwindow.h.

Referenced by lower(), raise(), removeFromParent(), setParent(), and setVisible().

◆ mPlatformGlContext

QBBGLContext* QBBWindow::mPlatformGlContext
mutableprivate

Definition at line 117 of file qbbwindow.h.

Referenced by glContext(), setBufferSize(), and ~QBBWindow().

◆ mPreviousBufferIndex

int QBBWindow::mPreviousBufferIndex
private

Definition at line 113 of file qbbwindow.h.

Referenced by buffer(), copyBack(), and post().

◆ mPreviousDirty

QRegion QBBWindow::mPreviousDirty
private

Definition at line 114 of file qbbwindow.h.

Referenced by post(), and setBufferSize().

◆ mScreen

QBBScreen* QBBWindow::mScreen
private

◆ mScrolled

QRegion QBBWindow::mScrolled
private

Definition at line 115 of file qbbwindow.h.

Referenced by post(), scroll(), and setBufferSize().

◆ mVisible

bool QBBWindow::mVisible
private

Definition at line 121 of file qbbwindow.h.

Referenced by setVisible(), and updateVisibility().

◆ mWindow

screen_window_t QBBWindow::mWindow
private

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