Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
libkscreen
Commits
680134df
Commit
680134df
authored
Apr 11, 2021
by
Xaver Hugl
Browse files
Add overscan and capabilities properties
parent
6df597b3
Changes
6
Hide whitespace changes
Inline
Side-by-side
backends/kwayland/waylandoutput.cpp
View file @
680134df
...
...
@@ -169,6 +169,8 @@ void WaylandOutput::updateKScreenOutput(OutputPtr &output)
output
->
setModes
(
modeList
);
output
->
setScale
(
m_device
->
scaleF
());
output
->
setType
(
Utils
::
guessOutputType
(
m_device
->
model
(),
m_device
->
model
()));
output
->
setCapabilities
(
static_cast
<
Output
::
Capabilities
>
(
static_cast
<
uint32_t
>
(
m_device
->
capabilities
())));
output
->
setOverscan
(
m_device
->
overscan
());
}
bool
WaylandOutput
::
setWlConfig
(
Wl
::
OutputConfiguration
*
wlConfig
,
const
KScreen
::
OutputPtr
&
output
)
...
...
@@ -210,6 +212,13 @@ bool WaylandOutput::setWlConfig(Wl::OutputConfiguration *wlConfig, const KScreen
}
else
{
qCWarning
(
KSCREEN_WAYLAND
)
<<
"Invalid kscreen mode id:"
<<
output
->
currentModeId
()
<<
"
\n\n
"
<<
m_modeIdMap
;
}
// overscan
if
((
output
->
capabilities
()
&
Output
::
Capability
::
Overscan
)
&&
m_device
->
overscan
()
!=
output
->
overscan
())
{
wlConfig
->
setOverscan
(
m_device
,
output
->
overscan
());
changed
=
true
;
}
return
changed
;
}
...
...
src/configserializer.cpp
View file @
680134df
...
...
@@ -91,6 +91,10 @@ QJsonObject ConfigSerializer::serializeOutput(const OutputPtr &output)
}
obj
[
QLatin1String
(
"modes"
)]
=
modes
;
if
(
output
->
capabilities
()
&
Output
::
Capability
::
Overscan
)
{
obj
[
QLatin1String
(
"overscan"
)]
=
static_cast
<
int
>
(
output
->
overscan
());
}
return
obj
;
}
...
...
@@ -269,6 +273,8 @@ OutputPtr ConfigSerializer::deserializeOutput(const QDBusArgument &arg)
}
arg
.
endArray
();
output
->
setModes
(
modes
);
}
else
if
(
key
==
QLatin1String
(
"overscan"
))
{
output
->
setOverscan
(
value
.
toUInt
());
}
else
{
qCWarning
(
KSCREEN
)
<<
"Invalid key in Output map: "
<<
key
;
return
OutputPtr
();
...
...
src/doctor/doctor.cpp
View file @
680134df
...
...
@@ -266,6 +266,18 @@ void Doctor::parsePositionalArgs()
qApp
->
exit
(
9
);
return
;
}
}
else
if
(
ops
.
count
()
==
4
&&
ops
[
2
]
==
QLatin1String
(
"overscan"
))
{
const
uint32_t
overscan
=
ops
[
3
].
toInt
();
if
(
overscan
>
100
)
{
qCWarning
(
KSCREEN_DOCTOR
)
<<
"Wrong input: allowed values for overscan are from 0 to 100"
;
qApp
->
exit
(
9
);
return
;
}
if
(
!
setOverscan
(
output_id
,
overscan
))
{
qCDebug
(
KSCREEN_DOCTOR
)
<<
"Could not set overscan "
<<
overscan
<<
" to output "
<<
output_id
;
qApp
->
exit
(
9
);
return
;
}
}
else
{
cerr
<<
"Unable to parse arguments: "
<<
op
<<
Qt
::
endl
;
qApp
->
exit
(
2
);
...
...
@@ -353,6 +365,7 @@ void Doctor::showOutputs() const
cout
<<
yellow
<<
"Geometry: "
<<
cr
<<
g
.
x
()
<<
","
<<
g
.
y
()
<<
" "
<<
g
.
width
()
<<
"x"
<<
g
.
height
()
<<
" "
;
cout
<<
yellow
<<
"Scale: "
<<
cr
<<
output
->
scale
()
<<
" "
;
cout
<<
yellow
<<
"Rotation: "
<<
cr
<<
output
->
rotation
()
<<
" "
;
cout
<<
yellow
<<
"Overscan: "
<<
cr
<<
output
->
overscan
()
<<
" "
;
if
(
output
->
isPrimary
())
{
cout
<<
blue
<<
"primary"
;
}
...
...
@@ -468,6 +481,24 @@ bool Doctor::setRotation(int id, KScreen::Output::Rotation rot)
return
false
;
}
bool
Doctor
::
setOverscan
(
int
id
,
uint32_t
overscan
)
{
if
(
!
m_config
)
{
qCWarning
(
KSCREEN_DOCTOR
)
<<
"Invalid config."
;
return
false
;
}
for
(
const
auto
&
output
:
m_config
->
outputs
())
{
if
(
output
->
id
()
==
id
)
{
output
->
setOverscan
(
overscan
);
m_changed
=
true
;
return
true
;
}
}
cout
<<
"Output overscan "
<<
id
<<
" invalid."
<<
Qt
::
endl
;
return
false
;
}
void
Doctor
::
applyConfig
()
{
if
(
!
m_changed
)
{
...
...
src/doctor/doctor.h
View file @
680134df
...
...
@@ -43,6 +43,7 @@ public:
bool
setMode
(
int
id
,
const
QString
&
mode_id
);
bool
setScale
(
int
id
,
qreal
scale
);
bool
setRotation
(
int
id
,
KScreen
::
Output
::
Rotation
rot
);
bool
setOverscan
(
int
id
,
uint32_t
overscan
);
Q_SIGNALS:
void
outputsChanged
();
...
...
src/output.cpp
View file @
680134df
...
...
@@ -55,6 +55,8 @@ public:
,
enabled
(
other
.
enabled
)
,
primary
(
other
.
primary
)
,
followPreferredMode
(
other
.
followPreferredMode
)
,
capabilities
(
other
.
capabilities
)
,
overscan
(
other
.
overscan
)
{
const
auto
otherModeList
=
other
.
modeList
;
for
(
const
ModePtr
&
otherMode
:
otherModeList
)
{
...
...
@@ -88,6 +90,8 @@ public:
bool
enabled
;
bool
primary
;
bool
followPreferredMode
=
false
;
Capabilities
capabilities
;
uint32_t
overscan
=
0
;
QScopedPointer
<
Edid
>
edid
;
};
...
...
@@ -591,6 +595,32 @@ QRect Output::geometry() const
return
QRect
(
d
->
pos
,
size
);
}
Output
::
Capabilities
Output
::
capabilities
()
const
{
return
d
->
capabilities
;
}
void
Output
::
setCapabilities
(
Capabilities
capabilities
)
{
if
(
d
->
capabilities
!=
capabilities
)
{
d
->
capabilities
=
capabilities
;
Q_EMIT
capabilitiesChanged
(
capabilities
);
}
}
uint32_t
Output
::
overscan
()
const
{
return
d
->
overscan
;
}
void
Output
::
setOverscan
(
uint32_t
overscan
)
{
if
(
d
->
overscan
!=
overscan
)
{
d
->
overscan
=
overscan
;
Q_EMIT
overscanChanged
(
overscan
);
}
}
void
Output
::
apply
(
const
OutputPtr
&
other
)
{
typedef
void
(
KScreen
::
Output
::*
ChangeSignal
)();
...
...
src/output.h
View file @
680134df
...
...
@@ -48,6 +48,8 @@ public:
Q_PROPERTY
(
qreal
scale
READ
scale
WRITE
setScale
NOTIFY
scaleChanged
)
Q_PROPERTY
(
bool
followPreferredMode
READ
followPreferredMode
WRITE
setFollowPreferredMode
NOTIFY
followPreferredModeChanged
)
Q_PROPERTY
(
QSizeF
logicalSize
READ
logicalSize
WRITE
setLogicalSize
NOTIFY
logicalSizeChanged
)
Q_PROPERTY
(
Capabilities
capabilities
READ
capabilities
NOTIFY
capabilitiesChanged
)
Q_PROPERTY
(
uint32_t
overscan
READ
overscan
WRITE
setOverscan
NOTIFY
overscanChanged
)
enum
Type
{
Unknown
,
...
...
@@ -76,6 +78,13 @@ public:
};
Q_ENUM
(
Rotation
)
enum
class
Capability
{
Overscan
=
0x1
,
};
Q_ENUM
(
Capability
)
Q_DECLARE_FLAGS
(
Capabilities
,
Capability
)
Q_FLAG
(
Capabilities
)
explicit
Output
();
~
Output
()
override
;
...
...
@@ -329,6 +338,31 @@ public:
*/
void
setFollowPreferredMode
(
bool
follow
);
/**
* @returns the capabilities of this output
* @since 5.22
*/
Capabilities
capabilities
()
const
;
/**
* sets the capabilities of this output
* @since 5.22
*/
void
setCapabilities
(
Capabilities
capabilities
);
/**
* @returns the overscan value of this output in %
* @since 5.22
*/
uint32_t
overscan
()
const
;
/**
* Set the overscan for this output
* @param overscan the overscan value in %
* @since 5.22
*/
void
setOverscan
(
uint32_t
overscan
);
void
apply
(
const
OutputPtr
&
other
);
Q_SIGNALS:
void
outputChanged
();
...
...
@@ -344,6 +378,8 @@ Q_SIGNALS:
void
scaleChanged
();
void
logicalSizeChanged
();
void
followPreferredModeChanged
(
bool
followPreferredMode
);
void
capabilitiesChanged
(
Capabilities
capabilities
);
void
overscanChanged
(
uint32_t
overscan
);
/** The mode list changed.
*
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment