mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-19 15:47:11 +02:00
Don't mess GTK scale factor with other scaling settings
Have this order for scaling settings: 1. devicePixelRatio 2. GTK 3. DPI
This commit is contained in:
parent
3793f7c3c9
commit
8ed56bb4e4
1 changed files with 6 additions and 11 deletions
|
@ -9,7 +9,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
#include "platform/linux/linux_gtk_integration_p.h"
|
||||
#include "base/platform/base_platform_info.h"
|
||||
#include "platform/linux/linux_desktop_environment.h"
|
||||
#include "platform/linux/linux_xlib_helper.h"
|
||||
#include "platform/linux/linux_gdk_helper.h"
|
||||
#include "platform/linux/linux_gtk_file_dialog.h"
|
||||
|
@ -211,22 +210,18 @@ bool CursorSizeShouldBeSet() {
|
|||
void SetScaleFactor() {
|
||||
Core::Sandbox::Instance().customEnterFromEventLoop([] {
|
||||
const auto integration = GtkIntegration::Instance();
|
||||
if (!integration || !DesktopEnvironment::IsGtkBased()) {
|
||||
const auto ratio = Core::Sandbox::Instance().devicePixelRatio();
|
||||
if (!integration || ratio > 1.) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto scaleFactor = integration->scaleFactor();
|
||||
if (!scaleFactor.has_value()) {
|
||||
const auto scaleFactor = integration->scaleFactor().value_or(1);
|
||||
if (scaleFactor == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
LOG(("GTK scale factor: %1").arg(*scaleFactor));
|
||||
|
||||
const int scale = *scaleFactor
|
||||
* 100
|
||||
/ Core::Sandbox::Instance().devicePixelRatio();
|
||||
|
||||
cSetScreenScale(std::clamp(scale, 100, 300));
|
||||
LOG(("GTK scale factor: %1").arg(scaleFactor));
|
||||
cSetScreenScale(std::clamp(scaleFactor * 100, 100, 300));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue