mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-05 09:05:14 +00:00
Allow initializing gtk integration before QApplication
This commit is contained in:
@@ -13,11 +13,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "platform/linux/linux_gdk_helper.h"
|
||||
#include "platform/linux/linux_gtk_file_dialog.h"
|
||||
#include "platform/linux/linux_open_with_dialog.h"
|
||||
#include "platform/linux/specific_linux.h"
|
||||
#include "ui/platform/ui_platform_utility.h"
|
||||
#include "core/sandbox.h"
|
||||
#include "core/core_settings.h"
|
||||
#include "core/application.h"
|
||||
|
||||
namespace Platform {
|
||||
namespace internal {
|
||||
@@ -47,30 +42,6 @@ bool GetImageFromClipboardSupported() {
|
||||
&& (gdk_atom_intern != nullptr);
|
||||
}
|
||||
|
||||
void SetScaleFactor() {
|
||||
Core::Sandbox::Instance().customEnterFromEventLoop([] {
|
||||
const auto integration = GtkIntegration::Instance();
|
||||
const auto ratio = Core::Sandbox::Instance().devicePixelRatio();
|
||||
if (!integration || ratio > 1.) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto scaleFactor = integration->scaleFactor().value_or(1);
|
||||
if (scaleFactor == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
LOG(("GTK scale factor: %1").arg(scaleFactor));
|
||||
cSetScreenScale(style::CheckScale(scaleFactor * 100));
|
||||
});
|
||||
}
|
||||
|
||||
void DarkModeChanged() {
|
||||
Core::Sandbox::Instance().customEnterFromEventLoop([] {
|
||||
Core::App().settings().setSystemDarkMode(IsDarkMode());
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
GtkIntegration::GtkIntegration() {
|
||||
@@ -161,24 +132,6 @@ void GtkIntegration::load() {
|
||||
LOAD_GTK_SYMBOL(Library(), "gtk_app_chooser_get_type", gtk_app_chooser_get_type);
|
||||
|
||||
Loaded = true;
|
||||
|
||||
SetScaleFactor();
|
||||
|
||||
BaseGtkIntegration::Instance()->connectToSetting(
|
||||
"gtk-theme-name",
|
||||
DarkModeChanged);
|
||||
|
||||
if (BaseGtkIntegration::Instance()->checkVersion(3, 0, 0)) {
|
||||
BaseGtkIntegration::Instance()->connectToSetting(
|
||||
"gtk-application-prefer-dark-theme",
|
||||
DarkModeChanged);
|
||||
}
|
||||
|
||||
if (BaseGtkIntegration::Instance()->checkVersion(3, 12, 0)) {
|
||||
BaseGtkIntegration::Instance()->connectToSetting(
|
||||
"gtk-decoration-layout",
|
||||
Ui::Platform::NotifyTitleControlsLayoutChanged);
|
||||
}
|
||||
}
|
||||
|
||||
bool GtkIntegration::loaded() const {
|
||||
|
Reference in New Issue
Block a user