56 #include "private/qwsdisplay_qws_p.h" 59 #include <private/qwsmanager_p.h> 60 #include <private/qbackingstore_p.h> 61 #include <private/qwindowsurface_qws_p.h> 62 #include <private/qwslock_p.h> 93 return (qwsServer != 0);
140 #ifndef QT_NO_WARNING_OUTPUT 141 static bool toolWarningShown =
false;
144 "This behavior will change in a later release. To ensure compatibility with\n" 145 "future versions, use (Qt::Tool | Qt::FramelessWindowHint).");
146 toolWarningShown =
true;
154 initializeWindow =
true;
160 int sw = screens[0]->width();
161 int sh = screens[0]->height();
164 dialog = popup =
false;
168 int height = 4 * sh / 10;
179 }
else if (desktop) {
183 if (otherDesktop && otherDesktop->testWFlags(Qt::WPaintDesktop)) {
184 otherDesktop->d_func()->setWinId(0);
186 otherDesktop->d_func()->setWinId(
id);
198 bool hasFrame =
true;
207 }
else if (topLevel) {
209 if (initializeWindow) {
218 #ifndef QT_NO_QWS_MANAGER 222 QRegion r = QApplication::qwsDecoration().region(q, cr) | cr;
226 br.right() - cr.
right(),
227 br.bottom() - cr.
bottom());
231 topData()->qwsManager =
new QWSManager(q);
233 topData()->qwsManager->maximize();
236 }
else if (
topData()->qwsManager) {
261 parentWidget()->d_func()->invalidateBuffer(
d->effectiveRectFor(geometry()));
263 d->deactivateWidgetCleanup();
267 for (
int i = 0; i < childObjects.
size(); ++i) {
270 static_cast<QWidget*>(obj)->destroy(destroySubWindows,
274 if (qt_pressGrab ==
this)
277 if (keyboardGrb ==
this)
282 qApp->d_func()->closePopup(
this);
301 if (destroyWindow && isWindow()) {
302 if (
d->extra &&
d->extra->topextra &&
d->extra->topextra->backingStore)
303 d->extra->topextra->backingStore->windowSurface->setGeometry(
QRect());
304 qwsDisplay()->destroyRegion(internalWinId());
309 }
QT_CATCH (
const std::bad_alloc &) {
320 if (q->isVisible() && q->parentWidget() &&
parent != q->parentWidget())
321 q->parentWidget()->d_func()->invalidateBuffer(
effectiveRectFor(q->geometry()));
326 oldcurs = q->cursor();
340 if (
parent != newparent) {
367 if (q->isWindow() || (!newparent || newparent->
isVisible()) || explicitlyHidden)
380 q->setFocusPolicy(fp);
386 if ((
int)old_winid > 0) {
392 q->setCursor(oldcurs);
400 int x=pos.
x(), y=pos.
y();
412 int x=pos.
x(), y=pos.
y();
423 void QWidget::setMicroFocusHint(
int x,
int y,
int width,
int height,
426 if (
QRect(x, y, width, height) != microFocusHint()) {
428 d->extra->micro_focus_hint.setRect(x, y, width, height);
430 #ifndef QT_NO_QWS_INPUTMETHODS 444 QInputContext::setMicroFocusWidget(
this);
446 qwsDisplay()->setIMInfo(winid, gp.
x(), gp.
y(), r);
449 qwsDisplay()->setInputFont(winid, font());
472 #endif //QT_NO_CURSOR 487 if (unscaledPixmap.isNull()) {
489 QImage unscaledIcon = unscaledPixmap.toImage();
508 qwsDisplay()->grabMouse(
this,
true);
520 qwsDisplay()->grabMouse(
this,
true);
521 qwsDisplay()->selectCursor(
this, cursor.
handle());
529 if (qt_mouseGrb ==
this) {
530 qwsDisplay()->grabMouse(
this,
false);
539 qwsDisplay()->grabKeyboard(
this,
true);
545 if (keyboardGrb ==
this) {
546 qwsDisplay()->grabKeyboard(
this,
false);
595 const QRect frameRect = q->frameGeometry();
596 if (surface->geometry() != frameRect)
597 surface->setGeometry(frameRect);
600 QRegion r = localRequestedRegion();
601 #ifndef QT_NO_QWS_MANAGER 613 if (!staysontop && q->parentWidget()) {
622 if (!q->objectName().isEmpty()) {
626 #ifdef Q_BACKINGSTORE_SUBSURFACES 635 if (!q->window()->data->in_show) {
676 void QWidgetPrivate::setMaxWindowState_helper()
684 #ifndef QT_NO_QWS_MANAGER 694 q->setGeometry(maxWindowRect);
699 void QWidgetPrivate::setFullScreenSize_helper()
706 const QRect screen =
qApp->desktop()->screenGeometry(
qApp->desktop()->screenNumber(q));
708 q->resize(screen.
size());
716 Qt::WindowStates
oldstate = windowState();
717 if (oldstate == newstate)
724 bool needShow =
false;
727 if (isWindow() && newEffectiveState != oldEffectiveState) {
730 d->topData()->normalGeometry = geometry();
743 d->topData()->savedFlags = windowFlags();
745 d->setFullScreenSize_helper();
750 d->setMaxWindowState_helper();
752 QRect r =
d->topData()->normalGeometry;
753 if (r.
width() >= 0) {
754 d->topData()->normalGeometry =
QRect(0,0,-1,-1);
785 #ifdef QT_NO_WINDOWGROUPHINT 790 for (
int i = 0; i < childObjects.
size(); ++i) {
799 for (
int i = 0; i < toraise.
size(); ++i) {
805 #endif // QT_NO_WINDOWGROUPHINT 834 if (!s->
move(offset))
850 QPoint oldp = q->geometry().topLeft();
851 QSize olds = q->size();
854 bool isResize = olds != r.
size();
874 if (q->isVisible()) {
876 bool toplevelMove =
false;
885 if (isMove && !isResize && surface) {
886 const QPoint offset(x - oldp.x(), y - oldp.y());
887 moveSurface(surface, offset);
890 #ifdef Q_BACKINGSTORE_SUBSURFACES 892 for (
int i = 0; i < surfaces.
size(); ++i)
893 moveSurface(surfaces.
at(i), offset);
907 #ifdef Q_BACKINGSTORE_SUBSURFACES 914 for (
int i = 0; i < surfaces.
size(); ++i) {
921 #ifdef Q_BACKINGSTORE_SUBSURFACES 926 if (isMove && !isResize) {
927 moveSurface(surface,
QPoint(x - oldp.x(), y - oldp.y()));
935 if (isMove && !isResize)
953 if (isMove && q->pos() != oldPos)
996 }
else if (m == PdmWidthMM) {
997 const QScreen *screen =
d->getScreen();
999 }
else if (m == PdmHeight) {
1001 }
else if (m == PdmHeightMM) {
1002 const QScreen *screen =
d->getScreen();
1004 }
else if (m == PdmDepth) {
1005 return qwsDisplay()->depth();
1006 }
else if (m == PdmDpiX || m == PdmPhysicalDpiX) {
1007 if (
d->extra &&
d->extra->customDpiX)
1008 return d->extra->customDpiX;
1010 return static_cast<QWidget *
>(
d->parent)->metric(m);
1011 const QScreen *screen =
d->getScreen();
1013 }
else if (m == PdmDpiY || m == PdmPhysicalDpiY) {
1014 if (
d->extra &&
d->extra->customDpiY)
1015 return d->extra->customDpiY;
1017 return static_cast<QWidget *
>(
d->parent)->metric(m);
1018 const QScreen *screen =
d->getScreen();
1020 }
else if (m == PdmNumColors) {
1024 const int depth = qwsDisplay()->depth();
1060 #ifndef QT_NO_QWS_MANAGER 1074 QRegion QWidgetPrivate::localRequestedRegion()
const 1084 QRegion QWidgetPrivate::localAllocatedRegion()
const 1094 if (!q->isWindow()) {
1113 if (!q->isVisible() || !q->isWindow())
1122 surface->QWindowSurface::setGeometry(
QRect());
1131 if(!q->isVisible() || (q->windowType() ==
Qt::Desktop)) {
1136 #ifndef QT_NO_QWS_MANAGER 1146 contents.
top() - frame.
top(),
1155 #ifndef QT_NO_CURSOR 1156 void QWidgetPrivate::updateCursor()
const 1169 if (!localAllocatedRegion().contains(pos - offset))
1173 if (!w || w->
cursor().
handle() == q->cursor().handle())
1175 q->cursor().handle());
1192 qWarning(
"QWidget::paintEngine: Should no longer be called");
1212 q->ensurePolished();
Q_GUI_EXPORT QScreen * qt_screen
void moveRegion(int winId, int dx, int dy)
HCURSOR_or_HANDLE handle() const
Returns a platform-specific cursor handle.
void nameRegion(int winId, const QString &n, const QString &c)
QRect geometry() const
Returns the currently allocated area on the screen.
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.
static QPixmap fromImage(const QImage &image, Qt::ImageConversionFlags flags=Qt::AutoColor)
Converts the given image to a pixmap using the specified flags to control the conversion.
int height() const
Returns the logical height of the framebuffer in pixels.
void setBottom(int pos)
Sets the bottom edge of the rectangle to the given y coordinate.
The QCursor class provides a mouse cursor with an arbitrary shape.
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
#define QT_END_NAMESPACE
This macro expands to.
Q_CORE_EXPORT QTextStream & ws(QTextStream &s)
void setOpacity(int winId, int opacity)
void selectCursor(QWidget *w, unsigned int id)
void setAltitude(int winId, int altitude, bool fixed=false)
int physicalHeight() const
Returns the physical height of the screen in millimeters.
static QWSDisplay * qwsDisplay()
static QScreen * getScreen(const QWidget *w)
static Expression::Ptr create(Expression *const expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
int left() const
Returns the x-coordinate of the rectangle's left edge.
QRect translated(int dx, int dy) const
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis...
virtual void setGeometry(const QRect &rect)
Sets the currently allocated area to be the given rect.
int width() const
Returns the width of the rectangle.
QRect boundingRect() const
Returns the bounding rectangle of this region.
int height() const
Returns the height of the rectangle.
int bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
The QString class provides a Unicode character string.
The QObject class is the base class of all Qt objects.
void destroyRegion(int winId)
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
void setParent(QObject *)
Makes the object a child of parent.
void setParent_helper(QObject *)
The QBitmap class provides monochrome (1-bit depth) pixmaps.
int width() const
Returns the logical width of the framebuffer in pixels.
int width() const
Returns the width.
void append(const T &t)
Inserts value at the end of the list.
static QCursor * overrideCursor()
Strips out vertical alignment flags and transforms an alignment align of Qt::AlignLeft into Qt::Align...
#define QT_BEGIN_NAMESPACE
This macro expands to.
The QMoveEvent class contains event parameters for move events.
virtual void widgetDestroyed(QWidget *w)
This virtual function is called when the specified widget is destroyed.
virtual bool move(const QPoint &offset)
Move the surface with the given offset.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
QSize size() const
Returns the size of the rectangle.
const T & at(int i) const
Returns the item at index position i in the list.
The QResizeEvent class contains event parameters for resize events.
Q_CORE_EXPORT void qWarning(const char *,...)
void setSize(const QSize &s)
Sets the size of the rectangle to the given size.
The QImage class provides a hardware-independent image representation that allows direct access to th...
#define QT_VERSION_STR
This macro expands to a string that specifies Qt's version number (for example, "4.
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
The QRegion class specifies a clip region for a painter.
void setCoords(int x1, int y1, int x2, int y2)
Sets the coordinates of the rectangle's top-left corner to (x1, y1), and the coordinates of its botto...
The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a g...
The QWindowSurface class provides the drawing area for top-level windows.
static QWidget * parentWidget(const QWidget *w)
static QDesktopWidget * desktop()
Returns the desktop widget (also called the root window).
virtual QWSWindowSurface * createSurface(QWidget *widget) const
Creates and returns a new window surface for the given widget.
bool isWidgetType() const
Returns true if the object is a widget; otherwise returns false.
int top() const
Returns the y-coordinate of the rectangle's top edge.
The QWindowStateChangeEvent class provides the window state before a window state change...
int right() const
Returns the x-coordinate of the rectangle's right edge.
The QWSServer class encapsulates a server process in Qt for Embedded Linux.
QBitmap mask() const
Extracts a bitmap mask from the pixmap's alpha channel.
static QInputContext * inputContext
The QFont class specifies a font used for drawing text.
int y() const
Returns the y-coordinate of the rectangle's top edge.
int colorCount()
Returns the number of entries in the screen's color lookup table (i.
int x() const
Returns the x-coordinate of the rectangle's left edge.
virtual QList< QScreen * > subScreens() const
void setRect(int x, int y, int w, int h)
Sets the coordinates of the rectangle's top-left corner to ({x}, {y}), and its size to the given widt...
The QPoint class defines a point in the plane using integer precision.
int size() const
Returns the number of items in the list.
int height() const
Returns the height.
The QRect class defines a rectangle in the plane using integer precision.
The QScreen class is a base class for screen drivers in Qt for Embedded Linux.
virtual int metric(PaintDeviceMetric metric) const
int y() const
Returns the y coordinate of this point.
#define QT_USE_NAMESPACE
This macro expands to using QT_NAMESPACE if QT_NAMESPACE is defined and nothing otherwise.
The QPixmap class is an off-screen image representation that can be used as a paint device...
void translate(int dx, int dy)
Translates (moves) the region dx along the X axis and dy along the Y axis.
The QSize class defines the size of a two-dimensional object using integer point precision.
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...
bool intersects(const QRect &r) const
Returns true if this rectangle intersects with the given rectangle (i.
static QWSDisplay * instance()
int x() const
Returns the x coordinate of this point.
The QInputContext class abstracts the input method dependent data and composing state.
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...
void requestFocus(int winId, bool get)
QBitmap createHeuristicMask(bool clipTight=true) const
Creates and returns a heuristic mask for this pixmap.
int physicalWidth() const
Returns the physical width of the screen in millimeters.
static void leaveModal(QWidget *)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Q_DECL_CONSTEXPR int qRound(qreal d)
virtual void setGeometry(const QRect &rect)
Sets the currently allocated area to be the given rect.
void setWindowCaption(QWidget *w, const QString &)
The QList class is a template class that provides lists.
static Qt::KeyboardModifiers oldstate
QPoint topLeft() const
Returns the position of the rectangle's top-left corner.