| Summary: | from ExtendToRight directly switch to TurnOffEmbeded cause libkscreen error | ||
|---|---|---|---|
| Product: | [Plasma] KScreen | Reporter: | Leslie Zhai <zhaixiang> |
| Component: | kded | Assignee: | Leslie Zhai <zhaixiang> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | simonandric5 |
| Priority: | NOR | ||
| Version First Reported In: | git | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
| Attachments: |
0001-turnoff-embedded-disable-outputs.patch
reproduce-outputs-disabled-issue.patch |
||
Created attachment 93923 [details]
0001-turnoff-embedded-disable-outputs.patch
when press Qt::Key_Display hot key, TurnOffExternal is always able to work, because it sets the position for the primary && enabled output:
```
case Generator::TurnOffExternal: {
qCDebug(KSCREEN_KDED) << "Turn off external screen";
embedded->setPos(QPoint(0,0));
embedded->setEnabled(true);
embedded->setPrimary(true);
const KScreen::ModePtr embeddedMode = bestModeForOutput(embedded);
Q_ASSERT(embeddedMode);
embedded->setCurrentModeId(embeddedMode->id());
```
so I also set the position when TurnOffEmbedded:
```
case Generator::TurnOffEmbedded: {
qCDebug(KSCREEN_KDED) << "Turn off embedded (laptop)";
embedded->setEnabled(false);
embedded->setPrimary(false);
external->setPos(QPoint(0, 0));
external->setEnabled(true);
external->setPrimary(true);
const KScreen::ModePtr extMode = bestModeForOutput(external);
Q_ASSERT(extMode);
external->setCurrentModeId(extMode->id());
return config;
```
it is able to work correctly switch display from ExtendToRight to TurnOffEmbedded directly.
Created attachment 93924 [details]
reproduce-outputs-disabled-issue.patch
If you want to reproduce the issue easily, just patch it, then press Qt::Key_Display hot key, it might be Meta+P in your laptop to experience all outputs are disabled! when just want to TurnOffEmbedded.
|
from ExtendToRight directly switch to TurnOffEmbeded (by changing kscreen kded source code) cause libkscreen error: There are no enabled screens, at least one required Reproducible: Always Steps to Reproduce: 1. change the enum DisplaySwitchAction order to ExtendToRight = 1, TurnOffEmbedded = 2 ... 2. change m_iteration max value to Generator::ExtendToLeft 3. build && install kscreen 4. relogin plasma 5. plugged in a new monitor, press Qt::Key_Display hot key, it switch to ExtendToRight at first, then repress it again Actual Results: All outputs are disabled! libkscreen config canBeAppled`s log info: There are no enabled screens, at least one required Expected Results: it is able to switch to TurnOffEmbeded directly from ExtendToRight how to change enum DisplaySwitchAction and m_iteration max value diff --git a/kded/daemon.cpp b/kded/daemon.cpp index ed889ca..8452eaa 100644 --- a/kded/daemon.cpp +++ b/kded/daemon.cpp @@ -246,7 +246,7 @@ void KScreenDaemon::resetDisplaySwitch() void KScreenDaemon::applyGenericConfig() { - if (m_iteration == Generator::ExtendToRight) { + if (m_iteration == Generator::ExtendToLeft) { m_iteration = Generator::None; } diff --git a/kded/generator.h b/kded/generator.h index 36669fd..bf0ddec 100644 --- a/kded/generator.h +++ b/kded/generator.h @@ -35,11 +35,11 @@ class Generator : public QObject public: enum DisplaySwitchAction { None = 0, - Clone = 1, - ExtendToLeft = 2, - TurnOffEmbedded = 3, - TurnOffExternal = 4, - ExtendToRight = 5, + ExtendToRight = 1, + TurnOffEmbedded = 2, + TurnOffExternal = 3, + Clone = 4, + ExtendToLeft = 5, }; static Generator* self();