Skip to content

Commit e7f0f7d

Browse files
d-air1Dashon Wells
andauthored
Revert custom scaling for kde (#339)
Co-authored-by: Dashon Wells <[email protected]>
1 parent b8b8734 commit e7f0f7d

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

src/common/provider/ScaledSizeProvider.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,24 @@ qreal ScaledSizeProvider::scaleFactor()
5555
qreal ScaledSizeProvider::getScaleFactor()
5656
{
5757
#if defined(__linux__)
58-
DesktopEnvironmentChecker desktopEnvironmentChecker;
59-
auto environment = desktopEnvironmentChecker.getDesktopEnvironment();
60-
61-
if (environment == DesktopEnvironmentType::Gnome) {
58+
if(isGnomeEnvironment()) {
6259
auto screen = QApplication::primaryScreen();
6360
auto logicalDotsPerInch = (int) screen->logicalDotsPerInch();
6461
auto physicalDotsPerInch = (int) screen->physicalDotsPerInch();
6562
return (qreal)logicalDotsPerInch / (qreal)physicalDotsPerInch;
66-
} else if (environment == DesktopEnvironmentType::Kde) {
67-
auto screen = QApplication::primaryScreen();
68-
return screen->devicePixelRatio();
6963
}
7064
#endif
7165

7266
return 1;
7367
}
7468

69+
#if defined(__linux__)
70+
bool ScaledSizeProvider::isGnomeEnvironment()
71+
{
72+
auto currentDesktop = QString(qgetenv("XDG_CURRENT_DESKTOP"));
73+
return currentDesktop.contains(QLatin1String("gnome"), Qt::CaseInsensitive)
74+
|| currentDesktop.contains(QLatin1String("unity"), Qt::CaseInsensitive);
75+
}
76+
#endif
77+
7578
} // namespace kImageAnnotator

src/common/provider/ScaledSizeProvider.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ class ScaledSizeProvider
4646
static qreal scaleFactor();
4747
static qreal getScaleFactor();
4848

49+
#if defined(__linux__)
50+
static bool isGnomeEnvironment();
51+
#endif
52+
4953
ScaledSizeProvider() = default;
5054
~ScaledSizeProvider() = default;
5155
};

0 commit comments

Comments
 (0)