50 #include <QtCore/QThread> 51 #include <QtGui/QWindowSystemInterface> 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 72 const int result = screen_get_display_property_iv(display, SCREEN_PROPERTY_PHYSICAL_SIZE, val);
74 qFatal(
"QBBScreen: failed to query display physical size, errno=%d",
errno);
75 return QSize(150, 90);
78 if (val[0] > 0 && val[1] > 0)
79 return QSize(val[0], val[1]);
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]);
86 const int envWidth = envPhySizeStrList.
size() == 2 ? envPhySizeStrList[0].toInt() : -1;
87 const int envHeight = envPhySizeStrList.
size() == 2 ? envPhySizeStrList[1].toInt() : -1;
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);
94 return QSize(envWidth, envHeight);
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());
103 qFatal(
"QBBScreen: QBB_PHYSICAL_SCREEN_SIZE variable not set. Could not determine physical screen size.");
104 return QSize(150, 90);
113 mPrimaryDisplay(screenIndex == 0),
115 mScreenIndex(screenIndex),
118 #if defined(QBBSCREEN_DEBUG) 119 qDebug() <<
"QBBScreen::QBBScreen";
127 qFatal(
"QBBScreen: failed to query display rotation, errno=%d",
errno);
136 result = screen_get_display_property_iv(
mDisplay, SCREEN_PROPERTY_SIZE, val);
138 qFatal(
"QBBScreen: failed to query display size, errno=%d",
errno);
159 #if defined(QBBSCREEN_DEBUG) 160 qDebug() <<
"QBBScreen::~QBBScreen";
167 if (defaultDepth == 0) {
171 if (defaultDepth != 16 && defaultDepth != 32) {
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);
226 return ((angle1 - angle2) % 180) != 0;
231 #if defined(QBBSCREEN_DEBUG) 255 #if defined(QBBSCREEN_DEBUG) 265 #if defined(QBBSCREEN_DEBUG) 266 qDebug() <<
"QBBScreen::setRotation - flush";
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();
357 windowGeometry.
setSize(newSize);
359 if (windowGeometry.
x() < 0)
362 if (windowGeometry.
y() < 0)
402 #if defined(QBBSCREEN_DEBUG) 425 #if defined(QBBSCREEN_DEBUG) 430 if (numWindowsRemoved > 0)
436 #if defined(QBBSCREEN_DEBUG) 447 #if defined(QBBSCREEN_DEBUG) 458 #if defined(QBBSCREEN_DEBUG) 459 qDebug() <<
"QBBScreen::updateHierarchy";
466 (*it)->updateZorder(topZorder);
474 screen_set_window_property_iv(overlay, SCREEN_PROPERTY_ZORDER, &topZorder);
480 screen_flush_context(
mContext, 0 );
532 if (numOverlaysRemoved > 0)
538 #if defined(QBBSCREEN_DEBUG) 555 #if defined(QBBSCREEN_DEBUG) 572 #if defined(QBBSCREEN_DEBUG) QWidget * topMostChildWindow() const
QSharedPointer< QBBRootWindow > mRootWindow
void push_front(const T &t)
This function is provided for STL compatibility.
QPlatformCursor * cursor() const
void newWindowCreated(screen_window_t window)
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
void push_back(const T &t)
This function is provided for STL compatibility.
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
#define QT_END_NAMESPACE
This macro expands to.
void onWindowPost(QBBWindow *window)
QSharedPointer< QBBRootWindow > rootWindow() const
#define it(className, varName)
screen_context_t mContext
void addOverlayWindow(screen_window_t window)
The QByteArray class provides an array of bytes.
void setRotation(int rotation)
static void handleScreenAvailableGeometryChange(int screenIndex)
static void handleScreenGeometryChange(int screenIndex)
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the list.
int width() const
Returns the width of the rectangle.
The QList::const_iterator class provides an STL-style const iterator for QList and QQueue...
void resizeWindows(const QRect &previousScreenGeometry)
Adjust windows to the new screen geometry.
void ensureDisplayCreated()
void lowerWindow(QBBWindow *window)
int height() const
Returns the height of the rectangle.
static int defaultDepth()
The QString class provides a Unicode character string.
Q_DECL_CONSTEXPR T qAbs(const T &t)
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 resize(const QSize &size)
Q_CORE_EXPORT void qDebug(const char *,...)
int width() const
Returns the width.
static QThread * currentThread()
Returns a pointer to a QThread which manages the currently executing thread.
void addWindow(QBBWindow *child)
void append(const T &t)
Inserts value at the end of the list.
#define QT_BEGIN_NAMESPACE
This macro expands to.
Q_GUI_EXPORT EGLDisplay display()
void raiseWindow(QBBWindow *window)
QBool contains(const T &t) const
Returns true if the list contains an occurrence of value; otherwise returns false.
static void handleWindowActivated(QWidget *w)
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QSize size() const
Returns the size of the rectangle.
The QStringList class provides a list of strings.
Q_CORE_EXPORT void qWarning(const char *,...)
void setSize(const QSize &s)
Sets the size of the rectangle to the given size.
void transpose()
Swaps the width and height values.
virtual int depth() const
Reimplement in subclass to return current depth of the screen.
void removeOverlayWindow(screen_window_t window)
virtual QRect availableGeometry() const
Reimplement in subclass to return the pixel geometry of the available space This normally is the desk...
virtual QRect geometry() const
Reimplement in subclass to return the pixel geometry of the screen.
static void handleWindowStateChanged(QWidget *w, Qt::WindowState newState)
static QSize determineScreenSize(screen_display_t display, bool primaryScreen)
screen_display_t mDisplay
static bool isOrthogonal(int angle1, int angle2)
Check if the supplied angles are perpendicular to each other.
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...
void moveCenter(const QPoint &p)
Moves the rectangle, leaving the center point at the given position.
Q_CORE_EXPORT QTextStream & center(QTextStream &s)
screen_display_t nativeDisplay() const
QPoint center() const
Returns the center point of the rectangle.
Q_CORE_EXPORT void qFatal(const char *,...)
QSize mCurrentPhysicalSize
void keyboardHeightChanged(int height)
QList< QBBWindow * > mChildren
int y() const
Returns the y-coordinate of the rectangle's top edge.
void removeWindow(QBBWindow *child)
int x() const
Returns the x-coordinate of the rectangle's left edge.
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.
QPlatformCursor * mCursor
The QPoint class defines a point in the plane using integer precision.
T & last()
Returns a reference to the last item in the list.
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.
void resizeNativeWidgetWindow(QBBWindow *w, const QRect &previousScreenGeometry) const
void setRotation(int rotation)
void activateWindowGroup(const QByteArray &id)
int y() const
Returns the y coordinate of this point.
void deactivateWindowGroup(const QByteArray &id)
void windowGroupStateChanged(const QByteArray &id, Qt::WindowState state)
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: ...
QBBScreen(screen_context_t context, screen_display_t display, int screenIndex)
#define Q_FOREACH(variable, container)
Same as foreach(variable, container).
The QSize class defines the size of a two-dimensional object using integer point precision.
QBBWindow * findWindow(screen_window_t windowHandle)
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...
int x() const
Returns the x coordinate of this point.
QThread * thread() const
Returns the thread in which the object lives.
void resizeTopLevelWindow(QBBWindow *w, const QRect &previousScreenGeometry) const
Resize the given window to fit the screen geometry.
QBBWindow * findWindow(screen_window_t windowHandle)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
void windowClosed(screen_window_t window)
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list...
QPoint topLeft() const
Returns the position of the rectangle's top-left corner.
int removeAll(const T &t)
Removes all occurrences of value in the list and returns the number of entries removed.
QList< screen_window_t > mOverlays