Qt 4.8
qbbscreen.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2011 - 2012 Research In Motion <blackberry-qt@qnx.com>
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtCore 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 // #define QBBSCREEN_DEBUG
43 
44 #include "qbbscreen.h"
45 #include "qbbrootwindow.h"
46 #include "qbbwindow.h"
47 #include "qbbcursor.h"
48 
49 #include <QDebug>
50 #include <QtCore/QThread>
51 #include <QtGui/QWindowSystemInterface>
52 
53 #include <errno.h>
54 #include <unistd.h>
55 
57 
58 #if defined(QBB_PHYSICAL_SCREEN_WIDTH) && QBB_PHYSICAL_SCREEN_WIDTH > 0 \
59  && defined(QBB_PHYSICAL_SCREEN_HEIGHT) && QBB_PHYSICAL_SCREEN_HEIGHT > 0
60 #define QBB_PHYSICAL_SCREEN_SIZE_DEFINED
61 #elif defined(QBB_PHYSICAL_SCREEN_WIDTH) || defined(QBB_PHYSICAL_SCREEN_HEIGHT)
62 #error Please define QBB_PHYSICAL_SCREEN_WIDTH and QBB_PHYSICAL_SCREEN_HEIGHT to values greater than zero
63 #endif
64 
66 
67 static QSize determineScreenSize(screen_display_t display, bool primaryScreen)
68 {
69  int val[2];
70 
71  errno = 0;
72  const int result = screen_get_display_property_iv(display, SCREEN_PROPERTY_PHYSICAL_SIZE, val);
73  if (result != 0) {
74  qFatal("QBBScreen: failed to query display physical size, errno=%d", errno);
75  return QSize(150, 90);
76  }
77 
78  if (val[0] > 0 && val[1] > 0)
79  return QSize(val[0], val[1]);
80 
81  qWarning("QBBScreen: screen_get_display_property_iv() reported an invalid physical screen size (%dx%d). Falling back to QBB_PHYSICAL_SCREEN_SIZE environment variable.", val[0], val[1]);
82 
83  const QString envPhySizeStr = qgetenv("QBB_PHYSICAL_SCREEN_SIZE");
84  if (!envPhySizeStr.isEmpty()) {
85  const QStringList envPhySizeStrList = envPhySizeStr.split(QLatin1Char(','));
86  const int envWidth = envPhySizeStrList.size() == 2 ? envPhySizeStrList[0].toInt() : -1;
87  const int envHeight = envPhySizeStrList.size() == 2 ? envPhySizeStrList[1].toInt() : -1;
88 
89  if (envWidth <= 0 || envHeight <= 0) {
90  qFatal("QBBScreen: The value of QBB_PHYSICAL_SCREEN_SIZE must be in the format \"width,height\" in mm, with width, height > 0. Example: QBB_PHYSICAL_SCREEN_SIZE=150,90");
91  return QSize(150, 90);
92  }
93 
94  return QSize(envWidth, envHeight);
95  }
96 
97 #if defined(QBB_PHYSICAL_SCREEN_SIZE_DEFINED)
98  const QSize defSize(QBB_PHYSICAL_SCREEN_WIDTH, QBB_PHYSICAL_SCREEN_HEIGHT);
99  qWarning("QBBScreen: QBB_PHYSICAL_SCREEN_SIZE variable not set. Falling back to defines QBB_PHYSICAL_SCREEN_WIDTH/QBB_PHYSICAL_SCREEN_HEIGHT (%dx%d)", defSize.width(), defSize.height());
100  return defSize;
101 #else
102  if (primaryScreen)
103  qFatal("QBBScreen: QBB_PHYSICAL_SCREEN_SIZE variable not set. Could not determine physical screen size.");
104  return QSize(150, 90);
105 #endif
106 }
107 
108 QBBScreen::QBBScreen(screen_context_t context, screen_display_t display, int screenIndex)
109  : mContext(context),
110  mDisplay(display),
111  mPosted(false),
112  mUsingOpenGL(false),
113  mPrimaryDisplay(screenIndex == 0),
114  mKeyboardHeight(0),
115  mScreenIndex(screenIndex),
116  mCursor(new QBBCursor(this))
117 {
118 #if defined(QBBSCREEN_DEBUG)
119  qDebug() << "QBBScreen::QBBScreen";
120 #endif
121 
122  // cache initial orientation of this display
123  // TODO: use ORIENTATION environment variable?
124  errno = 0;
125  int result = screen_get_display_property_iv(mDisplay, SCREEN_PROPERTY_ROTATION, &mStartRotation);
126  if (result != 0) {
127  qFatal("QBBScreen: failed to query display rotation, errno=%d", errno);
128  }
129 
131 
132  // cache size of this display in pixels
133  // TODO: use WIDTH and HEIGHT environment variables?
134  errno = 0;
135  int val[2];
136  result = screen_get_display_property_iv(mDisplay, SCREEN_PROPERTY_SIZE, val);
137  if (result != 0) {
138  qFatal("QBBScreen: failed to query display size, errno=%d", errno);
139  }
140 
141  mCurrentGeometry = mStartGeometry = QRect(0, 0, val[0], val[1]);
142 
143  // Cache size of this display in millimeters
145 
146  // swap physical dimensions when rotated orthogonally
147  if (mStartRotation == 90 || mStartRotation == 270)
149 
151 
152  // We only create the root window if we are not the primary display.
153  if (mPrimaryDisplay)
155 }
156 
158 {
159 #if defined(QBBSCREEN_DEBUG)
160  qDebug() << "QBBScreen::~QBBScreen";
161 #endif
162 }
163 
164 static int defaultDepth()
165 {
166  static int defaultDepth = 0;
167  if (defaultDepth == 0) {
168  // check if display depth was specified in environment variable;
169  // use default value if no valid value found
170  defaultDepth = qgetenv("QBB_DISPLAY_DEPTH").toInt();
171  if (defaultDepth != 16 && defaultDepth != 32) {
172  defaultDepth = 32;
173  }
174  }
175  return defaultDepth;
176 }
177 
179 {
180  if (!mRootWindow)
182 }
183 
184 void QBBScreen::newWindowCreated(screen_window_t window)
185 {
187  screen_display_t display = 0;
188  if (screen_get_window_property_pv(window, SCREEN_PROPERTY_DISPLAY, (void**)&display) != 0) {
189  qWarning("QBBScreen: Failed to get screen for window, errno=%d", errno);
190  return;
191  }
192 
193  if (display == nativeDisplay()) {
194  // A window was created on this screen. If we don't know about this window yet, it means
195  // it was not created by Qt, but by some foreign library like the multimedia renderer, which
196  // creates an overlay window when playing a video.
197  // Treat all foreign windows as overlays here.
198  if (!findWindow(window))
199  addOverlayWindow(window);
200  }
201 }
202 
203 void QBBScreen::windowClosed(screen_window_t window)
204 {
206  removeOverlayWindow(window);
207 }
208 
210 {
211  // available geometry = total geometry - keyboard
214 }
215 
216 int QBBScreen::depth() const
217 {
218  return defaultDepth();
219 }
220 
224 static bool isOrthogonal(int angle1, int angle2)
225 {
226  return ((angle1 - angle2) % 180) != 0;
227 }
228 
230 {
231 #if defined(QBBSCREEN_DEBUG)
232  qDebug() << "QBBScreen::setRotation, o=" << rotation;
233 #endif
234 
235  // check if rotation changed
236  if (mCurrentRotation != rotation) {
237  // update rotation of root window
238  if (mRootWindow)
239  mRootWindow->setRotation(rotation);
240 
241  const QRect previousScreenGeometry = geometry();
242 
243  // swap dimensions if we've rotated 90 or 270 from initial orientation
244  if (isOrthogonal(mStartRotation, rotation)) {
247  } else {
250  }
251 
252  // resize app window if we've rotated 90 or 270 from previous orientation
253  if (isOrthogonal(mCurrentRotation, rotation)) {
254 
255 #if defined(QBBSCREEN_DEBUG)
256  qDebug() << "QBBScreen::setRotation - resize, s=" << mCurrentGeometry.size();
257 #endif
258  if (mRootWindow)
260 
261  if (mPrimaryDisplay)
262  resizeWindows(previousScreenGeometry);
263  } else {
264  // TODO: find one global place to flush display updates
265 #if defined(QBBSCREEN_DEBUG)
266  qDebug() << "QBBScreen::setRotation - flush";
267 #endif
268  // force immediate display update if no geometry changes required
269  if (mRootWindow)
270  mRootWindow->flush();
271  }
272 
273  // save new rotation
275 
276  // TODO: check if other screens are supposed to rotate as well and/or whether this depends
277  // on if clone mode is being used.
278  // Rotating only the primary screen is what we had in the navigator event handler before refactoring
279  if (mPrimaryDisplay)
281 
282  // Flush everything, so that the windows rotations are applied properly.
283  // Needed for non-maximized windows
284  screen_flush_context(mContext, 0);
285  }
286 }
287 
288 void QBBScreen::resizeNativeWidgetWindow(QBBWindow *w, const QRect &previousScreenGeometry) const
289 {
290  const qreal relativeX = static_cast<qreal>(w->geometry().topLeft().x()) / previousScreenGeometry.width();
291  const qreal relativeY = static_cast<qreal>(w->geometry().topLeft().y()) / previousScreenGeometry.height();
292  const qreal relativeWidth = static_cast<qreal>(w->geometry().width()) / previousScreenGeometry.width();
293  const qreal relativeHeight = static_cast<qreal>(w->geometry().height()) / previousScreenGeometry.height();
294 
295  const QRect windowGeometry(relativeX * geometry().width(), relativeY * geometry().height(),
296  relativeWidth * geometry().width(), relativeHeight * geometry().height());
297 
298  w->widget()->setGeometry(windowGeometry);
299 }
300 
304 void QBBScreen::resizeTopLevelWindow(QBBWindow *w, const QRect &previousScreenGeometry) const
305 {
306  QRect windowGeometry = w->geometry();
307 
308  const qreal relativeCenterX = static_cast<qreal>(w->geometry().center().x()) / previousScreenGeometry.width();
309  const qreal relativeCenterY = static_cast<qreal>(w->geometry().center().y()) / previousScreenGeometry.height();
310  const QPoint newCenter(relativeCenterX * geometry().width(), relativeCenterY * geometry().height());
311 
312  windowGeometry.moveCenter(newCenter);
313 
314  // adjust center position in case the window
315  // is clipped
316  if (!geometry().contains(windowGeometry)) {
317  const int x1 = windowGeometry.x();
318  const int y1 = windowGeometry.y();
319  const int x2 = x1 + windowGeometry.width();
320  const int y2 = y1 + windowGeometry.height();
321 
322  if (x1 < 0) {
323  const int centerX = qMin(qAbs(x1) + windowGeometry.center().x(),
324  geometry().center().x());
325 
326  windowGeometry.moveCenter(QPoint(centerX, windowGeometry.center().y()));
327  }
328 
329  if (y1 < 0) {
330  const int centerY = qMin(qAbs(y1) + windowGeometry.center().y(),
331  geometry().center().y());
332 
333  windowGeometry.moveCenter(QPoint(windowGeometry.center().x(), centerY));
334  }
335 
336  if (x2 > geometry().width()) {
337  const int centerX = qMax(windowGeometry.center().x() - (x2 - geometry().width()),
338  geometry().center().x());
339 
340  windowGeometry.moveCenter(QPoint(centerX, windowGeometry.center().y()));
341  }
342 
343  if (y2 > geometry().height()) {
344  const int centerY = qMax(windowGeometry.center().y() - (y2 - geometry().height()),
345  geometry().center().y());
346 
347  windowGeometry.moveCenter(QPoint(windowGeometry.center().x(), centerY));
348  }
349  }
350 
351  // at this point, if the window is still clipped,
352  // it means that it's too big to fit on the screen,
353  // so we need to proportionally shrink it
354  if (!geometry().contains(windowGeometry)) {
355  QSize newSize = windowGeometry.size();
356  newSize.scale(geometry().size(), Qt::KeepAspectRatio);
357  windowGeometry.setSize(newSize);
358 
359  if (windowGeometry.x() < 0)
360  windowGeometry.moveCenter(QPoint(geometry().center().x(), windowGeometry.center().y()));
361 
362  if (windowGeometry.y() < 0)
363  windowGeometry.moveCenter(QPoint(windowGeometry.center().x(), geometry().center().y()));
364  }
365 
366  w->widget()->setGeometry(windowGeometry);
367 }
368 
372 void QBBScreen::resizeWindows(const QRect &previousScreenGeometry)
373 {
375 
377  continue;
378 
379  if (w->widget()->parent()) {
380  // This is a native (non-alien) widget window
381  resizeNativeWidgetWindow(w, previousScreenGeometry);
382  } else {
383  // This is a toplevel window
384  resizeTopLevelWindow(w, previousScreenGeometry);
385  }
386  }
387 }
388 
389 QBBWindow *QBBScreen::findWindow(screen_window_t windowHandle)
390 {
392  QBBWindow * const result = window->findWindow(windowHandle);
393  if (result)
394  return result;
395  }
396 
397  return 0;
398 }
399 
401 {
402 #if defined(QBBSCREEN_DEBUG)
403  qDebug() << "QBBScreen::addWindow=" << window;
404 #endif
405 
406  if (mChildren.contains(window))
407  return;
408 
409  // Ensure that the desktop window is at the bottom of the zorder.
410  // If we do not do this then we may end up activating the desktop
411  // when the navigator service gets an event that our window group
412  // has been activated (see QBBScreen::activateWindowGroup()).
413  // Such a situation would strangely break focus handling due to the
414  // invisible desktop widget window being layered on top of normal
415  // windows
416  if (window->widget()->windowType() == Qt::Desktop)
417  mChildren.push_front(window);
418  else
419  mChildren.push_back(window);
420  updateHierarchy();
421 }
422 
424 {
425 #if defined(QBBSCREEN_DEBUG)
426  qDebug() << "QBBScreen::removeWindow=" << window;
427 #endif
428 
429  const int numWindowsRemoved = mChildren.removeAll(window);
430  if (numWindowsRemoved > 0)
431  updateHierarchy();
432 }
433 
435 {
436 #if defined(QBBSCREEN_DEBUG)
437  qDebug() << "QBBScreen::raise window=" << window;
438 #endif
439 
440  removeWindow(window);
441  mChildren.push_back(window);
442  updateHierarchy();
443 }
444 
446 {
447 #if defined(QBBSCREEN_DEBUG)
448  qDebug() << "QBBScreen::lower window=" << window;
449 #endif
450 
451  removeWindow(window);
452  mChildren.push_front(window);
453  updateHierarchy();
454 }
455 
457 {
458 #if defined(QBBSCREEN_DEBUG)
459  qDebug() << "QBBScreen::updateHierarchy";
460 #endif
461 
463  int topZorder = 1; // root window is z-order 0, all "top" level windows are "above" it
464 
465  for (it = mChildren.constBegin(); it != mChildren.constEnd(); ++it) {
466  (*it)->updateZorder(topZorder);
467  }
468 
469  topZorder++;
470  Q_FOREACH (screen_window_t overlay, mOverlays) {
471  // Do nothing when this fails. This can happen if we have stale windows in mOverlays,
472  // which in turn can happen because a window was removed but we didn't get a notification
473  // yet.
474  screen_set_window_property_iv(overlay, SCREEN_PROPERTY_ZORDER, &topZorder);
475  topZorder++;
476  }
477 
478  // After a hierarchy update, we need to force a flush on all screens.
479  // Right now, all screens share a context.
480  screen_flush_context( mContext, 0 );
481 }
482 
484 {
485  Q_UNUSED(window)
486 
487  // post app window (so navigator will show it) after first child window
488  // has posted; this only needs to happen once as the app window's content
489  // never changes
490  if (!mPosted && mRootWindow) {
491  mRootWindow->post();
492  mPosted = true;
493  }
494 }
495 
497 {
498  if (!mPrimaryDisplay)
499  return;
500 
501  bool ok = false;
502  const int rotation = qgetenv("ORIENTATION").toInt(&ok);
503 
504  if (ok)
505  setRotation(rotation);
506 }
507 
509 {
510  return mCursor;
511 }
512 
514 {
515  if (height == mKeyboardHeight)
516  return;
517 
518  mKeyboardHeight = height;
519 
521 }
522 
523 void QBBScreen::addOverlayWindow(screen_window_t window)
524 {
525  mOverlays.append(window);
526  updateHierarchy();
527 }
528 
530 {
531  const int numOverlaysRemoved = mOverlays.removeAll(window);
532  if (numOverlaysRemoved > 0)
533  updateHierarchy();
534 }
535 
537 {
538 #if defined(QBBSCREEN_DEBUG)
539  qDebug() << Q_FUNC_INFO;
540 #endif
541 
542  if (!rootWindow() || id != rootWindow()->groupName())
543  return;
544 
545  QWidget * const window = topMostChildWindow();
546 
547  if (!window)
548  return;
549 
551 }
552 
554 {
555 #if defined(QBBSCREEN_DEBUG)
556  qDebug() << Q_FUNC_INFO;
557 #endif
558 
559  if (!rootWindow() || id != rootWindow()->groupName())
560  return;
561 
562  QWidget * const window = topMostChildWindow();
563 
564  if (!window)
565  return;
566 
568 }
569 
571 {
572 #if defined(QBBSCREEN_DEBUG)
573  qDebug() << Q_FUNC_INFO;
574 #endif
575 
576  if (!rootWindow() || id != rootWindow()->groupName())
577  return;
578 
580 }
581 
583 {
584  if (!mChildren.isEmpty()) {
585 
586  // We're picking up the last window of the list here
587  // because this list is ordered by stacking order.
588  // Last window is effectively the one on top.
589  return mChildren.last()->widget();
590  }
591 
592  return 0;
593 }
594 
QWidget * topMostChildWindow() const
Definition: qbbscreen.cpp:582
QSharedPointer< QBBRootWindow > mRootWindow
Definition: qbbscreen.h:115
void push_front(const T &t)
This function is provided for STL compatibility.
Definition: qlist.h:297
QPlatformCursor * cursor() const
Definition: qbbscreen.cpp:508
QSize mStartPhysicalSize
Definition: qbbscreen.h:123
void newWindowCreated(screen_window_t window)
Definition: qbbscreen.cpp:184
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
void push_back(const T &t)
This function is provided for STL compatibility.
Definition: qlist.h:296
int mStartRotation
Definition: qbbscreen.h:120
double qreal
Definition: qglobal.h:1193
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
void onWindowPost(QBBWindow *window)
Definition: qbbscreen.cpp:483
QSharedPointer< QBBRootWindow > rootWindow() const
Definition: qbbscreen.h:89
Qt::WindowStates windowState() const
Returns the current window state.
Definition: qwidget.cpp:3086
#define it(className, varName)
bool mPosted
Definition: qbbscreen.h:116
screen_context_t mContext
Definition: qbbscreen.h:113
void addOverlayWindow(screen_window_t window)
Definition: qbbscreen.cpp:523
virtual QRect geometry() const
Returnes the current geometry of a window.
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
The QPlatformCursor class provides information about pointer device events (movement, buttons), and requests to change the currently displayed cursor.
void setRotation(int rotation)
Definition: qbbscreen.cpp:229
static void handleScreenAvailableGeometryChange(int screenIndex)
static void handleScreenGeometryChange(int screenIndex)
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the list.
Definition: qlist.h:269
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
The QList::const_iterator class provides an STL-style const iterator for QList and QQueue...
Definition: qlist.h:228
void resizeWindows(const QRect &previousScreenGeometry)
Adjust windows to the new screen geometry.
Definition: qbbscreen.cpp:372
void ensureDisplayCreated()
Definition: qbbscreen.cpp:178
int mScreenIndex
Definition: qbbscreen.h:130
bool mPrimaryDisplay
Definition: qbbscreen.h:118
void flush() const
void lowerWindow(QBBWindow *window)
Definition: qbbscreen.cpp:445
void setGeometry(int x, int y, int w, int h)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qwidget.h:1017
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
static int defaultDepth()
Definition: qbbscreen.cpp:164
The QString class provides a Unicode character string.
Definition: qstring.h:83
void post() const
Q_DECL_CONSTEXPR T qAbs(const T &t)
Definition: qglobal.h:1201
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
int mCurrentRotation
Definition: qbbscreen.h:121
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
void resize(const QSize &size)
Q_CORE_EXPORT void qDebug(const char *,...)
NSWindow * window
int width() const
Returns the width.
Definition: qsize.h:126
static QThread * currentThread()
Returns a pointer to a QThread which manages the currently executing thread.
Definition: qthread.cpp:419
void addWindow(QBBWindow *child)
Definition: qbbscreen.cpp:400
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
Q_GUI_EXPORT EGLDisplay display()
Definition: qegl.cpp:589
void raiseWindow(QBBWindow *window)
Definition: qbbscreen.cpp:434
QBool contains(const T &t) const
Returns true if the list contains an occurrence of value; otherwise returns false.
Definition: qlist.h:880
static void handleWindowActivated(QWidget *w)
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
QSize size() const
Returns the size of the rectangle.
Definition: qrect.h:309
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
QRect mCurrentGeometry
Definition: qbbscreen.h:126
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
void transpose()
Swaps the width and height values.
Definition: qsize.cpp:196
int rotation() const
Definition: qbbscreen.h:69
virtual int depth() const
Reimplement in subclass to return current depth of the screen.
Definition: qbbscreen.cpp:216
void removeOverlayWindow(screen_window_t window)
Definition: qbbscreen.cpp:529
void updateHierarchy()
Definition: qbbscreen.cpp:456
virtual QRect availableGeometry() const
Reimplement in subclass to return the pixel geometry of the available space This normally is the desk...
Definition: qbbscreen.cpp:209
virtual QRect geometry() const
Reimplement in subclass to return the pixel geometry of the screen.
Definition: qbbscreen.h:63
static void handleWindowStateChanged(QWidget *w, Qt::WindowState newState)
static QSize determineScreenSize(screen_display_t display, bool primaryScreen)
Definition: qbbscreen.cpp:67
screen_display_t mDisplay
Definition: qbbscreen.h:114
static bool isOrthogonal(int angle1, int angle2)
Check if the supplied angles are perpendicular to each other.
Definition: qbbscreen.cpp:224
QRect mStartGeometry
Definition: qbbscreen.h:125
bool contains(const QPoint &p, bool proper=false) const
Returns true if the given point is inside or on the edge of the rectangle, otherwise returns false...
Definition: qrect.cpp:1101
void moveCenter(const QPoint &p)
Moves the rectangle, leaving the center point at the given position.
Definition: qrect.cpp:840
Q_CORE_EXPORT QTextStream & center(QTextStream &s)
screen_display_t nativeDisplay() const
Definition: qbbscreen.h:72
QPoint center() const
Returns the center point of the rectangle.
Definition: qrect.h:300
int mKeyboardHeight
Definition: qbbscreen.h:122
Q_CORE_EXPORT void qFatal(const char *,...)
QSize mCurrentPhysicalSize
Definition: qbbscreen.h:124
void keyboardHeightChanged(int height)
Definition: qbbscreen.cpp:513
void adjustOrientation()
Definition: qbbscreen.cpp:496
QList< QBBWindow * > mChildren
Definition: qbbscreen.h:128
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
void removeWindow(QBBWindow *child)
Definition: qbbscreen.cpp:423
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
int toInt(bool *ok=0, int base=10) const
Returns the byte array converted to an int using base base, which is 10 by default and must be betwee...
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
QPlatformCursor * mCursor
Definition: qbbscreen.h:132
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
T & last()
Returns a reference to the last item in the list.
Definition: qlist.h:284
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
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
void resizeNativeWidgetWindow(QBBWindow *w, const QRect &previousScreenGeometry) const
Definition: qbbscreen.cpp:288
void setRotation(int rotation)
void activateWindowGroup(const QByteArray &id)
Definition: qbbscreen.cpp:553
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
void deactivateWindowGroup(const QByteArray &id)
Definition: qbbscreen.cpp:570
void windowGroupStateChanged(const QByteArray &id, Qt::WindowState state)
Definition: qbbscreen.cpp:536
void scale(int w, int h, Qt::AspectRatioMode mode)
Scales the size to a rectangle with the given width and height, according to the specified mode: ...
Definition: qsize.h:138
QBBScreen(screen_context_t context, screen_display_t display, int screenIndex)
Definition: qbbscreen.cpp:108
#define Q_FOREACH(variable, container)
Same as foreach(variable, container).
Definition: qglobal.h:2435
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
Qt::WindowType windowType() const
Returns the window type of this widget.
Definition: qwidget.h:937
QBBWindow * findWindow(screen_window_t windowHandle)
Definition: qbbwindow.cpp:617
QStringList split(const QString &sep, SplitBehavior behavior=KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const Q_REQUIRED_RESULT
Splits the string into substrings wherever sep occurs, and returns the list of those strings...
Definition: qstring.cpp:6526
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
QThread * thread() const
Returns the thread in which the object lives.
Definition: qobject.cpp:1419
void resizeTopLevelWindow(QBBWindow *w, const QRect &previousScreenGeometry) const
Resize the given window to fit the screen geometry.
Definition: qbbscreen.cpp:304
QBBWindow * findWindow(screen_window_t windowHandle)
Definition: qbbscreen.cpp:389
virtual ~QBBScreen()
Definition: qbbscreen.cpp:157
#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
WindowState
Definition: qnamespace.h:366
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
void windowClosed(screen_window_t window)
Definition: qbbscreen.cpp:203
int errno
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list...
Definition: qlist.h:272
QWidget * widget() const
Returnes the widget which belongs to the QPlatformWindow.
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288
int removeAll(const T &t)
Removes all occurrences of value in the list and returns the number of entries removed.
Definition: qlist.h:770
#define Q_FUNC_INFO
Definition: qglobal.h:1871
QList< screen_window_t > mOverlays
Definition: qbbscreen.h:129