mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
initialstart: Make scaling option more robust
Currently when the app starts, the scaling of all monitors gets changed to a combobox value. This change makes it so that only the primary monitor is affected, and that it only sets the scaling when the user interacts with the combobox.
This commit is contained in:
parent
ac96c3bf13
commit
a029f18eeb
3 changed files with 10 additions and 3 deletions
|
|
@ -118,8 +118,10 @@ InitialStartModule {
|
|||
currentIndex: Prepare.PrepareUtil.scalingOptions.indexOf(Prepare.PrepareUtil.scaling.toString() + "%");
|
||||
model: Prepare.PrepareUtil.scalingOptions
|
||||
|
||||
// remove % suffix
|
||||
onCurrentValueChanged: Prepare.PrepareUtil.scaling = parseInt(currentValue.substring(0, currentValue.length - 1));
|
||||
onActivated: (index) => {
|
||||
// remove % suffix
|
||||
Prepare.PrepareUtil.scaling = parseInt(currentValue.substring(0, currentValue.length - 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ PrepareUtil::PrepareUtil(QObject *parent)
|
|||
// try to take the primary display's scaling, otherwise use the scaling of any of the displays
|
||||
for (KScreen::OutputPtr output : m_config->outputs()) {
|
||||
scaling = output->scale() * 100;
|
||||
m_output = output->id();
|
||||
if (output->isPrimary()) {
|
||||
break;
|
||||
}
|
||||
|
|
@ -53,7 +54,9 @@ void PrepareUtil::setScaling(int scaling)
|
|||
qreal scalingNum = ((double)scaling) / 100;
|
||||
|
||||
for (KScreen::OutputPtr output : outputs) {
|
||||
output->setScale(scalingNum);
|
||||
if (output->id() == m_output) {
|
||||
output->setScale(scalingNum);
|
||||
}
|
||||
}
|
||||
|
||||
auto setop = new KScreen::SetConfigOperation(m_config, this);
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@ private:
|
|||
int m_scaling;
|
||||
bool m_usingDarkTheme;
|
||||
|
||||
int m_output{0};
|
||||
|
||||
ColorsSettings *m_colorsSettings;
|
||||
KScreen::ConfigPtr m_config;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue