Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqnxscreen.h
Go to the documentation of this file.
1// Copyright (C) 2011 - 2012 Research In Motion
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QBBSCREEN_H
5#define QBBSCREEN_H
6
7#include <qpa/qplatformscreen.h>
8
9#include "qqnxwindow.h"
10
11#include <QtCore/QObject>
12#include <QtCore/QScopedPointer>
13
14#include <screen/screen.h>
15
16#if !defined(_SCREEN_VERSION)
17#define _SCREEN_MAKE_VERSION(major, minor, patch) (((major) * 10000) + ((minor) * 100) + (patch))
18#define _SCREEN_VERSION _SCREEN_MAKE_VERSION(0, 0, 0)
19#endif
20
21// For pre-1.0.0 screen, map some screen property names to the old
22// names.
24const int SCREEN_PROPERTY_FLAGS = SCREEN_PROPERTY_KEY_FLAGS;
25const int SCREEN_PROPERTY_FOCUS = SCREEN_PROPERTY_KEYBOARD_FOCUS;
26const int SCREEN_PROPERTY_MODIFIERS = SCREEN_PROPERTY_KEY_MODIFIERS;
27const int SCREEN_PROPERTY_SCAN = SCREEN_PROPERTY_KEY_SCAN;
28const int SCREEN_PROPERTY_SYM = SCREEN_PROPERTY_KEY_SYM;
29#endif
30
32
36
37class QQnxWindow;
38
39class QQnxScreen : public QObject, public QPlatformScreen
40{
42public:
44 ~QQnxScreen();
45
46 QPixmap grabWindow(WId window, int x, int y, int width, int height) const override;
47
48 QRect geometry() const override { return m_currentGeometry; }
49 QRect availableGeometry() const override;
50 int depth() const override;
51 QImage::Format format() const override { return (depth() == 32) ? QImage::Format_RGB32 : QImage::Format_RGB16; }
52 QSizeF physicalSize() const override { return m_currentPhysicalSize; }
53
54 qreal refreshRate() const override;
55
56 Qt::ScreenOrientation nativeOrientation() const override;
57 Qt::ScreenOrientation orientation() const override;
58
59 QWindow *topLevelAt(const QPoint &point) const override;
60
61 bool isPrimaryScreen() const { return m_primaryScreen; }
62
63 int rotation() const { return m_currentRotation; }
64
65 QString name() const override { return m_name; }
66
67 int nativeFormat() const { return (depth() == 32) ? SCREEN_FORMAT_RGBA8888 : SCREEN_FORMAT_RGB565; }
68 screen_display_t nativeDisplay() const { return m_display; }
69 screen_context_t nativeContext() const { return m_screenContext; }
70 const char *windowGroupName() const { return m_rootWindow ? m_rootWindow->groupName().constData() : 0; }
71
72 QQnxWindow *findWindow(screen_window_t windowHandle) const;
73
74 /* Window hierarchy management */
75 void addWindow(QQnxWindow *child);
76 void removeWindow(QQnxWindow *child);
77 void raiseWindow(QQnxWindow *window);
78 void lowerWindow(QQnxWindow *window);
79 void updateHierarchy();
80
81 void adjustOrientation();
82
83 QQnxWindow *rootWindow() const;
85
86 QPlatformCursor *cursor() const override;
87
90 void foreignWindowClosed(void *window);
91
92public Q_SLOTS:
93 void setRotation(int rotation);
94 void newWindowCreated(void *window);
95 void windowClosed(void *window);
96 void windowGroupStateChanged(const QByteArray &id, Qt::WindowState state);
97 void activateWindowGroup(const QByteArray &id);
98 void deactivateWindowGroup(const QByteArray &id);
99
100private Q_SLOTS:
102
103private:
104 void resizeNativeWidgetWindow(QQnxWindow *w, const QRect &previousScreenGeometry) const;
105 void resizeTopLevelWindow(QQnxWindow *w, const QRect &previousScreenGeometry) const;
106 void resizeWindows(const QRect &previousScreenGeometry);
107 void addOverlayWindow(screen_window_t window);
108 void addUnderlayWindow(screen_window_t window);
109 void removeOverlayOrUnderlayWindow(screen_window_t window);
110
111 screen_context_t m_screenContext;
112 screen_display_t m_display;
113 QQnxWindow *m_rootWindow;
114 const bool m_primaryScreen;
115
116 int m_initialRotation;
117 int m_currentRotation;
118 int m_keyboardHeight;
119 QString m_name;
120 QSize m_initialPhysicalSize;
121 QSize m_currentPhysicalSize;
122 Qt::ScreenOrientation m_nativeOrientation;
123 QRect m_initialGeometry;
124 QRect m_currentGeometry;
125
126 QList<QQnxWindow *> m_childWindows;
127 QQnxWindow *m_coverWindow;
128 QList<screen_window_t> m_overlays;
129 QList<screen_window_t> m_underlays;
130
131 QPlatformCursor *m_cursor;
132};
133
134QT_END_NAMESPACE
135
136#endif // QBBSCREEN_H
bool isInitialized() const
void resetBuffers() override
QQnxEglWindow(QWindow *window, screen_context_t context, bool needRootWindow)
QSurfaceFormat format() const override
Returns the actual surface format of the window.
int pixelFormat() const override
EGLSurface surface() const
void ensureInitialized(QQnxGLContext *context)
void setGeometry(const QRect &rect) override
This function is called by Qt whenever a window is moved or resized using the QWindow API.
void doneCurrent() override
void windowClosed(void *window)
const char * windowGroupName() const
Definition qqnxscreen.h:70
Qt::ScreenOrientation nativeOrientation() const override
Reimplement this function in subclass to return the native orientation of the screen,...
QRect geometry() const override
Reimplement in subclass to return the pixel geometry of the screen.
Definition qqnxscreen.h:48
QPlatformCursor * cursor() const override
Reimplement this function in subclass to return the cursor of the screen.
Qt::ScreenOrientation orientation() const override
Reimplement this function in subclass to return the current orientation of the screen,...
QWindow * topLevelAt(const QPoint &point) const override
Return the given top level window for a given position.
void lowerWindow(QQnxWindow *window)
bool isPrimaryScreen() const
Definition qqnxscreen.h:61
void raiseWindow(QQnxWindow *window)
void activateWindowGroup(const QByteArray &id)
void foreignWindowClosed(void *window)
void removeWindow(QQnxWindow *child)
void addWindow(QQnxWindow *child)
QRect availableGeometry() const override
Reimplement in subclass to return the pixel geometry of the available space This normally is the desk...
screen_context_t nativeContext() const
Definition qqnxscreen.h:69
void deactivateWindowGroup(const QByteArray &id)
QImage::Format format() const override
Reimplement in subclass to return the image format which corresponds to the screen format.
Definition qqnxscreen.h:51
int nativeFormat() const
Definition qqnxscreen.h:67
int rotation() const
Definition qqnxscreen.h:63
QPixmap grabWindow(WId window, int x, int y, int width, int height) const override
This function is called when Qt needs to be able to grab the content of a window.
QQnxWindow * findWindow(screen_window_t windowHandle) const
QSizeF physicalSize() const override
Reimplement this function in subclass to return the physical size of the screen, in millimeters.
Definition qqnxscreen.h:52
QString name() const override
Definition qqnxscreen.h:65
void setRootWindow(QQnxWindow *)
int depth() const override
Reimplement in subclass to return current depth of the screen.
void adjustOrientation()
screen_display_t nativeDisplay() const
Definition qqnxscreen.h:68
QQnxWindow * rootWindow() const
void newWindowCreated(void *window)
qreal refreshRate() const override
Reimplement this function in subclass to return the vertical refresh rate of the screen,...
void updateHierarchy()
void windowGroupStateChanged(const QByteArray &id, Qt::WindowState state)
The QQnxWindow is the base class of the various classes used as instances of QPlatformWindow in the Q...
Definition qqnxwindow.h:31
void windowPosted()
screen_context_t m_screenContext
Definition qqnxwindow.h:86
void setExposed(bool exposed)
void requestActivateWindow() override
Reimplement to let Qt be able to request activation/focus for a window.
virtual int pixelFormat() const =0
QQnxWindow(QWindow *window, screen_context_t context, screen_window_t screenWindow)
QQnxWindow * findWindow(screen_window_t windowHandle)
void setParent(const QPlatformWindow *window) override
This function is called to enable native child window in QPA.
bool shouldMakeFullScreen() const
void setVisible(bool visible) override
Reimplemented in subclasses to show the surface if visible is true, and hide it if visible is false.
virtual void resetBuffers()=0
bool isExposed() const override
Returns if this window is exposed in the windowing system.
void initWindow()
void raise() override
Reimplement to be able to let Qt raise windows to the top of the desktop.
QQnxWindow(QWindow *window, screen_context_t context, bool needRootWindow)
void joinWindowGroup(const QByteArray &groupName)
void minimize()
void propagateSizeHints() override
Reimplement to propagate the size hints of the QWindow.
void setWindowTitle(const QString &title)
Reimplement to set the window title to title.
QByteArray groupName() const
Definition qqnxwindow.h:70
const QList< QQnxWindow * > & children() const
Definition qqnxwindow.h:62
screen_window_t nativeHandle() const
Definition qqnxwindow.h:45
void setScreen(QQnxScreen *platformScreen)
WId winId() const override
Reimplement in subclasses to return a handle to the native window.
Definition qqnxwindow.h:44
void setBufferSize(const QSize &size)
void setWindowState(Qt::WindowStates state) override
Requests setting the window state of this surface to type.
QPlatformScreen * screen() const override
Returns the platform screen handle corresponding to this platform window, or null if the window is no...
void setRotation(int rotation)
void handleActivationEvent()
void lower() override
Reimplement to be able to let Qt lower windows to the bottom of the desktop.
void setGeometry(const QRect &rect) override
This function is called by Qt whenever a window is moved or resized using the QWindow API.
QSize bufferSize() const
Definition qqnxwindow.h:48
void setOpacity(qreal level) override
Reimplement to be able to let Qt set the opacity level of a window.
virtual ~QQnxWindow()
Q_LOGGING_CATEGORY(lcEventDispatcher, "qt.eventdispatcher")
QT_BEGIN_NAMESPACE Q_DECLARE_LOGGING_CATEGORY(lcEventDispatcher)
const int SCREEN_PROPERTY_SYM
Definition qqnxscreen.h:28
#define _SCREEN_VERSION
Definition qqnxscreen.h:18
const int SCREEN_PROPERTY_SCAN
Definition qqnxscreen.h:27
Q_DECLARE_LOGGING_CATEGORY(lcQpaScreenBuffer)
const int SCREEN_PROPERTY_FOCUS
Definition qqnxscreen.h:25
const int SCREEN_PROPERTY_MODIFIERS
Definition qqnxscreen.h:26
const int SCREEN_PROPERTY_FLAGS
Definition qqnxscreen.h:24
#define _SCREEN_MAKE_VERSION(major, minor, patch)
Definition qqnxscreen.h:17
Q_DECLARE_LOGGING_CATEGORY(lcQpaScreenEvents)