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// Qt-Security score:significant reason:default
4
5#ifndef QBBSCREEN_H
6#define QBBSCREEN_H
7
8#include <qpa/qplatformscreen.h>
9
10#include "qqnxwindow.h"
11
12#include <QtCore/QObject>
13#include <QtCore/QScopedPointer>
14
15#include <screen/screen.h>
16
17#if !defined(_SCREEN_VERSION)
18#define _SCREEN_MAKE_VERSION(major, minor, patch) (((major) * 10000) + ((minor) * 100) + (patch))
19#define _SCREEN_VERSION _SCREEN_MAKE_VERSION(0, 0, 0)
20#endif
21
22// For pre-1.0.0 screen, map some screen property names to the old
23// names.
25const int SCREEN_PROPERTY_FLAGS = SCREEN_PROPERTY_KEY_FLAGS;
26const int SCREEN_PROPERTY_FOCUS = SCREEN_PROPERTY_KEYBOARD_FOCUS;
27const int SCREEN_PROPERTY_MODIFIERS = SCREEN_PROPERTY_KEY_MODIFIERS;
28const int SCREEN_PROPERTY_SCAN = SCREEN_PROPERTY_KEY_SCAN;
29const int SCREEN_PROPERTY_SYM = SCREEN_PROPERTY_KEY_SYM;
30#endif
31
33
35
36class QQnxWindow;
37
38class QQnxScreen : public QObject, public QPlatformScreen
39{
41public:
43 ~QQnxScreen();
44
45 QPixmap grabWindow(WId window, int x, int y, int width, int height) const override;
46
47 QRect geometry() const override { return m_currentGeometry; }
48 QRect availableGeometry() const override;
49 int depth() const override;
50 QImage::Format format() const override { return (depth() == 32) ? QImage::Format_RGB32 : QImage::Format_RGB16; }
51 QSizeF physicalSize() const override { return m_currentPhysicalSize; }
52
53 qreal refreshRate() const override;
54
55 Qt::ScreenOrientation nativeOrientation() const override;
56 Qt::ScreenOrientation orientation() const override;
57
58 QWindow *topLevelAt(const QPoint &point) const override;
59
60 bool isPrimaryScreen() const { return m_primaryScreen; }
61
62 int rotation() const { return m_currentRotation; }
63
64 QString name() const override { return m_name; }
65
66 int nativeFormat() const { return (depth() == 32) ? SCREEN_FORMAT_RGBA8888 : SCREEN_FORMAT_RGB565; }
67 screen_display_t nativeDisplay() const { return m_display; }
68 screen_context_t nativeContext() const { return m_screenContext; }
69 const char *windowGroupName() const { return m_rootWindow ? m_rootWindow->groupName().constData() : 0; }
70
71 QQnxWindow *findWindow(screen_window_t windowHandle) const;
72
73 /* Window hierarchy management */
74 void addWindow(QQnxWindow *child);
75 void removeWindow(QQnxWindow *child);
76 void raiseWindow(QQnxWindow *window);
77 void lowerWindow(QQnxWindow *window);
78 void updateHierarchy();
79
80 void adjustOrientation();
81
82 QQnxWindow *rootWindow() const;
84
85 QPlatformCursor *cursor() const override;
86
89 void foreignWindowClosed(void *window);
90
91public Q_SLOTS:
92 void setRotation(int rotation);
93 void newWindowCreated(void *window);
94 void windowClosed(void *window);
95 void windowGroupStateChanged(const QByteArray &id, Qt::WindowState state);
96 void activateWindowGroup(const QByteArray &id);
97 void deactivateWindowGroup(const QByteArray &id);
98
99private Q_SLOTS:
101
102private:
103 void resizeNativeWidgetWindow(QQnxWindow *w, const QRect &previousScreenGeometry) const;
104 void resizeTopLevelWindow(QQnxWindow *w, const QRect &previousScreenGeometry) const;
105 void resizeWindows(const QRect &previousScreenGeometry);
106 void addOverlayWindow(screen_window_t window);
107 void addUnderlayWindow(screen_window_t window);
108 void removeOverlayOrUnderlayWindow(screen_window_t window);
109
110 screen_context_t m_screenContext;
111 screen_display_t m_display;
112 QQnxWindow *m_rootWindow;
113 const bool m_primaryScreen;
114
115 int m_initialRotation;
116 int m_currentRotation;
117 int m_keyboardHeight;
118 QString m_name;
119 QSize m_initialPhysicalSize;
120 QSize m_currentPhysicalSize;
121 Qt::ScreenOrientation m_nativeOrientation;
122 QRect m_initialGeometry;
123 QRect m_currentGeometry;
124
125 QList<QQnxWindow *> m_childWindows;
126 QQnxWindow *m_coverWindow;
127 QList<screen_window_t> m_overlays;
128 QList<screen_window_t> m_underlays;
129
130 QPlatformCursor *m_cursor;
131};
132
133QT_END_NAMESPACE
134
135#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:69
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:47
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:60
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:68
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:50
int nativeFormat() const
Definition qqnxscreen.h:66
int rotation() const
Definition qqnxscreen.h:62
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:51
QString name() const override
Definition qqnxscreen.h:64
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:67
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:32
void windowPosted()
screen_context_t m_screenContext
Definition qqnxwindow.h:91
void setExposed(bool exposed)
screen_context_t screenContext() const
Definition qqnxwindow.h:47
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:72
const QList< QQnxWindow * > & children() const
Definition qqnxwindow.h:64
screen_window_t nativeHandle() const
Definition qqnxwindow.h:46
void handlePostEvent()
void setScreen(QQnxScreen *platformScreen)
WId winId() const override
Reimplement in subclasses to return a handle to the native window.
Definition qqnxwindow.h:45
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 requestUpdate() override
Requests an QEvent::UpdateRequest event.
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:50
void setOpacity(qreal level) override
Reimplement to be able to let Qt set the opacity level of a window.
virtual ~QQnxWindow()
Combined button and popup list for selecting options.
Q_LOGGING_CATEGORY(lcEventDispatcher, "qt.eventdispatcher")
QT_BEGIN_NAMESPACE Q_DECLARE_LOGGING_CATEGORY(lcQIORing)
const int SCREEN_PROPERTY_SYM
Definition qqnxscreen.h:29
#define _SCREEN_VERSION
Definition qqnxscreen.h:19
const int SCREEN_PROPERTY_SCAN
Definition qqnxscreen.h:28
const int SCREEN_PROPERTY_FOCUS
Definition qqnxscreen.h:26
const int SCREEN_PROPERTY_MODIFIERS
Definition qqnxscreen.h:27
const int SCREEN_PROPERTY_FLAGS
Definition qqnxscreen.h:25
#define _SCREEN_MAKE_VERSION(major, minor, patch)
Definition qqnxscreen.h:18