Warning: That file was not part of the compilation database. It may have many parsing errors.

1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the plugins 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 The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/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 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#ifndef QWINDOWSSCREEN_H
41#define QWINDOWSSCREEN_H
42
43#include "qtwindowsglobal.h"
44
45#include <QtCore/qlist.h>
46#include <QtCore/qvector.h>
47#include <QtCore/qpair.h>
48#include <QtCore/qscopedpointer.h>
49#include <qpa/qplatformscreen.h>
50
51QT_BEGIN_NAMESPACE
52
53struct QWindowsScreenData
54{
55 enum Flags
56 {
57 PrimaryScreen = 0x1,
58 VirtualDesktop = 0x2,
59 LockScreen = 0x4 // Temporary screen existing during user change, etc.
60 };
61
62 QRect geometry;
63 QRect availableGeometry;
64 QDpi dpi{96, 96};
65 QSizeF physicalSizeMM;
66 int depth = 32;
67 QImage::Format format = QImage::Format_ARGB32_Premultiplied;
68 unsigned flags = VirtualDesktop;
69 QString name;
70 Qt::ScreenOrientation orientation = Qt::LandscapeOrientation;
71 qreal refreshRateHz = 60;
72 HMONITOR hMonitor = nullptr;
73};
74
75class QWindowsScreen : public QPlatformScreen
76{
77public:
78#ifndef QT_NO_CURSOR
79 using CursorPtr = QScopedPointer<QPlatformCursor>;
80#endif
81
82 explicit QWindowsScreen(const QWindowsScreenData &data);
83
84 QRect geometry() const override { return m_data.geometry; }
85 QRect availableGeometry() const override { return m_data.availableGeometry; }
86 int depth() const override { return m_data.depth; }
87 QImage::Format format() const override { return m_data.format; }
88 QSizeF physicalSize() const override { return m_data.physicalSizeMM; }
89 QDpi logicalDpi() const override { return m_data.dpi; }
90 qreal pixelDensity() const override;
91 qreal devicePixelRatio() const override { return 1.0; }
92 qreal refreshRate() const override { return m_data.refreshRateHz; }
93 QString name() const override { return m_data.name; }
94 Qt::ScreenOrientation orientation() const override { return m_data.orientation; }
95 QList<QPlatformScreen *> virtualSiblings() const override;
96 QWindow *topLevelAt(const QPoint &point) const override;
97 static QWindow *windowAt(const QPoint &point, unsigned flags);
98
99 QPixmap grabWindow(WId window, int qX, int qY, int qWidth, int qHeight) const override;
100 QPlatformScreen::SubpixelAntialiasingType subpixelAntialiasingTypeHint() const override;
101
102 static Qt::ScreenOrientation orientationPreference();
103 static bool setOrientationPreference(Qt::ScreenOrientation o);
104
105 inline void handleChanges(const QWindowsScreenData &newData);
106
107 HMONITOR handle() const;
108
109#ifndef QT_NO_CURSOR
110 QPlatformCursor *cursor() const override { return m_cursor.data(); }
111 const CursorPtr &cursorPtr() const { return m_cursor; }
112#else
113 QPlatformCursor *cursor() const { return 0; }
114#endif // !QT_NO_CURSOR
115
116 const QWindowsScreenData &data() const { return m_data; }
117
118 static QRect virtualGeometry(const QPlatformScreen *screen);
119
120private:
121 QWindowsScreenData m_data;
122#ifndef QT_NO_CURSOR
123 const CursorPtr m_cursor;
124#endif
125};
126
127class QWindowsScreenManager
128{
129public:
130 using WindowsScreenList = QList<QWindowsScreen *>;
131
132 QWindowsScreenManager();
133
134 void clearScreens();
135
136 bool handleScreenChanges();
137 bool handleDisplayChange(WPARAM wParam, LPARAM lParam);
138 const WindowsScreenList &screens() const { return m_screens; }
139
140 const QWindowsScreen *screenAtDp(const QPoint &p) const;
141 const QWindowsScreen *screenForHwnd(HWND hwnd) const;
142
143 static bool isSingleScreen();
144
145private:
146 void removeScreen(int index);
147
148 WindowsScreenList m_screens;
149 int m_lastDepth = -1;
150 WORD m_lastHorizontalResolution = 0;
151 WORD m_lastVerticalResolution = 0;
152};
153
154QT_END_NAMESPACE
155
156#endif // QWINDOWSSCREEN_H
157

Warning: That file was not part of the compilation database. It may have many parsing errors.