Qt 4.8
Public Types | Public Functions | Protected Functions | Private Functions | Properties | Friends | List of all members
QWSWindowSurface Class Referenceabstract

The QWSWindowSurface class provides the drawing area for top-level windows in Qt for Embedded Linux. More...

#include <qwindowsurface_qws_p.h>

Inheritance diagram for QWSWindowSurface:
QWindowSurface QDirectFBWindowSurface QWSDirectPainterSurface QWSGLWindowSurface QWSMemorySurface QWSYellowSurface EGLNullWSWindowSurface PvrEglWindowSurface QWSLocalMemSurface QWSOnScreenSurface QWSSharedMemSurface

Public Types

enum  SurfaceFlag { RegionReserved = 0x1, Buffered = 0x2, Opaque = 0x4 }
 This enum is used to describe the window surface's contents. More...
 
- Public Types inherited from QWindowSurface
enum  WindowSurfaceFeature { PartialUpdates = 0x00000001, PreservedContents = 0x00000002, StaticContents = 0x00000004, AllFeatures = 0xffffffff }
 

Public Functions

virtual void beginPaint (const QRegion &)
 This function is called before painting onto the surface begins, with the region in which the painting will occur. More...
 
const QRegion clipRegion () const
 Returns the region currently visible on the screen. More...
 
virtual void endPaint (const QRegion &)
 This function is called after painting onto the surface has ended, with the region in which the painting was performed. More...
 
virtual void flush (QWidget *widget, const QRegion &region, const QPoint &offset)
 Flushes the given region from the specified widget onto the screen. More...
 
virtual QImage image () const =0
 Implement this function to return an image of the top-level window. More...
 
bool isBuffered () const
 Returns true if the QWSWindowSurface::Buffered is set; otherwise returns false. More...
 
bool isOpaque () const
 Returns true if the QWSWindowSurface::Opaque is set; otherwise returns false. More...
 
bool isRegionReserved () const
 Returns true if the QWSWindowSurface::RegionReserved is set; otherwise returns false. More...
 
virtual bool isValid () const =0
 Implement this function to return true if the surface is a valid surface for the given top-level window; otherwise return false. More...
 
virtual QString key () const =0
 Implement this function to return a string that uniquely identifies the class of this surface. More...
 
virtual bool lock (int timeout=-1)
 
virtual bool move (const QPoint &offset)
 Move the surface with the given offset. More...
 
virtual QRegion move (const QPoint &offset, const QRegion &newClip)
 Move the surface with the given offset. More...
 
virtual QPaintDevicepaintDevice ()=0
 Implement this function to return the appropriate paint device. More...
 
virtual QPoint painterOffset () const
 Returns the offset to be used when painting. More...
 
virtual QByteArray permanentState () const
 Implement this function to return the data required for creating a server-side representation of the surface. More...
 
 QWSWindowSurface ()
 Constructs an empty surface. More...
 
 QWSWindowSurface (QWidget *widget)
 Constructs an empty surface for the given top-level widget. More...
 
virtual void releaseSurface ()
 
void setClipRegion (const QRegion &)
 Sets the region currently visible on the screen to be the given clip region. More...
 
virtual void setGeometry (const QRect &rect)
 Sets the currently allocated area to be the given rect. More...
 
virtual void setGeometry (const QRect &rect, const QRegion &mask)
 
virtual void setPermanentState (const QByteArray &state)
 Implement this function to attach a server-side surface instance to the corresponding client side instance using the given data. More...
 
virtual void setTransientState (const QByteArray &state)
 
SurfaceFlags surfaceFlags () const
 Returns the surface flags describing the contents of this surface. More...
 
virtual QByteArray transientState () const
 
virtual void unlock ()
 
int winId () const
 
 ~QWSWindowSurface ()
 
- Public Functions inherited from QWindowSurface
virtual QImagebuffer (const QWidget *widget)
 Returns a QImage pointer which represents the actual buffer the widget is drawn into or 0 if this is unavailable. More...
 
virtual WindowSurfaceFeatures features () const
 
QRect geometry () const
 Returns the currently allocated area on the screen. More...
 
virtual QPixmap grabWidget (const QWidget *widget, const QRect &rectangle=QRect()) const
 Returns a QPixmap generated from the part of the backing store corresponding to widget. More...
 
bool hasFeature (WindowSurfaceFeature feature) const
 
