Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qfbwindow.cpp
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4
#
include
"qfbwindow_p.h"
5
#
include
"qfbscreen_p.h"
6
7
#
include
<
QtGui
/
QScreen
>
8
#
include
<
qpa
/
qwindowsysteminterface
.
h
>
9
10
QT_BEGIN_NAMESPACE
11
12
Q_CONSTINIT
static
QBasicAtomicInt winIdGenerator = Q_BASIC_ATOMIC_INITIALIZER(0);
13
14
QFbWindow
::QFbWindow(QWindow *window)
15
: QPlatformWindow(window),
mBackingStore
(0), mWindowState(Qt::WindowNoState)
16
{
17
mWindowId = winIdGenerator.fetchAndAddRelaxed(1) + 1;
18
}
19
20
QFbWindow
::~
QFbWindow
()
21
{
22
}
23
24
QFbScreen
*
QFbWindow
::
platformScreen
()
const
25
{
26
return
static_cast
<
QFbScreen
*>(window()->screen()->handle());
27
}
28
29
void
QFbWindow
::
setGeometry
(
const
QRect &rect)
30
{
31
// store previous geometry for screen update
32
mOldGeometry = geometry();
33
34
QWindowSystemInterface::handleGeometryChange(window(), rect);
35
36
QPlatformWindow::setGeometry(rect);
37
38
if
(mOldGeometry != rect)
39
QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(0, 0), geometry().size()));
40
}
41
42
void
QFbWindow
::
setVisible
(
bool
visible)
43
{
44
QRect newGeom;
45
QFbScreen
*fbScreen =
platformScreen
(
)
;
46
if
(visible) {
47
bool
convOk =
false
;
48
static
bool
envDisableForceFullScreen = qEnvironmentVariableIntValue(
"QT_QPA_FB_FORCE_FULLSCREEN"
, &convOk) == 0 && convOk;
49
const
bool
platformDisableForceFullScreen = fbScreen->flags().testFlag(QFbScreen::DontForceFirstWindowToFullScreen);
50
const
bool
forceFullScreen = !envDisableForceFullScreen && !platformDisableForceFullScreen && fbScreen
->
windowCount
(
)
== 0;
51
if
(forceFullScreen || (mWindowState & Qt::WindowFullScreen))
52
newGeom =
platformScreen
(
)
->geometry();
53
else
if
(mWindowState & Qt::WindowMaximized)
54
newGeom =
platformScreen
(
)
->availableGeometry();
55
}
56
QPlatformWindow::setVisible(visible);
57
58
if
(visible)
59
fbScreen
->
addWindow
(
this
)
;
60
else
61
fbScreen
->
removeWindow
(
this
)
;
62
63
if
(!newGeom.isEmpty())
64
setGeometry(newGeom);
// may or may not generate an expose
65
66
if
(newGeom.isEmpty() || newGeom == mOldGeometry) {
67
// QWindow::isExposed() maps to QWindow::visible() by default so simply
68
// generating an expose event regardless of this being a show or hide is
69
// just what is needed here.
70
QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(0, 0), geometry().size()));
71
}
72
}
73
74
void
QFbWindow
::
setWindowState
(Qt::WindowStates state)
75
{
76
QPlatformWindow::setWindowState(state);
77
mWindowState = state;
78
}
79
80
void
QFbWindow
::
setWindowFlags
(Qt::WindowFlags flags)
81
{
82
mWindowFlags = flags;
83
}
84
85
Qt
::
WindowFlags
QFbWindow
::
windowFlags
()
const
86
{
87
return
mWindowFlags;
88
}
89
90
void
QFbWindow
::
raise
()
91
{
92
platformScreen
(
)
->
raise
(
this
)
;
93
QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(0, 0), geometry().size()));
94
}
95
96
void
QFbWindow
::
lower
()
97
{
98
platformScreen
(
)
->
lower
(
this
)
;
99
QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(0, 0), geometry().size()));
100
}
101
102
void
QFbWindow
::
repaint
(
const
QRegion ®ion)
103
{
104
const
QRect currentGeometry = geometry();
105
const
QRect oldGeometryLocal = mOldGeometry;
106
mOldGeometry = currentGeometry;
107
// If this is a move, redraw the previous location
108
if
(oldGeometryLocal != currentGeometry)
109
platformScreen
(
)
->setDirty(oldGeometryLocal);
110
auto
topLeft = currentGeometry.topLeft();
111
for
(
auto
rect : region)
112
platformScreen()->setDirty(rect.translated(topLeft));
113
}
114
115
QT_END_NAMESPACE
QFbScreen
Definition
qfbscreen_p.h:30
QFbScreen::windowCount
virtual int windowCount() const
Definition
qfbscreen.cpp:121
QFbScreen::lower
virtual void lower(QFbWindow *window)
Definition
qfbscreen.cpp:91
QFbScreen::raise
virtual void raise(QFbWindow *window)
Definition
qfbscreen.cpp:79
QFbScreen::removeWindow
virtual void removeWindow(QFbWindow *window)
Definition
qfbscreen.cpp:70
QFbScreen::addWindow
virtual void addWindow(QFbWindow *window)
Definition
qfbscreen.cpp:48
QFbWindow
Definition
qfbwindow_p.h:27
QFbWindow::windowFlags
Qt::WindowFlags windowFlags() const
Definition
qfbwindow.cpp:85
QFbWindow::platformScreen
QFbScreen * platformScreen() const
Definition
qfbwindow.cpp:24
QFbWindow::setVisible
void setVisible(bool visible) override
Reimplemented in subclasses to show the surface if visible is true, and hide it if visible is false.
Definition
qfbwindow.cpp:42
QFbWindow::repaint
virtual void repaint(const QRegion &)
Definition
qfbwindow.cpp:102
QFbWindow::setGeometry
void setGeometry(const QRect &rect) override
This function is called by Qt whenever a window is moved or resized using the QWindow API.
Definition
qfbwindow.cpp:29
QFbWindow::mBackingStore
QFbBackingStore * mBackingStore
Definition
qfbwindow_p.h:58
QFbWindow::lower
void lower() override
Reimplement to be able to let Qt lower windows to the bottom of the desktop.
Definition
qfbwindow.cpp:96
QFbWindow::raise
void raise() override
Reimplement to be able to let Qt raise windows to the top of the desktop.
Definition
qfbwindow.cpp:90
QFbWindow::setWindowFlags
void setWindowFlags(Qt::WindowFlags type) override
Requests setting the window flags of this surface to flags.
Definition
qfbwindow.cpp:80
QFbWindow::~QFbWindow
~QFbWindow()
Definition
qfbwindow.cpp:20
QFbWindow::setWindowState
void setWindowState(Qt::WindowStates state) override
Requests setting the window state of this surface to type.
Definition
qfbwindow.cpp:74
qtbase
src
platformsupport
fbconvenience
qfbwindow.cpp
Generated on
for Qt by
1.18.0