Qt 4.8
qwidget_qws.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #include "qcursor.h"
43 #include "qapplication.h"
44 #include "qapplication_p.h"
45 #include "qpainter.h"
46 #include "qbitmap.h"
47 #include "qimage.h"
48 #include "qhash.h"
49 #include "qstack.h"
50 #include "qlayout.h"
51 #include "qtextcodec.h"
52 #include "qinputcontext.h"
53 #include "qdesktopwidget.h"
54 
55 #include "qwsdisplay_qws.h"
56 #include "private/qwsdisplay_qws_p.h"
57 #include "qscreen_qws.h"
58 #include "qwsmanager_qws.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>
63 #include "qpaintengine.h"
64 
65 #include "qdebug.h"
66 
67 #include "qwidget_p.h"
68 
70 
72 
73 extern int *qt_last_x;
74 extern int *qt_last_y;
75 extern WId qt_last_cursor;
76 extern bool qws_overrideCursor;
77 extern QWidget *qt_pressGrab;
78 extern QWidget *qt_mouseGrb;
79 
80 static QWidget *keyboardGrb = 0;
81 
82 static int takeLocalId()
83 {
84  static int n=-1000;
85  return --n;
86 }
87 
88 class QWSServer;
89 extern QWSServer *qwsServer;
90 
91 static inline bool isServerProcess()
92 {
93  return (qwsServer != 0);
94 }
95 
96 /*****************************************************************************
97  QWidget member functions
98  *****************************************************************************/
99 
100 void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool /*destroyOldWindow*/)
101 {
102  Q_Q(QWidget);
103  Qt::WindowType type = q->windowType();
104 
105  // Make sure the WindowTitleHint is on if any of the title bar hints are set
106  // Note: This might be moved to cross-platform QWidgetPrivate::adjustFlags()
114  }
115 
116  // Decoration plugins on QWS don't support switching on the close button on its own
119 
120  Qt::WindowFlags flags = data.window_flags;
121 
123 
124  // we don't have a "Drawer" window type
125  if (type == Qt::Drawer) {
126  type = Qt::Widget;
127  flags &= ~Qt::WindowType_Mask;
128  }
129 
130 
131  bool topLevel = (flags & Qt::Window);
132  bool popup = (type == Qt::Popup);
133  bool dialog = (type == Qt::Dialog
134  || type == Qt::Sheet
135  || (flags & Qt::MSWindowsFixedSizeDialogHint));
136  bool desktop = (type == Qt::Desktop);
137  bool tool = (type == Qt::Tool || type == Qt::SplashScreen || type == Qt::ToolTip);
138 
139 
140 #ifndef QT_NO_WARNING_OUTPUT
141  static bool toolWarningShown = false;
142  if (!toolWarningShown && type == Qt::Tool && !(flags & Qt::FramelessWindowHint)) {
143  qWarning("Qt for Embedded Linux " QT_VERSION_STR " does not support tool windows with frames.\n"
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;
147  }
148 #endif
149 
150  WId id;
152 
153  if (!window) // always initialize
154  initializeWindow = true;
155 
156  // use the size of the primary screen to determine the default window size
158  if (screens.isEmpty())
159  screens.append(qt_screen);
160  int sw = screens[0]->width();
161  int sh = screens[0]->height();
162 
163  if (desktop) { // desktop widget
164  dialog = popup = false; // force these flags off
165  data.crect.setRect(0, 0, sw, sh);
166  } else if (topLevel && !q->testAttribute(Qt::WA_Resized)) {
167  int width = sw / 2;
168  int height = 4 * sh / 10;
169  if (extra) {
170  width = qMax(qMin(width, extra->maxw), extra->minw);
171  height = qMax(qMin(height, extra->maxh), extra->minh);
172  }
173  data.crect.setSize(QSize(width, height));
174  }
175 
176  if (window) { // override the old window
177  id = window;
178  setWinId(window);
179  } else if (desktop) { // desktop widget
180  id = (WId)-2; // id = root window
181 #if 0
182  QWidget *otherDesktop = q->find(id); // is there another desktop?
183  if (otherDesktop && otherDesktop->testWFlags(Qt::WPaintDesktop)) {
184  otherDesktop->d_func()->setWinId(0); // remove id from widget mapper
185  setWinId(id); // make sure otherDesktop is
186  otherDesktop->d_func()->setWinId(id); // found first
187  } else
188 #endif
189  {
190  setWinId(id);
191  }
192  } else {
193  id = topLevel ? dpy->takeId() : takeLocalId();
194  setWinId(id); // set widget id/handle + hd
195  }
196 
197 
198  bool hasFrame = true;
199  if (topLevel) {
200  if (desktop || popup || tool || q->testAttribute(Qt::WA_DontShowOnScreen))
201  hasFrame = false;
202  else
203  hasFrame = !(flags & Qt::FramelessWindowHint);
204  }
205  if (desktop) {
206  q->setAttribute(Qt::WA_WState_Visible);
207  } else if (topLevel) { // set X cursor
208  //QCursor *oc = QApplication::overrideCursor();
209  if (initializeWindow) {
210  //XXX XDefineCursor(dpy, winid, oc ? oc->handle() : cursor().handle());
211  }
212  QWidget::qwsDisplay()->nameRegion(q->internalWinId(), q->objectName(), q->windowTitle());
213  }
214 
215  if (topLevel) {
216  createTLExtra();
217  QTLWExtra *topextra = extra->topextra;
218 #ifndef QT_NO_QWS_MANAGER
219  if (hasFrame) {
220  // get size of wm decoration and make the old crect the new frect
221  QRect cr = data.crect;
222  QRegion r = QApplication::qwsDecoration().region(q, cr) | cr;
223  QRect br(r.boundingRect());
224  topextra->frameStrut.setCoords(cr.x() - br.x(),
225  cr.y() - br.y(),
226  br.right() - cr.right(),
227  br.bottom() - cr.bottom());
228  if (!q->testAttribute(Qt::WA_Moved) || topextra->posFromMove)
229  data.crect.translate(topextra->frameStrut.left(), topextra->frameStrut.top());
230  if (!topData()->qwsManager) {
231  topData()->qwsManager = new QWSManager(q);
232  if((q->data->window_state & ~Qt::WindowActive) == Qt::WindowMaximized)
233  topData()->qwsManager->maximize();
234  }
235 
236  } else if (topData()->qwsManager) {
237  delete topData()->qwsManager;
238  topData()->qwsManager = 0;
239  data.crect.translate(-topextra->frameStrut.left(), -topextra->frameStrut.top());
240  topextra->frameStrut.setCoords(0, 0, 0, 0);
241  }
242 #endif
243  if (!topextra->caption.isEmpty())
244  setWindowTitle_helper(topextra->caption);
245 
246  //XXX If we are session managed, inform the window manager about it
247  } else {
248  if (extra && extra->topextra) { // already allocated due to reparent?
249  extra->topextra->frameStrut.setCoords(0, 0, 0, 0);
250  }
251  //updateRequestedRegion(mapToGlobal(QPoint(0,0)));
252  }
253 }
254 
255 
256 void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
257 {
258  Q_D(QWidget);
259  d->aboutToDestroy();
260  if (!isWindow() && parentWidget())
261  parentWidget()->d_func()->invalidateBuffer(d->effectiveRectFor(geometry()));
262 
263  d->deactivateWidgetCleanup();
264  if (testAttribute(Qt::WA_WState_Created)) {
265  setAttribute(Qt::WA_WState_Created, false);
266  QObjectList childObjects = children();
267  for (int i = 0; i < childObjects.size(); ++i) {
268  QObject *obj = childObjects.at(i);
269  if (obj->isWidgetType())
270  static_cast<QWidget*>(obj)->destroy(destroySubWindows,
271  destroySubWindows);
272  }
273  releaseMouse();
274  if (qt_pressGrab == this)
275  qt_pressGrab = 0;
276 
277  if (keyboardGrb == this)
278  releaseKeyboard();
279  if (testAttribute(Qt::WA_ShowModal)) // just be sure we leave modal
281  else if ((windowType() == Qt::Popup))
282  qApp->d_func()->closePopup(this);
283 #ifndef QT_NO_IM
284  if (d->ic) {
285  delete d->ic;
286  d->ic =0;
287  } else {
288  // release previous focus information participating with
289  // preedit preservation of qic -- while we still have a winId
291  if (qic)
292  qic->widgetDestroyed(this);
293  }
294 #endif //QT_NO_IM
295 
296  if ((windowType() == Qt::Desktop)) {
297  } else {
298  if (parentWidget() && parentWidget()->testAttribute(Qt::WA_WState_Created)) {
299  d->hide_sys();
300  }
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());
305  }
306  }
307  QT_TRY {
308  d->setWinId(0);
309  } QT_CATCH (const std::bad_alloc &) {
310  // swallow - destructors must not throw
311  }
312  }
313 }
314 
315 
316 void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f)
317 {
318  Q_Q(QWidget);
319  bool wasCreated = q->testAttribute(Qt::WA_WState_Created);
320  if (q->isVisible() && q->parentWidget() && parent != q->parentWidget())
321  q->parentWidget()->d_func()->invalidateBuffer(effectiveRectFor(q->geometry()));
322 #ifndef QT_NO_CURSOR
323  QCursor oldcurs;
324  bool setcurs=q->testAttribute(Qt::WA_SetCursor);
325  if (setcurs) {
326  oldcurs = q->cursor();
327  q->unsetCursor();
328  }
329 #endif
330 
331  WId old_winid = data.winid;
332  if ((q->windowType() == Qt::Desktop))
333  old_winid = 0;
334 
335  if (!q->isWindow() && q->parentWidget() && q->parentWidget()->testAttribute(Qt::WA_WState_Created))
336  hide_sys();
337 
338  setWinId(0);
339 
340  if (parent != newparent) {
341  QWidget *oldparent = q->parentWidget();
343  if (oldparent) {
344 // oldparent->d_func()->setChildrenAllocatedDirty();
345 // oldparent->data->paintable_region_dirty = true;
346  }
347  if (newparent) {
348 // newparent->d_func()->setChildrenAllocatedDirty();
349 // newparent->data->paintable_region_dirty = true;
350  //@@@@@@@
351  }
352  }
353  Qt::FocusPolicy fp = q->focusPolicy();
354  QSize s = q->size();
355  //QBrush bgc = background(); // save colors
356  bool explicitlyHidden = q->testAttribute(Qt::WA_WState_Hidden) && q->testAttribute(Qt::WA_WState_ExplicitShowHide);
357 
358  data.window_flags = f;
359  q->setAttribute(Qt::WA_WState_Created, false);
360  q->setAttribute(Qt::WA_WState_Visible, false);
361  q->setAttribute(Qt::WA_WState_Hidden, false);
363  // keep compatibility with previous versions, we need to preserve the created state
364  // (but we recreate the winId for the widget being reparented, again for compatibility)
365  if (wasCreated || (!q->isWindow() && newparent->testAttribute(Qt::WA_WState_Created)))
366  createWinId();
367  if (q->isWindow() || (!newparent || newparent->isVisible()) || explicitlyHidden)
368  q->setAttribute(Qt::WA_WState_Hidden);
369  q->setAttribute(Qt::WA_WState_ExplicitShowHide, explicitlyHidden);
370 
371  if (q->isWindow()) {
372  QRect fs = frameStrut();
373  data.crect = QRect(fs.left(), fs.top(), s.width(), s.height());
375  extra->topextra->frameStrut.setCoords(0, 0, 0, 0);
376  } else {
377  data.crect = QRect(0, 0, s.width(), s.height());
378  }
379 
380  q->setFocusPolicy(fp);
381  if (extra && !extra->mask.isEmpty()) {
382  QRegion r = extra->mask;
383  extra->mask = QRegion();
384  q->setMask(r);
385  }
386  if ((int)old_winid > 0) {
387  QWidget::qwsDisplay()->destroyRegion(old_winid);
389  }
390 #ifndef QT_NO_CURSOR
391  if (setcurs) {
392  q->setCursor(oldcurs);
393  }
394 #endif
395 }
396 
397 
398 QPoint QWidget::mapToGlobal(const QPoint &pos) const
399 {
400  int x=pos.x(), y=pos.y();
401  const QWidget* w = this;
402  while (w) {
403  x += w->data->crect.x();
404  y += w->data->crect.y();
405  w = w->isWindow() ? 0 : w->parentWidget();
406  }
407  return QPoint(x, y);
408 }
409 
410 QPoint QWidget::mapFromGlobal(const QPoint &pos) const
411 {
412  int x=pos.x(), y=pos.y();
413  const QWidget* w = this;
414  while (w) {
415  x -= w->data->crect.x();
416  y -= w->data->crect.y();
417  w = w->isWindow() ? 0 : w->parentWidget();
418  }
419  return QPoint(x, y);
420 }
421 
422 #if 0 // #####
423 void QWidget::setMicroFocusHint(int x, int y, int width, int height,
424  bool text, QFont *)
425 {
426  if (QRect(x, y, width, height) != microFocusHint()) {
427  d->createExtra();
428  d->extra->micro_focus_hint.setRect(x, y, width, height);
429  }
430 #ifndef QT_NO_QWS_INPUTMETHODS
431  if (text) {
432  QWidget *tlw = window();
433  int winid = tlw->internalWinId();
434  QPoint p(x, y + height);
435  QPoint gp = mapToGlobal(p);
436 
437  QRect r = QRect(mapToGlobal(QPoint(0,0)),
438  size());
439 
440  r.setBottom(tlw->geometry().bottom());
441 
442  //qDebug("QWidget::setMicroFocusHint %d %d %d %d", r.x(),
443  // r.y(), r.width(), r.height());
444  QInputContext::setMicroFocusWidget(this);
445 
446  qwsDisplay()->setIMInfo(winid, gp.x(), gp.y(), r);
447 
448  //send font info, ###if necessary
449  qwsDisplay()->setInputFont(winid, font());
450  }
451 #endif
452 }
453 #endif
454 
456 
457 #ifndef QT_NO_CURSOR
458 void QWidgetPrivate::setCursor_sys(const QCursor &cursor)
459 {
460  Q_UNUSED(cursor);
461  Q_Q(QWidget);
462  if (q->isVisible())
463  updateCursor();
464 }
465 
467 {
468  Q_Q(QWidget);
469  if (q->isVisible())
470  updateCursor();
471 }
472 #endif //QT_NO_CURSOR
473 
474 void QWidgetPrivate::setWindowTitle_sys(const QString &caption)
475 {
476  Q_Q(QWidget);
477  QWidget::qwsDisplay()->setWindowCaption(q, caption);
478 }
479 
480 void QWidgetPrivate::setWindowIcon_sys(bool /*forceReset*/)
481 {
482 #if 0
483  QTLWExtra* x = d->topData();
484  delete x->icon;
485  x->icon = 0;
486  QBitmap mask;
487  if (unscaledPixmap.isNull()) {
488  } else {
489  QImage unscaledIcon = unscaledPixmap.toImage();
490  QPixmap pixmap =
492  x->icon = new QPixmap(pixmap);
493  mask = pixmap.mask() ? *pixmap.mask() : pixmap.createHeuristicMask();
494  }
495 #endif
496 }
497 
499 {
500  Q_UNUSED(iconText);
501 }
502 
503 void QWidget::grabMouse()
504 {
505  if (qt_mouseGrb)
506  qt_mouseGrb->releaseMouse();
507 
508  qwsDisplay()->grabMouse(this,true);
509 
510  qt_mouseGrb = this;
511  qt_pressGrab = 0;
512 }
513 
514 #ifndef QT_NO_CURSOR
515 void QWidget::grabMouse(const QCursor &cursor)
516 {
517  if (qt_mouseGrb)
518  qt_mouseGrb->releaseMouse();
519 
520  qwsDisplay()->grabMouse(this,true);
521  qwsDisplay()->selectCursor(this, cursor.handle());
522  qt_mouseGrb = this;
523  qt_pressGrab = 0;
524 }
525 #endif
526 
528 {
529  if (qt_mouseGrb == this) {
530  qwsDisplay()->grabMouse(this,false);
531  qt_mouseGrb = 0;
532  }
533 }
534 
536 {
537  if (keyboardGrb)
538  keyboardGrb->releaseKeyboard();
539  qwsDisplay()->grabKeyboard(this, true);
540  keyboardGrb = this;
541 }
542 
544 {
545  if (keyboardGrb == this) {
546  qwsDisplay()->grabKeyboard(this, false);
547  keyboardGrb = 0;
548  }
549 }
550 
551 
553 {
554  if (qt_mouseGrb)
555  return qt_mouseGrb;
556  return qt_pressGrab;
557 }
558 
559 
561 {
562  return keyboardGrb;
563 }
564 
566 {
567  QWidget *tlw = window();
568  if (tlw->isVisible()) {
570  qwsDisplay()->requestFocus(tlw->internalWinId(), true);
571  }
572 }
573 
575 {
576  Q_Q(QWidget);
577  q->setAttribute(Qt::WA_Mapped);
578  if (q->testAttribute(Qt::WA_DontShowOnScreen)) {
579  invalidateBuffer(q->rect());
580  return;
581  }
582 
583  if (q->isWindow()) {
584 
585 
586  if (!q->testAttribute(Qt::WA_ShowWithoutActivating)
587  && q->windowType() != Qt::Popup
588  && q->windowType() != Qt::Tool
589  && q->windowType() != Qt::ToolTip) {
591  }
592 
593 
594  if (QWindowSurface *surface = q->windowSurface()) {
595  const QRect frameRect = q->frameGeometry();
596  if (surface->geometry() != frameRect)
597  surface->setGeometry(frameRect);
598  }
599 
600  QRegion r = localRequestedRegion();
601 #ifndef QT_NO_QWS_MANAGER
602  if (extra && extra->topextra && extra->topextra->qwsManager) {
604  r += extra->topextra->qwsManager->region();
605  r.translate(-data.crect.topLeft());
606  }
607 #endif
608  data.fstrut_dirty = true;
609  invalidateBuffer(r);
610  bool staysontop =
611  (q->windowFlags() & Qt::WindowStaysOnTopHint)
612  || q->windowType() == Qt::Popup;
613  if (!staysontop && q->parentWidget()) { // if our parent stays on top, so must we
614  QWidget *ptl = q->parentWidget()->window();
615  if (ptl && (ptl->windowFlags() & Qt::WindowStaysOnTopHint))
616  staysontop = true;
617  }
618 
621  QWidget::qwsDisplay()->setAltitude(data.winid, altitude, true);
622  if (!q->objectName().isEmpty()) {
623  QWidget::qwsDisplay()->setWindowCaption(q, q->windowTitle());
624  }
625  }
626 #ifdef Q_BACKINGSTORE_SUBSURFACES
627  else if ( extra && extra->topextra && extra->topextra->windowSurface) {
628  QWSWindowSurface *surface;
629  surface = static_cast<QWSWindowSurface*>(q->windowSurface());
630  const QPoint p = q->mapToGlobal(QPoint());
631  surface->setGeometry(QRect(p, q->size()));
632  }
633 #endif
634 
635  if (!q->window()->data->in_show) {
636  invalidateBuffer(q->rect());
637  }
638 }
639 
640 
642 {
643  Q_Q(QWidget);
645 
646  if (q->isWindow()) {
647  q->releaseMouse();
648 // requestWindowRegion(QRegion());
649 
652 
653 
655  } else {
656  QWidget *p = q->parentWidget();
657  if (p &&p->isVisible()) {
658  invalidateBuffer(q->rect());
659  }
660  }
661 }
662 
663 
664 
665 static Qt::WindowStates effectiveState(Qt::WindowStates state)
666  {
667  if (state & Qt::WindowMinimized)
668  return Qt::WindowMinimized;
669  else if (state & Qt::WindowFullScreen)
670  return Qt::WindowFullScreen;
671  else if (state & Qt::WindowMaximized)
672  return Qt::WindowMaximized;
673  return Qt::WindowNoState;
674  }
675 
676 void QWidgetPrivate::setMaxWindowState_helper()
677 {
678  // in_set_window_state is usually set in setWindowState(), but this
679  // function is used in other functions as well
680  // (e.g QApplicationPrivate::setMaxWindowRect())
681  const uint old_state = data.in_set_window_state;
683 
684 #ifndef QT_NO_QWS_MANAGER
685  if (extra && extra->topextra && extra->topextra->qwsManager)
686  extra->topextra->qwsManager->maximize();
687  else
688 #endif
689  {
690  Q_Q(QWidget);
691  const QDesktopWidget *desktop = QApplication::desktop();
692  const int screen = desktop->screenNumber(q);
693  const QRect maxWindowRect = desktop->availableGeometry(screen);
694  q->setGeometry(maxWindowRect);
695  }
696  data.in_set_window_state = old_state;
697 }
698 
699 void QWidgetPrivate::setFullScreenSize_helper()
700 {
701  Q_Q(QWidget);
702 
703  const uint old_state = data.in_set_window_state;
705 
706  const QRect screen = qApp->desktop()->screenGeometry(qApp->desktop()->screenNumber(q));
707  q->move(screen.topLeft());
708  q->resize(screen.size());
709 
710  data.in_set_window_state = old_state;
711 }
712 
713 void QWidget::setWindowState(Qt::WindowStates newstate)
714 {
715  Q_D(QWidget);
716  Qt::WindowStates oldstate = windowState();
717  if (oldstate == newstate)
718  return;
719  if (isWindow() && !testAttribute(Qt::WA_WState_Created))
720  create();
721 
722  data->window_state = newstate;
724  bool needShow = false;
725  Qt::WindowStates newEffectiveState = effectiveState(newstate);
726  Qt::WindowStates oldEffectiveState = effectiveState(oldstate);
727  if (isWindow() && newEffectiveState != oldEffectiveState) {
728  d->createTLExtra();
729  if (oldEffectiveState == Qt::WindowNoState) { //normal
730  d->topData()->normalGeometry = geometry();
731  } else if (oldEffectiveState == Qt::WindowFullScreen) {
732  setParent(0, d->topData()->savedFlags);
733  needShow = true;
734  } else if (oldEffectiveState == Qt::WindowMinimized) {
735  needShow = true;
736  }
737 
738  if (newEffectiveState == Qt::WindowMinimized) {
739  //### not ideal...
740  hide();
741  needShow = false;
742  } else if (newEffectiveState == Qt::WindowFullScreen) {
743  d->topData()->savedFlags = windowFlags();
745  d->setFullScreenSize_helper();
746  raise();
747  needShow = true;
748  } else if (newEffectiveState == Qt::WindowMaximized) {
749  createWinId();
750  d->setMaxWindowState_helper();
751  } else { //normal
752  QRect r = d->topData()->normalGeometry;
753  if (r.width() >= 0) {
754  d->topData()->normalGeometry = QRect(0,0,-1,-1);
755  setGeometry(r);
756  }
757  }
758  }
760 
761  if (needShow)
762  show();
763 
764  if (newstate & Qt::WindowActive)
765  activateWindow();
766 
767  QWindowStateChangeEvent e(oldstate);
768  QApplication::sendEvent(this, &e);
769 }
770 
772 {
773 
774 }
775 
777 {
778  Q_Q(QWidget);
779  //@@@ transaction
780  if (q->isWindow()) {
781  Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
782  QWidget::qwsDisplay()->setAltitude(q->internalWinId(),
784  // XXX: subsurfaces?
785 #ifdef QT_NO_WINDOWGROUPHINT
786 #else
787  QObjectList childObjects = q->children();
788  if (!childObjects.isEmpty()) {
789  QWidgetList toraise;
790  for (int i = 0; i < childObjects.size(); ++i) {
791  QObject *obj = childObjects.at(i);
792  if (obj->isWidgetType()) {
793  QWidget* w = static_cast<QWidget*>(obj);
794  if (w->isWindow())
795  toraise.append(w);
796  }
797  }
798 
799  for (int i = 0; i < toraise.size(); ++i) {
800  QWidget *w = toraise.at(i);
801  if (w->isVisible())
802  w->raise();
803  }
804  }
805 #endif // QT_NO_WINDOWGROUPHINT
806  }
807 }
808 
810 {
811  Q_Q(QWidget);
812  if (q->isWindow()) {
813  Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
816  } else if (QWidget *p = q->parentWidget()) {
818  p->d_func()->invalidateBuffer(effectiveRectFor(q->geometry()));
819  }
820 }
821 
823 {
824  Q_Q(QWidget);
825  if (QWidget *p = q->parentWidget()) {
827  p->d_func()->invalidateBuffer(effectiveRectFor(q->geometry()));
828  }
829 }
830 
831 void QWidgetPrivate::moveSurface(QWindowSurface *surface, const QPoint &offset)
832 {
833  QWSWindowSurface *s = static_cast<QWSWindowSurface*>(surface);
834  if (!s->move(offset))
835  s->invalidateBuffer();
836 
837  QWSDisplay::instance()->moveRegion(s->winId(), offset.x(), offset.y());
838 }
839 
840 void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
841 {
842  Q_Q(QWidget);
843  if (extra) { // any size restrictions?
844  w = qMin(w,extra->maxw);
845  h = qMin(h,extra->maxh);
846  w = qMax(w,extra->minw);
847  h = qMax(h,extra->minh);
848  }
849 
850  QPoint oldp = q->geometry().topLeft();
851  QSize olds = q->size();
852  QRect r(x, y, w, h);
853 
854  bool isResize = olds != r.size();
855  isMove = oldp != r.topLeft(); //### why do we have isMove as a parameter?
856 
857  // We only care about stuff that changes the geometry, or may
858  // cause the window manager to change its state
859  if (r.size() == olds && oldp == r.topLeft())
860  return;
861 
862  if (!data.in_set_window_state) {
863  q->data->window_state &= ~Qt::WindowMaximized;
864  q->data->window_state &= ~Qt::WindowFullScreen;
865  if (q->isWindow())
866  topData()->normalGeometry = QRect(0, 0, -1, -1);
867  }
868  QPoint oldPos = q->pos();
869  data.crect = r;
870 
871  if ((q->windowType() == Qt::Desktop))
872  return;
873 
874  if (q->isVisible()) {
875 
876  bool toplevelMove = false;
877  QWSWindowSurface *surface = 0;
878 
879  if (q->isWindow()) {
880  //### ConfigPending not implemented, do we need it?
881  //setAttribute(Qt::WA_WState_ConfigPending);
883  if (bs)
884  surface = static_cast<QWSWindowSurface*>(bs->windowSurface);
885  if (isMove && !isResize && surface) {
886  const QPoint offset(x - oldp.x(), y - oldp.y());
887  moveSurface(surface, offset);
888  toplevelMove = true; //server moves window, but we must send moveEvent, which might trigger painting
889 
890 #ifdef Q_BACKINGSTORE_SUBSURFACES
891  QList<QWindowSurface*> surfaces = bs->subSurfaces;
892  for (int i = 0; i < surfaces.size(); ++i)
893  moveSurface(surfaces.at(i), offset);
894 #endif
895  } else {
897  }
898  }
899 
900  if (!toplevelMove) {
901  if (q->isWindow()) {
902  if (surface)
903  surface->setGeometry(q->frameGeometry());
904  else
905  invalidateBuffer(q->rect()); //###
906 
907 #ifdef Q_BACKINGSTORE_SUBSURFACES
908  // XXX: should not resize subsurfaces. Children within a layout
909  // will be resized automatically while children with a static
910  // geometry should get a new clip region instead.
911  const QRect clipRect = q->geometry();
913  QList<QWindowSurface*> surfaces = bs->subSurfaces;
914  for (int i = 0; i < surfaces.size(); ++i) {
915  QWSWindowSurface *s = static_cast<QWSWindowSurface*>(surfaces.at(i));
916  QRect srect = s->geometry();
917  s->setGeometry(clipRect & srect);
918  }
919 #endif
920  }
921 #ifdef Q_BACKINGSTORE_SUBSURFACES
922  // XXX: merge this case with the isWindow() case
923  else if (maybeTopData() && maybeTopData()->windowSurface) {
924  QWSWindowSurface *surface;
925  surface = static_cast<QWSWindowSurface*>(q->windowSurface());
926  if (isMove && !isResize) {
927  moveSurface(surface, QPoint(x - oldp.x(), y - oldp.y()));
928  } else {
929  const QPoint p = q->mapToGlobal(QPoint());
930  surface->setGeometry(QRect(p, QSize(w, h)));
931  }
932  }
933 #endif
934  else {
935  if (isMove && !isResize)
936  moveRect(QRect(oldPos, olds), x - oldPos.x(), y - oldPos.y());
937  else
938  invalidateBuffer_resizeHelper(oldPos, olds);
939  }
940  }
941 
942  //### must have frame geometry correct before sending move/resize events
943  if (isMove) {
944  QMoveEvent e(q->pos(), oldPos);
946  }
947  if (isResize) {
948  QResizeEvent e(r.size(), olds);
950  }
951 
952  } else { // not visible
953  if (isMove && q->pos() != oldPos)
954  q->setAttribute(Qt::WA_PendingMoveEvent, true);
955  if (isResize)
956  q->setAttribute(Qt::WA_PendingResizeEvent, true);
957  }
958 }
959 
961 {
962 }
963 
965 {
966  Q_Q(const QWidget);
967 
968  const QList<QScreen*> subScreens = qt_screen->subScreens();
969  if (subScreens.isEmpty() || q->windowType() == Qt::Desktop)
970  return qt_screen;
971 
972  const int screen = QApplication::desktop()->screenNumber(q);
973 
974  return qt_screen->subScreens().at(screen < 0 ? 0 : screen);
975 }
976 
977 void QWidgetPrivate::scroll_sys(int dx, int dy)
978 {
979  Q_Q(QWidget);
980  scrollChildren(dx, dy);
981  scrollRect(q->rect(), dx, dy);
982 }
983 
984 void QWidgetPrivate::scroll_sys(int dx, int dy, const QRect &r)
985 {
986  scrollRect(r, dx, dy);
987 }
988 
989 int QWidget::metric(PaintDeviceMetric m) const
990 {
991  Q_D(const QWidget);
992 
993  int val;
994  if (m == PdmWidth) {
995  val = data->crect.width();
996  } else if (m == PdmWidthMM) {
997  const QScreen *screen = d->getScreen();
998  val = data->crect.width() * screen->physicalWidth() / screen->width();
999  } else if (m == PdmHeight) {
1000  val = data->crect.height();
1001  } else if (m == PdmHeightMM) {
1002  const QScreen *screen = d->getScreen();
1003  val = data->crect.height() * screen->physicalHeight() / screen->height();
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;
1009  else if (d->parent)
1010  return static_cast<QWidget *>(d->parent)->metric(m);
1011  const QScreen *screen = d->getScreen();
1012  return qRound(screen->width() / double(screen->physicalWidth() / 25.4));
1013  } else if (m == PdmDpiY || m == PdmPhysicalDpiY) {
1014  if (d->extra && d->extra->customDpiY)
1015  return d->extra->customDpiY;
1016  else if (d->parent)
1017  return static_cast<QWidget *>(d->parent)->metric(m);
1018  const QScreen *screen = d->getScreen();
1019  return qRound(screen->height() / double(screen->physicalHeight() / 25.4));
1020  } else if (m == PdmNumColors) {
1021  QScreen *screen = d->getScreen();
1022  int ret = screen->colorCount();
1023  if (!ret) {
1024  const int depth = qwsDisplay()->depth();
1025  switch (depth) {
1026  case 1:
1027  ret = 2;
1028  break;
1029  case 8:
1030  ret = 256;
1031  break;
1032  case 16:
1033  ret = 65536;
1034  break;
1035  case 24:
1036  ret = 16777216;
1037  break;
1038  case 32:
1039  ret = 2147483647;
1040  break;
1041  }
1042  }
1043  return ret;
1044  } else {
1045  val = QPaintDevice::metric(m);// XXX
1046  }
1047  return val;
1048 }
1049 
1051 {
1052 }
1053 
1055 {
1056 }
1057 
1059 {
1060 #ifndef QT_NO_QWS_MANAGER
1061  extra->topextra->qwsManager = 0;
1062 #endif
1063 }
1064 
1066 {
1067 }
1068 
1070 {
1071  Q_UNUSED(on);
1072 }
1073 
1074 QRegion QWidgetPrivate::localRequestedRegion() const
1075 {
1076  Q_Q(const QWidget);
1077  QRegion r(q->rect());
1078  if (extra && !extra->mask.isEmpty())
1079  r &= extra->mask;
1080 
1081  return r;
1082 }
1083 
1084 QRegion QWidgetPrivate::localAllocatedRegion() const
1085 {
1086  Q_Q(const QWidget);
1087 
1088  QWidgetBackingStore *wbs = q->window()->d_func()->maybeBackingStore();
1089 
1090  QWindowSurface *ws = wbs ? wbs->windowSurface : 0;
1091  if (!ws)
1092  return QRegion();
1093  QRegion r = static_cast<QWSWindowSurface*>(ws)->clipRegion();
1094  if (!q->isWindow()) {
1095  QPoint off = q->mapTo(q->window(), QPoint());
1096  r &= localRequestedRegion().translated(off);
1097  r.translate(-off);
1098  }
1099  return r;
1100 }
1101 
1102 inline bool QRect::intersects(const QRect &r) const
1103 {
1104  return (qMax(x1, r.x1) <= qMin(x2, r.x2) &&
1105  qMax(y1, r.y1) <= qMin(y2, r.y2));
1106 }
1107 
1108 void QWidgetPrivate::setMask_sys(const QRegion &region)
1109 {
1110  Q_UNUSED(region);
1111  Q_Q(QWidget);
1112 
1113  if (!q->isVisible() || !q->isWindow())
1114  return;
1115 
1116  data.fstrut_dirty = true;
1117  invalidateBuffer(q->rect());
1119  if (surface) {
1120  // QWSWindowSurface::setGeometry() returns without doing anything
1121  // if old geom == new geom. Therefore, we need to reset the old value.
1122  surface->QWindowSurface::setGeometry(QRect());
1123  surface->setGeometry(q->frameGeometry());
1124  }
1125 }
1126 
1128 {
1129  Q_Q(QWidget);
1130 
1131  if(!q->isVisible() || (q->windowType() == Qt::Desktop)) {
1132  data.fstrut_dirty = q->isVisible();
1133  return;
1134  }
1135 
1136 #ifndef QT_NO_QWS_MANAGER
1137  if (extra && extra->topextra && extra->topextra->qwsManager) {
1138  QTLWExtra *topextra = extra->topextra;
1139  const QRect oldFrameStrut = topextra->frameStrut;
1140  const QRect contents = data.crect;
1141  QRegion r = localRequestedRegion().translated(contents.topLeft());
1142  r += extra->topextra->qwsManager->region();
1143  const QRect frame = r.boundingRect();
1144 
1145  topextra->frameStrut.setCoords(contents.left() - frame.left(),
1146  contents.top() - frame.top(),
1147  frame.right() - contents.right(),
1148  frame.bottom() - contents.bottom());
1149  topextra->qwsManager->repaintRegion(QDecoration::All, QDecoration::Normal);
1150  }
1151 #endif
1152  data.fstrut_dirty = false;
1153 }
1154 
1155 #ifndef QT_NO_CURSOR
1156 void QWidgetPrivate::updateCursor() const
1157 {
1158  Q_Q(const QWidget);
1159 
1161  return;
1162 
1163  if (qt_last_x
1165  && qt_last_cursor != (WId)q->cursor().handle())
1166  {
1167  const QPoint pos(*qt_last_x, *qt_last_y);
1168  const QPoint offset = q->mapToGlobal(QPoint());
1169  if (!localAllocatedRegion().contains(pos - offset))
1170  return;
1171 
1172  const QWidget *w = q->childAt(q->mapFromGlobal(pos));
1173  if (!w || w->cursor().handle() == q->cursor().handle())
1174  QWidget::qwsDisplay()->selectCursor(const_cast<QWidget*>(q),
1175  q->cursor().handle());
1176  }
1177 }
1178 #endif
1179 
1181 {
1182  Q_Q(QWidget);
1183  Q_UNUSED(level);
1184  createWinId();
1185  QWidget::qwsDisplay()->setOpacity(q->data->winid, topData()->opacity);
1186 }
1187 
1188 //static QSingleCleanupHandler<QWSPaintEngine> qt_paintengine_cleanup_handler;
1189 //static QWSPaintEngine *qt_widget_paintengine = 0;
1191 {
1192  qWarning("QWidget::paintEngine: Should no longer be called");
1193  return 0; //##### @@@
1194 // if (!qt_widget_paintengine) {
1195 // qt_widget_paintengine = new QRasterPaintEngine();
1196 // qt_paintengine_cleanup_handler.set(&qt_widget_paintengine);
1197 // }
1198 // if (qt_widget_paintengine->isActive()) {
1199 // if (d->extraPaintEngine)
1200 // return d->extraPaintEngine;
1201 // const_cast<QWidget *>(this)->d_func()->extraPaintEngine = new QRasterPaintEngine();
1202 // return d->extraPaintEngine;
1203 // }
1204 // return qt_widget_paintengine;
1205 }
1206 
1208 {
1209  Q_Q(QWidget);
1210  if (q->windowType() == Qt::Desktop)
1211  return 0;
1212  q->ensurePolished();
1213  return qt_screen->createSurface(q);
1214 }
1215 
1217 {
1218 }
1219 
1220 
static bool isServerProcess()
Definition: qwidget_qws.cpp:91
Q_GUI_EXPORT QScreen * qt_screen
Definition: qscreen_qws.cpp:69
void moveRegion(int winId, int dx, int dy)
HCURSOR_or_HANDLE handle() const
Returns a platform-specific cursor handle.
Definition: qcursor_mac.mm:301
double d
Definition: qnumeric_p.h:62
void nameRegion(int winId, const QString &n, const QString &c)
QPoint mapToGlobal(const QPoint &pos) const
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...
void setParent_sys(QWidget *parent, Qt::WindowFlags)
The QWSDisplay class provides a display for QWS; it is an internal class.
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
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.
Definition: qpixmap.cpp:2197
unsigned long WId
Definition: qwindowdefs.h:119
void grabMouse()
Grabs the mouse input.
void setWindowIcon_sys(bool forceReset=false)
int type
Definition: qmetatype.cpp:239
int height() const
Returns the logical height of the framebuffer in pixels.
Definition: qscreen_qws.h:228
double qreal
Definition: qglobal.h:1193
void setBottom(int pos)
Sets the bottom edge of the rectangle to the given y coordinate.
Definition: qrect.h:267
The QCursor class provides a mouse cursor with an arbitrary shape.
Definition: qcursor.h:89
int * qt_last_x
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
int metric(PaintDeviceMetric) const
Internal implementation of the virtual QPaintDevice::metric() function.
Q_CORE_EXPORT QTextStream & ws(QTextStream &s)
void setOpacity(int winId, int opacity)
void selectCursor(QWidget *w, unsigned int id)
QRect frameStrut
Definition: qwidget_p.h:180
void setAltitude(int winId, int altitude, bool fixed=false)
int physicalHeight() const
Returns the physical height of the screen in millimeters.
Definition: qscreen_qws.h:291
void setWindowState(Qt::WindowStates state)
Sets the window state to windowState.
int y1
Definition: qrect.h:177
QRect crect
Definition: qwidget.h:131
static QWSDisplay * qwsDisplay()
QWindowSurface * windowSurface
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition: qwidget.h:945
bool isVisible() const
Definition: qwidget.h:1005
static QScreen * getScreen(const QWidget *w)
int y2
Definition: qrect.h:179
static Expression::Ptr create(Expression *const expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
QWindowSurface * windowSurface
Definition: qwidget_p.h:167
static void adjustFlags(Qt::WindowFlags &flags, QWidget *w=0)
Definition: qwidget.cpp:1242
QRect clipRect() const
Definition: qwidget.cpp:1997
void setWindowTitle_sys(const QString &cap)
void moveRect(const QRect &, int dx, int dy)
uint window_state
Definition: qwidget.h:120
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
int left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:240
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...
Definition: qrect.h:328
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.
Definition: qrect.h:303
void deleteTLSysExtra()
QRect boundingRect() const
Returns the bounding rectangle of this region.
Definition: qregion.cpp:4363
int alloc_region_index
Definition: qwidget.h:142
void show_sys()
Platform-specific part of QWidget::show().
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
The QString class provides a Unicode character string.
Definition: qstring.h:83
int * qt_last_y
WindowType
Definition: qnamespace.h:270
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
QTLWExtra * maybeTopData() const
Definition: qwidget_p.h:1010
#define Q_D(Class)
Definition: qglobal.h:2482
void scrollChildren(int dx, int dy)
Definition: qwidget.cpp:421
QObjectList children
Definition: qobject.h:93
void setCursor_sys(const QCursor &cursor)
uint in_set_window_state
Definition: qwidget.h:125
qint32 minw
Definition: qwidget_p.h:264
void destroyRegion(int winId)
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
QWidget * qt_pressGrab
void registerDropSite(bool)
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
void setParent(QObject *)
Makes the object a child of parent.
Definition: qobject.cpp:1950
#define Q_Q(Class)
Definition: qglobal.h:2483
QWidgetData data
Definition: qwidget_p.h:755
void deactivateWidgetCleanup()
Definition: qwidget.cpp:2496
void setParent_helper(QObject *)
Definition: qobject.cpp:1974
The QBitmap class provides monochrome (1-bit depth) pixmaps.
Definition: qbitmap.h:55
int width() const
Returns the logical width of the framebuffer in pixels.
Definition: qscreen_qws.h:227
NSWindow * window
int width() const
Returns the width.
Definition: qsize.h:126
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
void create_sys(WId window, bool initializeWindow, bool destroyOldWindow)
void unsetCursor_sys()
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.
Definition: qglobal.h:89
QRect normalGeometry
Definition: qwidget_p.h:181
The QMoveEvent class contains event parameters for move events.
Definition: qevent.h:334
void createTLExtra()
Definition: qwidget.cpp:1755
virtual void widgetDestroyed(QWidget *w)
This virtual function is called when the specified widget is destroyed.
void destroy(bool destroyWindow=true, bool destroySubWindows=true)
Frees up window system resources.
void setDirtyOpaqueRegion()
Definition: qwidget.cpp:2075
virtual bool move(const QPoint &offset)
Move the surface with the given offset.
void releaseMouse()
Releases the mouse grab.
static QWidget * mouseGrabber()
Returns the widget that is currently grabbing the mouse input.
qint32 maxw
Definition: qwidget_p.h:266
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
void raise()
Raises this widget to the top of the parent widget&#39;s stack.
Definition: qwidget.cpp:11901
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Definition: qregion.cpp:4098
#define qApp
QRect frameStrut() const
Definition: qwidget.cpp:12607
Qt::WindowFlags window_flags
Definition: qwidget.h:119
QWidget * childAt(int x, int y) const
Returns the visible child widget at the position ({x}, {y}) in the widget&#39;s coordinate system...
Definition: qwidget.h:934
qint32 maxh
Definition: qwidget_p.h:267
QWidget * qt_mouseGrb
QSize size() const
Returns the size of the rectangle.
Definition: qrect.h:309
void hide_sys()
Platform-specific part of QWidget::hide().
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
void setConstraints_sys()
static QWidget * find(WId)
Returns a pointer to the widget with window identifer/handle id.
Definition: qwidget.cpp:2517
QWidgetData * data
Definition: qwidget.h:815
void updateFrameStrut()
Computes the frame rectangle when needed.
The QResizeEvent class contains event parameters for resize events.
Definition: qevent.h:349
Q_CORE_EXPORT void qWarning(const char *,...)
void setSize(const QSize &s)
Sets the size of the rectangle to the given size.
Definition: qrect.h:448
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
unsigned int uint
Definition: qglobal.h:996
#define QT_VERSION_STR
This macro expands to a string that specifies Qt&#39;s version number (for example, "4.
Definition: qglobal.h:47
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.
Definition: qregion.h:68
QCursor cursor
the cursor shape for this widget
Definition: qwidget.h:183
QTLWExtra * topData() const
Definition: qwidget_p.h:1004
void setCoords(int x1, int y1, int x2, int y2)
Sets the coordinates of the rectangle&#39;s top-left corner to (x1, y1), and the coordinates of its botto...
Definition: qrect.h:416
void setWindowTitle_helper(const QString &cap)
Definition: qwidget.cpp:6285
The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a g...
Definition: qpaintengine.h:90
void deleteSysExtra()
#define QT_CATCH(A)
Definition: qglobal.h:1537
QWSServer * qwsServer
The QWindowSurface class provides the drawing area for top-level windows.
bool qws_overrideCursor
static QWidget * parentWidget(const QWidget *w)
void invalidateBuffer(const QRegion &)
Invalidates the rgn (in widget&#39;s coordinates) of the backing store, i.e.
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.
void grabKeyboard()
Grabs the keyboard input.
bool isWidgetType() const
Returns true if the object is a widget; otherwise returns false.
Definition: qobject.h:146
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
QRegion mask
Definition: qwidget_p.h:260
The QWindowStateChangeEvent class provides the window state before a window state change...
Definition: qevent.h:705
int right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:246
QTLWExtra * topextra
Definition: qwidget_p.h:249
QWindowSurface * createDefaultWindowSurface_sys()
The QWSServer class encapsulates a server process in Qt for Embedded Linux.
QBitmap mask() const
Extracts a bitmap mask from the pixmap&#39;s alpha channel.
Definition: qpixmap.cpp:2077
static QInputContext * inputContext
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
QPaintEngine * paintEngine() const
Returns the widget&#39;s paint engine.
int colorCount()
Returns the number of entries in the screen&#39;s color lookup table (i.
Definition: qscreen_qws.h:249
void setMask_sys(const QRegion &)
void createWinId(WId id=0)
Definition: qwidget.cpp:2574
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
virtual QList< QScreen * > subScreens() const
Definition: qscreen_qws.h:283
void setRect(int x, int y, int w, int h)
Sets the coordinates of the rectangle&#39;s top-left corner to ({x}, {y}), and its size to the given widt...
Definition: qrect.h:400
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
static QWidget * keyboardGrabber()
Returns the widget that is currently grabbing the keyboard input.
FocusPolicy
Definition: qnamespace.h:181
WId qt_last_cursor
void scroll_sys(int dx, int dy)
void setWindowOpacity_sys(qreal opacity)
int height() const
Returns the height.
Definition: qsize.h:129
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
Definition: qnamespace.h:54
QWExtra * extra
Definition: qwidget_p.h:700
The QScreen class is a base class for screen drivers in Qt for Embedded Linux.
Definition: qscreen_qws.h:191
void releaseKeyboard()
Releases the keyboard grab.
WId internalWinId() const
Returns the window system identifier of the widget, or 0 if the widget is not created yet...
Definition: qwidget.h:244
QString caption
Definition: qwidget_p.h:171
virtual int metric(PaintDeviceMetric metric) const
void scrollRect(const QRect &, int dx, int dy)
void activateWindow()
Sets the top-level widget containing this widget to be the active window.
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
#define QT_USE_NAMESPACE
This macro expands to using QT_NAMESPACE if QT_NAMESPACE is defined and nothing otherwise.
Definition: qglobal.h:88
QPoint mapFromGlobal(const QPoint &) const
Translates the global screen coordinate pos to widget coordinates.
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
QObject * parent
Definition: qobject.h:92
qint32 minh
Definition: qwidget_p.h:265
uint posFromMove
Definition: qwidget_p.h:186
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 clipRegion() const
Definition: qwidget.cpp:2021
int x2
Definition: qrect.h:180
void setWinId(WId)
Definition: qwidget.cpp:1726
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
int screenNumber(const QWidget *widget=0) const
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
void createSysExtra()
uint fstrut_dirty
Definition: qwidget.h:126
bool intersects(const QRect &r) const
Returns true if this rectangle intersects with the given rectangle (i.
Definition: qrect.cpp:1429
static QWSDisplay * instance()
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
void invalidateBuffer_resizeHelper(const QPoint &oldPos, const QSize &oldSize)
Invalidates the buffer when the widget is resized.
const QRect availableGeometry(int screen=-1) const
Qt::WindowFlags windowFlags() const
Window flags are a combination of a type (e.
Definition: qwidget.h:939
void createTLSysExtra()
The QInputContext class abstracts the input method dependent data and composing state.
Definition: qinputcontext.h:83
int x1
Definition: qrect.h:178
QWidgetBackingStoreTracker backingStore
Definition: qwidget_p.h:166
QIcon * icon
Definition: qwidget_p.h:164
QWidgetBackingStore * maybeBackingStore() const
Definition: qwidget_p.h:1036
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
void updateSystemBackground()
static QWidget * keyboardGrb
Definition: qwidget_qws.cpp:80
void requestFocus(int winId, bool get)
QBitmap createHeuristicMask(bool clipTight=true) const
Creates and returns a heuristic mask for this pixmap.
Definition: qpixmap.cpp:864
int physicalWidth() const
Returns the physical width of the screen in millimeters.
Definition: qscreen_qws.h:290
static Qt::WindowStates effectiveState(Qt::WindowStates state)
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...
Definition: qglobal.h:1729
QRect geometry
the geometry of the widget relative to its parent and excluding the window frame
Definition: qwidget.h:158
void setGeometry_sys(int, int, int, int, bool)
void stackUnder_sys(QWidget *)
#define QT_TRY
Definition: qglobal.h:1536
QPoint mapToGlobal(const QPoint &) const
Translates the widget coordinate pos to global screen coordinates.
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203
QRect effectiveRectFor(const QRect &rect) const
Definition: qwidget_p.h:658
WId winid
Definition: qwidget.h:117
virtual void setGeometry(const QRect &rect)
Sets the currently allocated area to be the given rect.
#define text
Definition: qobjectdefs.h:80
void setWindowCaption(QWidget *w, const QString &)
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
static Qt::KeyboardModifiers oldstate
Definition: qdnd_qws.cpp:87
static int takeLocalId()
Definition: qwidget_qws.cpp:82
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288
void setWindowIconText_sys(const QString &cap)