virtual QPoint offset (const QWidget *widget) const
 Returns the offset of widget in the coordinates of this window surface. More...
 
 QWindowSurface (QWidget *window, bool setDefaultSurface=true)
 Constructs an empty surface for the given top-level window. More...
 
QRect rect (const QWidget *widget) const
 Returns the rectangle for widget in the coordinates of this window surface. More...
 
virtual bool scroll (const QRegion &area, int dx, int dy)
 Scrolls the given area dx pixels to the right and dy downward; both dx and dy may be negative. More...
 
void setStaticContents (const QRegion &region)
 
QRegion staticContents () const
 
QWidgetwindow () const
 Returns a pointer to the top-level window associated with this surface. More...
 
virtual ~QWindowSurface ()
 Destroys this surface. More...
 

Protected Functions

void setSurfaceFlags (SurfaceFlags type)
 Sets the surface flags describing the contents of this surface, to be the given flags. More...
 
void setWinId (int id)
 
- Protected Functions inherited from QWindowSurface
bool hasStaticContents () const
 

Private Functions

void invalidateBuffer ()
 

Properties

QWSWindowSurfacePrivated_ptr
 

Friends

class QWidgetPrivate
 

Detailed Description

The QWSWindowSurface class provides the drawing area for top-level windows in Qt for Embedded Linux.

Since
4.2

This function is under development and subject to change.

Warning
This function is not part of the public interface.

Note that this class is only available in Qt for Embedded Linux.

In Qt for Embedded Linux, the default behavior is for each client to render its widgets into memory while the server is responsible for putting the contents of the memory onto the screen. QWSWindowSurface is used by the window system to implement the associated memory allocation.

When a screen update is required, the server runs through all the top-level windows that intersect with the region that is about to be updated, and ensures that the associated clients have updated their memory buffer. Then the server uses the screen driver to copy the content of the memory to the screen. To locate the relevant parts of memory, the driver is provided with the list of top-level windows that intersect with the given region. Associated with each of the top-level windows there is a window surface representing the drawing area of the window.

When deriving from the QWSWindowSurface class, e.g., when Adding an Accelerated Graphics Driver to Qt for Embedded Linux, there are several pure virtual functions that must be implemented. In addition, QWSWindowSurface provides several virtual functions that can be reimplemented to customize the drawing process.

Pure Virtual Functions

There are in fact two window surface instances for each top-level window; one used by the application when drawing a window, and another used by the server application to perform window compositioning. Implement the attach() to create the server-side representation of the surface. The data() function must be implemented to provide the required data.

Implement the key() function to uniquely identify the surface class, and the isValid() function to determine is a surface corresponds to a given widget.

The geometry() function must be implemented to let the window system determine the area required by the window surface (QWSWindowSurface also provides a corresponding virtual setGeometry() function that is called whenever the area necessary for the top-level window to be drawn, changes). The image() function is called by the window system during window compositioning, and must be implemented to return an image of the top-level window.

Finally, the paintDevice() function must be implemented to return the appropriate paint device, and the scroll() function must be implemented to scroll the given region of the surface the given number of pixels.

Virtual Functions

When painting onto the surface, the window system will always call the beginPaint() function before any painting operations are performed. Likewise the endPaint() function is automatically called when the painting is done. Reimplement the painterOffset() function to alter the offset that is applied when drawing.

The window system uses the flush() function to put a given region of the widget onto the screen, and the release() function to deallocate the screen region corresponding to this window surface.

Other Members

QWSWindowSurface provides the window() function returning a pointer to the top-level window the surface is representing. The currently visible region of the associated widget can be retrieved and set using the clipRegion() and setClipRegion() functions, respectively.

When the window system performs the window compositioning, it uses the SurfaceFlag enum describing the surface content. The currently set surface flags can be retrieved and altered using the surfaceFlags() and setSurfaceFlags() functions. In addition, QWSWindowSurface provides the isBuffered(), isOpaque() and isRegionReserved() convenience functions.

See also
{Qt for Embedded Linux Architecture::Drawing on Screen}{Qt for Embedded Linux Architecture}

Definition at line 68 of file qwindowsurface_qws_p.h.

Enumerations

◆ SurfaceFlag

This enum is used to describe the window surface's contents.

It is used by the screen driver to handle region allocation and composition.

  • RegionReserved The surface contains a reserved area. Once allocated, a reserved area can not not be changed by the window system, i.e., no other widgets can be drawn on top of this.
  • Buffered The surface is in a memory area which is not part of a framebuffer. (A top-level window with QWidget::windowOpacity() other than 1.0 must use a buffered surface in order to making blending with the background work.)
  • Opaque The surface contains only opaque pixels.
See also
surfaceFlags(), setSurfaceFlags()
Enumerator
RegionReserved 
Buffered 
Opaque 

Definition at line 113 of file qwindowsurface_qws_p.h.

Constructors and Destructors

◆ QWSWindowSurface() [1/2]

QWSWindowSurface::QWSWindowSurface ( )

Constructs an empty surface.

Definition at line 436 of file qwindowsurface_qws.cpp.

438 {
439 }
QWSWindowSurfacePrivate * d_ptr
QWindowSurface(QWidget *window, bool setDefaultSurface=true)
Constructs an empty surface for the given top-level window.

◆ QWSWindowSurface() [2/2]

QWSWindowSurface::QWSWindowSurface ( QWidget widget)

Constructs an empty surface for the given top-level widget.

Definition at line 444 of file qwindowsurface_qws.cpp.

446 {
447 }
QWSWindowSurfacePrivate * d_ptr
QWindowSurface(QWidget *window, bool setDefaultSurface=true)
Constructs an empty surface for the given top-level window.

◆ ~QWSWindowSurface()

QWSWindowSurface::~QWSWindowSurface ( )

Definition at line 449 of file qwindowsurface_qws.cpp.

450 {
451 #ifdef Q_BACKINGSTORE_SUBSURFACES
452  if (d_ptr->winId)
453  winIdToSurfaceMap()->remove(d_ptr->winId);
454 #endif
455 
456  delete d_ptr;
457 }
QWSWindowSurfacePrivate * d_ptr

Functions

◆ beginPaint()

void QWSWindowSurface::beginPaint ( const QRegion region)
virtual

This function is called before painting onto the surface begins, with the region in which the painting will occur.

See also
endPaint(), paintDevice()

Reimplemented from QWindowSurface.

Reimplemented in QWSDirectPainterSurface, QWSMemorySurface, and QDirectFBWindowSurface.

Definition at line 472 of file qwindowsurface_qws.cpp.

Referenced by QWSMemorySurface::beginPaint(), QWSDirectPainterSurface::beginPaint(), QWSMemorySurface::image(), and QWSDirectPainterSurface::screen().

473 {
474  lock();
475 }
virtual bool lock(int timeout=-1)

◆ clipRegion()

const QRegion QWSWindowSurface::clipRegion ( ) const

Returns the region currently visible on the screen.

See also
setClipRegion()

Definition at line 539 of file qwindowsurface_qws.cpp.

Referenced by QWidgetBackingStore::beginPaint(), QWidgetPrivate::moveRect(), QWSDirectPainterSurface::region(), QWidgetPrivate::scrollRect(), and QWidget::visibleRegion().

540 {
541  return d_ptr->clip;
542 }
QWSWindowSurfacePrivate * d_ptr

◆ endPaint()

void QWSWindowSurface::endPaint ( const QRegion region)
virtual

This function is called after painting onto the surface has ended, with the region in which the painting was performed.

See also
beginPaint(), paintDevice()

Reimplemented from QWindowSurface.

Reimplemented in QDirectFBWindowSurface.

Definition at line 477 of file qwindowsurface_qws.cpp.

478 {
479  unlock();
480 }

◆ flush()

void QWSWindowSurface::flush ( QWidget widget,
const QRegion region,
const QPoint offset 
)
virtual

Flushes the given region from the specified widget onto the screen.

Note that the offset parameter is currently unused.

Implements QWindowSurface.

Reimplemented in QWSDirectPainterSurface, QWSYellowSurface, QDirectFBWindowSurface, and PvrEglWindowSurface.

Definition at line 692 of file qwindowsurface_qws.cpp.

Referenced by QWSYellowSurface::isValid(), and QWSDirectPainterSurface::region().

694 {
695  const QWidget *win = window();
696  if (!win)
697  return;
698 
699 #ifndef QT_NO_GRAPHICSVIEW
700  QWExtra *extra = win->d_func()->extra;
701  if (extra && extra->proxyWidget)
702  return;
703 #endif //QT_NO_GRAPHICSVIEW
704 
705  Q_UNUSED(offset);
706 
707  const bool opaque = isOpaque();
708 #ifdef QT_QWS_DISABLE_FLUSHCLIPPING
709  QRegion toFlush = region;
710 #else
711  QRegion toFlush = region & d_ptr->clip;
712 #endif
713 
714  if (!toFlush.isEmpty()) {
715  flushUpdate(widget, toFlush, QPoint(0, 0));
716  QPoint globalZero = win->mapToGlobal(QPoint(0, 0));
717  toFlush.translate(globalZero);
718 
719 #ifdef QT_QWS_CLIENTBLIT
720  bool needRepaint = true;
721  if (opaque) {
722  QScreen* widgetScreen = getScreen(widget);
723  if (widgetScreen->supportsBlitInClients()) {
724 
726  if(directRegion().intersected(toFlush) == toFlush) {
727  QPoint translate = -globalZero + painterOffset() + geometry().topLeft();
728  QRegion flushRegion = toFlush.translated(translate);
729  widgetScreen->blit(image(), geometry().topLeft(), flushRegion);
730  widgetScreen->setDirty(toFlush.boundingRect());
731  needRepaint = false;
732  }
734  }
735  }
736 
737  if(needRepaint)
738 #endif
739  win->qwsDisplay()->repaintRegion(winId(), win->windowFlags(), opaque, toFlush);
740  }
741 }
QRect geometry() const
Returns the currently allocated area on the screen.
static QWSDisplay * qwsDisplay()
void repaintRegion(int winId, int windowFlags, bool opaque, QRegion)
static QScreen * getScreen(const QWidget *w)
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QRect boundingRect() const
Returns the bounding rectangle of this region.
Definition: qregion.cpp:4363
virtual void setDirty(const QRect &)
Marks the given rectangle as dirty.
QWSWindowSurfacePrivate * d_ptr
virtual void blit(const QImage &img, const QPoint &topLeft, const QRegion &region)
Copies the given region in the given image to the point specified by topLeft using device coordinates...
QGraphicsProxyWidget * proxyWidget
Definition: qwidget_p.h:251
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Definition: qregion.cpp:4098
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
static void grab()
virtual QPoint painterOffset() const
Returns the offset to be used when painting.
bool isOpaque() const
Returns true if the QWSWindowSurface::Opaque is set; otherwise returns false.
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
The QScreen class is a base class for screen drivers in Qt for Embedded Linux.
Definition: qscreen_qws.h:191
void translate(int dx, int dy)
Translates (moves) the region dx along the X axis and dy along the Y axis.
Definition: qregion.cpp:4116
QRegion translated(int dx, int dy) const
Returns a copy of the region that is translated dx along the x axis and dy along the y axis...
Definition: qregion.cpp:743
static void flushUpdate(QWidget *widget, const QRegion &region, const QPoint &offset)
Qt::WindowFlags windowFlags() const
Window flags are a combination of a type (e.
Definition: qwidget.h:939
static void ungrab()
virtual QImage image() const =0
Implement this function to return an image of the top-level window.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
QPoint mapToGlobal(const QPoint &) const
Translates the widget coordinate pos to global screen coordinates.
QWidget * window() const
Returns a pointer to the top-level window associated with this surface.
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

◆ image()

const QImage QWSWindowSurface::image ( ) const
pure virtual

Implement this function to return an image of the top-level window.

See also
geometry()

Implemented in QWSDirectPainterSurface, QWSYellowSurface, QWSMemorySurface, QDirectFBWindowSurface, PvrEglWindowSurface, and EGLNullWSWindowSurface.

Referenced by QScreen::blit(), QScreen::compose(), QDirectFBScreen::exposeRegion(), and flush().

◆ invalidateBuffer()

void QWSWindowSurface::invalidateBuffer ( )
private

Definition at line 149 of file qwindowsurface_qws.cpp.

Referenced by effectiveState(), and setGeometry().

150 {
151 
152  QWidget *win = window();
153  if (win) {
154  win->d_func()->invalidateBuffer(win->rect());
155 #ifndef QT_NO_QWS_MANAGER
156  QTLWExtra *topextra = win->d_func()->extra->topextra;
157  QWSManager *manager = topextra->qwsManager;
158  if (manager)
159  manager->d_func()->dirtyRegion(QDecoration::All,
161 #endif
162  }
163 }
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QRect rect
the internal geometry of the widget excluding any window frame
Definition: qwidget.h:168
QWidget * window() const
Returns a pointer to the top-level window associated with this surface.

◆ isBuffered()

bool QWSWindowSurface::isBuffered ( ) const
inline

Returns true if the QWSWindowSurface::Buffered is set; otherwise returns false.

See also
surfaceFlags()

Definition at line 125 of file qwindowsurface_qws_p.h.

Referenced by QScreen::compose(), QWSWindow::createSurface(), move(), QWSServerPrivate::request_region(), QWidgetPrivate::scrollRect(), setClipRegion(), setGeometry(), QWSServerPrivate::update_regions(), and QWSWindow::~QWSWindow().

125 { return surfaceFlags() & Buffered; }
SurfaceFlags surfaceFlags() const
Returns the surface flags describing the contents of this surface.

◆ isOpaque()

bool QWSWindowSurface::isOpaque ( ) const
inline

Returns true if the QWSWindowSurface::Opaque is set; otherwise returns false.

See also
surfaceFlags()

Definition at line 126 of file qwindowsurface_qws_p.h.

Referenced by flush(), QWSMemorySurface::isValid(), and QWSServerPrivate::request_region().

126 { return surfaceFlags() & Opaque; }
SurfaceFlags surfaceFlags() const
Returns the surface flags describing the contents of this surface.

◆ isRegionReserved()

bool QWSWindowSurface::isRegionReserved ( ) const
inline

Returns true if the QWSWindowSurface::RegionReserved is set; otherwise returns false.

See also
surfaceFlags()

Definition at line 122 of file qwindowsurface_qws_p.h.

Referenced by QWSTtyKbPrivate::handleConsoleSwitch(), QWSDirectPainterSurface::permanentState(), QWSServerPrivate::request_region(), and QWSServerPrivate::update_regions().

122  {
123  return surfaceFlags() & RegionReserved;
124  }
SurfaceFlags surfaceFlags() const
Returns the surface flags describing the contents of this surface.

◆ isValid()

bool QWSWindowSurface::isValid ( ) const
pure virtual

Implement this function to return true if the surface is a valid surface for the given top-level window; otherwise return false.

Since
4.3
See also
window(), key()

Implemented in QWSDirectPainterSurface, QWSYellowSurface, QWSOnScreenSurface, QWSMemorySurface, QDirectFBWindowSurface, PvrEglWindowSurface, and EGLNullWSWindowSurface.

Referenced by QWidgetBackingStore::beginPaint().

◆ key()

QString QWSWindowSurface::key ( ) const
pure virtual

◆ lock()

bool QWSWindowSurface::lock ( int  timeout = -1)
virtual

Reimplemented in QWSDirectPainterSurface, and QWSMemorySurface.

Definition at line 503 of file qwindowsurface_qws.cpp.

Referenced by beginPaint(), QScreen::blit(), QScreen::compose(), QWSMemorySurface::image(), and QWSDirectPainterSurface::screen().

504 {
505  Q_UNUSED(timeout);
506  return true;
507 }
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ move() [1/2]

bool QWSWindowSurface::move ( const QPoint offset)
virtual

Move the surface with the given offset.

A subclass may reimplement this function to enable accelerated window move. It must return true if the move was successful and no repaint is necessary, false otherwise.

The default implementation updates the QWindowSurface geometry and returns true if the surface is buffered; false otherwise.

This function is called by the window system on the client instance.

See also
isBuffered()

Reimplemented in QDirectFBWindowSurface, and PvrEglWindowSurface.

Definition at line 757 of file qwindowsurface_qws.cpp.

Referenced by effectiveState(), and PvrEglWindowSurface::move().

758 {
759  QWindowSurface::setGeometry(geometry().translated(offset));
760  return isBuffered();
761 }
QRect geometry() const
Returns the currently allocated area on the screen.
virtual void setGeometry(const QRect &rect)
Sets the currently allocated area to be the given rect.
bool isBuffered() const
Returns true if the QWSWindowSurface::Buffered is set; otherwise returns false.

◆ move() [2/2]

QRegion QWSWindowSurface::move ( const QPoint offset,
const QRegion newClip 
)
virtual

Move the surface with the given offset.

The new visible region after the window move is given by newClip in screen coordinates.

A subclass may reimplement this function to enable accelerated window move. The returned region indicates the area that still needs to be composed on the screen.

The default implementation updates the QWindowSurface geometry and returns the union of the old and new geometry.

This function is called by the window system on the server instance.

Definition at line 778 of file qwindowsurface_qws.cpp.

779 {
780  const QRegion oldGeometry = geometry();
781  QWindowSurface::setGeometry(geometry().translated(offset));
782  return oldGeometry + newClip;
783 }
QRect geometry() const
Returns the currently allocated area on the screen.
virtual void setGeometry(const QRect &rect)
Sets the currently allocated area to be the given rect.
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68

◆ paintDevice()

virtual QPaintDevice* QWSWindowSurface::paintDevice ( )
pure virtual

Implement this function to return the appropriate paint device.

Implements QWindowSurface.

Implemented in QWSDirectPainterSurface, QWSYellowSurface, QWSMemorySurface, QDirectFBWindowSurface, PvrEglWindowSurface, and EGLNullWSWindowSurface.

◆ painterOffset()

QPoint QWSWindowSurface::painterOffset ( ) const
virtual

Returns the offset to be used when painting.

See also
paintDevice()

Reimplemented in QWSOnScreenSurface, and QWSMemorySurface.

Definition at line 464 of file qwindowsurface_qws.cpp.

Referenced by QWidgetBackingStore::beginPaint(), flush(), QWSMemorySurface::image(), QWSMemorySurface::painterOffset(), and QWSOnScreenSurface::painterOffset().

465 {
466  const QWidget *w = window();
467  if (!w)
468  return QPoint();
469  return w->geometry().topLeft() - w->frameGeometry().topLeft();
470 }
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QRect frameGeometry
geometry of the widget relative to its parent including any window frame
Definition: qwidget.h:159
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
QRect geometry
the geometry of the widget relative to its parent and excluding the window frame
Definition: qwidget.h:158
QWidget * window() const
Returns a pointer to the top-level window associated with this surface.
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

◆ permanentState()

QByteArray QWSWindowSurface::permanentState ( ) const
virtual

Implement this function to return the data required for creating a server-side representation of the surface.

Since
4.3
See also
attach()

Reimplemented in QWSDirectPainterSurface, QWSYellowSurface, QWSOnScreenSurface, QWSSharedMemSurface, QWSLocalMemSurface, QDirectFBWindowSurface, and PvrEglWindowSurface.

Definition at line 488 of file qwindowsurface_qws.cpp.

Referenced by QWSLocalMemSurface::key(), QWSSharedMemSurface::key(), QWSOnScreenSurface::key(), QWSYellowSurface::key(), QWSDirectPainterSurface::key(), and setGeometry().

489 {
490  return QByteArray();
491 }
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135

◆ releaseSurface()

void QWSWindowSurface::releaseSurface ( )
virtual

◆ setClipRegion()

void QWSWindowSurface::setClipRegion ( const QRegion clip)

Sets the region currently visible on the screen to be the given clip region.

See also
clipRegion()

Definition at line 550 of file qwindowsurface_qws.cpp.

Referenced by qt_directpainter_region(), setGeometry(), and QETWidget::translateRegionEvent().

551 {
552  if (clip == d_ptr->clip)
553  return;
554 
555  QRegion expose = (clip - d_ptr->clip);
556  d_ptr->clip = clip;
557 
558  if (expose.isEmpty() || clip.isEmpty())
559  return; // No repaint or flush required.
560 
561  QWidget *win = window();
562  if (!win)
563  return;
564 
565  if (isBuffered()) {
566  // No repaint required. Flush exposed area via the backing store.
567  win->d_func()->syncBackingStore(expose);
568  return;
569  }
570 
571 #ifndef QT_NO_QWS_MANAGER
572  // Invalidate exposed decoration area.
573  if (win && win->isWindow()) {
574  QTLWExtra *topextra = win->d_func()->extra->topextra;
575  if (QWSManager *manager = topextra->qwsManager) {
576  QRegion decorationExpose(manager->region());
577  decorationExpose.translate(-win->geometry().topLeft());
578  decorationExpose &= expose;
579  if (!decorationExpose.isEmpty()) {
580  expose -= decorationExpose;
581  manager->d_func()->dirtyRegion(QDecoration::All, QDecoration::Normal, decorationExpose);
582  }
583  }
584  }
585 #endif
586 
587  // Invalidate exposed widget area.
588  win->d_func()->invalidateBuffer(expose);
589 }
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
bool isBuffered() const
Returns true if the QWSWindowSurface::Buffered is set; otherwise returns false.
QWSWindowSurfacePrivate * d_ptr
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Definition: qregion.cpp:4098
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
void translate(int dx, int dy)
Translates (moves) the region dx along the X axis and dy along the Y axis.
Definition: qregion.cpp:4116
QRect geometry
the geometry of the widget relative to its parent and excluding the window frame
Definition: qwidget.h:158
QWidget * window() const
Returns a pointer to the top-level window associated with this surface.
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

◆ setGeometry() [1/2]

void QWSWindowSurface::setGeometry ( const QRect rect)
virtual

Sets the currently allocated area to be the given rect.

This function is called whenever area covered by the top-level window changes.

See also
geometry()

Reimplemented from QWindowSurface.

Reimplemented in QWSDirectPainterSurface, QWSSharedMemSurface, QWSLocalMemSurface, QDirectFBWindowSurface, and PvrEglWindowSurface.

Definition at line 612 of file qwindowsurface_qws.cpp.

Referenced by QWidgetBackingStore::beginPaint(), PvrEglScreenSurfaceFunctions::createNativeWindow(), effectiveState(), isServerProcess(), PvrEglWindowSurface::setGeometry(), QDirectFBWindowSurface::setGeometry(), QWSLocalMemSurface::setGeometry(), and QWSSharedMemSurface::setGeometry().

613 {
614  QRegion mask = rect;
615 
616  const QWidget *win = window();
617  if (win) {
618 #ifndef QT_NO_QWS_MANAGER
619  if (win->isWindow()) {
620  QTLWExtra *topextra = win->d_func()->extra->topextra;
621  QWSManager *manager = topextra->qwsManager;
622 
623  if (manager) {
624  // The frame geometry is the bounding rect of manager->region,
625  // which could be too much, so we need to clip.
626  mask &= (manager->region() + win->geometry());
627  }
628  }
629 #endif
630 
631  const QRegion winMask = win->mask();
632  if (!winMask.isEmpty())
633  mask &= winMask.translated(win->geometry().topLeft());
634  }
635 
636  setGeometry(rect, mask);
637 }
QRect rect(const QWidget *widget) const
Returns the rectangle for widget in the coordinates of this window surface.
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Definition: qregion.cpp:4098
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
QRegion mask() const
Returns the mask currently set on a widget.
Definition: qwidget.cpp:10058
QRegion translated(int dx, int dy) const
Returns a copy of the region that is translated dx along the x axis and dy along the y axis...
Definition: qregion.cpp:743
QRect geometry
the geometry of the widget relative to its parent and excluding the window frame
Definition: qwidget.h:158
QWidget * window() const
Returns a pointer to the top-level window associated with this surface.
virtual void setGeometry(const QRect &rect)
Sets the currently allocated area to be the given rect.
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

◆ setGeometry() [2/2]

void QWSWindowSurface::setGeometry ( const QRect rect,
const QRegion mask 
)
virtual

Definition at line 639 of file qwindowsurface_qws.cpp.

640 {
641  if (rect == geometry()) // XXX: && mask == prevMask
642  return;
643 
644  const bool isResize = rect.size() != geometry().size();
645  const bool needsRepaint = isResize || !isBuffered();
646 
648 
649  const QRegion region = mask & rect;
650  QWidget *win = window();
651  // Only request regions for widgets visible on the screen.
652  // (Added the !win check for compatibility reasons, because
653  // there was no "if (win)" check before).
654  const bool requestQWSRegion = !win || !win->testAttribute(Qt::WA_DontShowOnScreen);
655  if (requestQWSRegion)
657 
658  if (needsRepaint)
660 
661  if (!requestQWSRegion) {
662  // We didn't request a region, hence we won't get a QWSRegionEvent::Allocation
663  // event back from the server so we set the clip directly. We have to
664  // do this after the invalidateBuffer() call above, as it might trigger a
665  // backing store sync, resulting in too many update requests.
666  setClipRegion(region);
667  }
668 }
QRect geometry() const
Returns the currently allocated area on the screen.
static QWSDisplay * qwsDisplay()
QRect rect(const QWidget *widget) const
Returns the rectangle for widget in the coordinates of this window surface.
virtual QByteArray permanentState() const
Implement this function to return the data required for creating a server-side representation of the ...
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
virtual void setGeometry(const QRect &rect)
Sets the currently allocated area to be the given rect.
bool isBuffered() const
Returns true if the QWSWindowSurface::Buffered is set; otherwise returns false.
void requestRegion(int winId, const QString &surfacekey, const QByteArray &surfaceData, const QRegion &region)
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
QSize size() const
Returns the size of the rectangle.
Definition: qrect.h:309
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
virtual QString key() const =0
Implement this function to return a string that uniquely identifies the class of this surface...
void setClipRegion(const QRegion &)
Sets the region currently visible on the screen to be the given clip region.
QWidget * window() const
Returns a pointer to the top-level window associated with this surface.

◆ setPermanentState()

void QWSWindowSurface::setPermanentState ( const QByteArray data)
virtual

Implement this function to attach a server-side surface instance to the corresponding client side instance using the given data.

Since
4.3

Return true if successful; otherwise return false.

See also
data()

Reimplemented in QWSDirectPainterSurface, QWSYellowSurface, QWSOnScreenSurface, QWSSharedMemSurface, QWSLocalMemSurface, QDirectFBWindowSurface, and PvrEglWindowSurface.

Definition at line 498 of file qwindowsurface_qws.cpp.

Referenced by QWSWindow::createSurface(), QWSLocalMemSurface::key(), QWSSharedMemSurface::key(), QWSOnScreenSurface::key(), QWSYellowSurface::key(), QWSDirectPainterSurface::key(), and QWSServerPrivate::request_region().

499 {
500  Q_UNUSED(state);
501 }
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setSurfaceFlags()

void QWSWindowSurface::setSurfaceFlags ( SurfaceFlags  flags)
protected

◆ setTransientState()

void QWSWindowSurface::setTransientState ( const QByteArray state)
virtual

Definition at line 493 of file qwindowsurface_qws.cpp.

494 {
495  Q_UNUSED(state);
496 }
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setWinId()

void QWSWindowSurface::setWinId ( int  id)
protected

◆ surfaceFlags()

QWSWindowSurface::SurfaceFlags QWSWindowSurface::surfaceFlags ( ) const

◆ transientState()

QByteArray QWSWindowSurface::transientState ( ) const
virtual

Definition at line 483 of file qwindowsurface_qws.cpp.

484 {
485  return QByteArray();
486 }
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135

◆ unlock()

void QWSWindowSurface::unlock ( )
virtual

◆ winId()

int QWSWindowSurface::winId ( ) const

Definition at line 179 of file qwindowsurface_qws.cpp.

Referenced by QWSDirectPainterSurface::beginPaint(), effectiveState(), flush(), QWSYellowSurface::flush(), QWSDirectPainterSurface::flush(), QWSDirectPainterSurface::QWSDirectPainterSurface(), QWSYellowSurface::QWSYellowSurface(), setGeometry(), QWSDirectPainterSurface::setRegion(), QWSDirectPainterSurface::windowId(), and QWSDirectPainterSurface::~QWSDirectPainterSurface().

180 {
181  // XXX: the widget winId may change during the lifetime of the widget!!!
182 
183  const QWidget *win = window();
184  if (win && win->isWindow())
185  return win->internalWinId();
186 
187 #ifdef Q_BACKINGSTORE_SUBSURFACES
188  if (!d_ptr->winId) {
189  QWSWindowSurface *that = const_cast<QWSWindowSurface*>(this);
191  const int id = display->takeId();
192  qt_insertWindowSurface(id, that);
193  that->d_ptr->winId = id;
194 
195  if (win)
196  display->nameRegion(id, win->objectName(), win->windowTitle());
197  else
198  display->nameRegion(id, QString(), QString());
199 
200  display->setAltitude(id, 1, true); // XXX
201  }
202 #endif
203 
204  return d_ptr->winId;
205 }
void nameRegion(int winId, const QString &n, const QString &c)
The QWSWindowSurface class provides the drawing area for top-level windows in Qt for Embedded Linux...
The QWSDisplay class provides a display for QWS; it is an internal class.
void setAltitude(int winId, int altitude, bool fixed=false)
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
The QString class provides a Unicode character string.
Definition: qstring.h:83
QWSWindowSurfacePrivate * d_ptr
Q_GUI_EXPORT EGLDisplay display()
Definition: qegl.cpp:589
QString windowTitle
the window title (caption)
Definition: qwidget.h:198
QString objectName() const
WId internalWinId() const
Returns the window system identifier of the widget, or 0 if the widget is not created yet...
Definition: qwidget.h:244
static QWSDisplay * instance()
QWidget * window() const
Returns a pointer to the top-level window associated with this surface.

Friends and Related Functions

◆ QWidgetPrivate

friend class QWidgetPrivate
friend

Definition at line 136 of file qwindowsurface_qws_p.h.

Properties

◆ d_ptr

QWSWindowSurfacePrivate* QWSWindowSurface::d_ptr
private

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