Remove not really needed gtk scale factor query
This commit is contained in:
parent
0b21c04489
commit
47e32bebe4
|
@ -71,11 +71,6 @@ void GtkIntegration::load() {
|
|||
|
||||
LOAD_GTK_SYMBOL(lib, gdk_atom_intern);
|
||||
|
||||
LOAD_GTK_SYMBOL(lib, gdk_display_get_default);
|
||||
LOAD_GTK_SYMBOL(lib, gdk_display_get_monitor);
|
||||
LOAD_GTK_SYMBOL(lib, gdk_display_get_primary_monitor);
|
||||
LOAD_GTK_SYMBOL(lib, gdk_monitor_get_scale_factor);
|
||||
|
||||
LOAD_GTK_SYMBOL(lib, gdk_pixbuf_get_has_alpha);
|
||||
LOAD_GTK_SYMBOL(lib, gdk_pixbuf_get_pixels);
|
||||
LOAD_GTK_SYMBOL(lib, gdk_pixbuf_get_width);
|
||||
|
@ -91,33 +86,6 @@ void GtkIntegration::load() {
|
|||
Loaded = true;
|
||||
}
|
||||
|
||||
std::optional<int> GtkIntegration::scaleFactor() const {
|
||||
if ((gdk_display_get_default == nullptr)
|
||||
|| (gdk_display_get_monitor == nullptr)
|
||||
|| (gdk_display_get_primary_monitor == nullptr)
|
||||
|| (gdk_monitor_get_scale_factor == nullptr)) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
const auto display = gdk_display_get_default();
|
||||
if (!display) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
const auto monitor = [&] {
|
||||
if (const auto primary = gdk_display_get_primary_monitor(display)) {
|
||||
return primary;
|
||||
}
|
||||
return gdk_display_get_monitor(display, 0);
|
||||
}();
|
||||
|
||||
if (!monitor) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
return gdk_monitor_get_scale_factor(monitor);
|
||||
}
|
||||
|
||||
bool GtkIntegration::showOpenWithDialog(const QString &filepath) const {
|
||||
return File::internal::ShowGtkOpenWithDialog(filepath);
|
||||
}
|
||||
|
|
|
@ -16,8 +16,6 @@ public:
|
|||
|
||||
void load();
|
||||
|
||||
[[nodiscard]] std::optional<int> scaleFactor() const;
|
||||
|
||||
[[nodiscard]] bool showOpenWithDialog(const QString &filepath) const;
|
||||
|
||||
[[nodiscard]] QImage getImageFromClipboard() const;
|
||||
|
|
|
@ -20,10 +20,6 @@ GtkIntegration *GtkIntegration::Instance() {
|
|||
void GtkIntegration::load() {
|
||||
}
|
||||
|
||||
std::optional<int> GtkIntegration::scaleFactor() const {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
bool GtkIntegration::showOpenWithDialog(const QString &filepath) const {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -28,10 +28,6 @@ inline GType (*gtk_app_chooser_get_type)(void) G_GNUC_CONST = nullptr;
|
|||
inline GtkWidget* (*gtk_app_chooser_dialog_new)(GtkWindow *parent, GtkDialogFlags flags, GFile *file) = nullptr;
|
||||
inline GAppInfo* (*gtk_app_chooser_get_app_info)(GtkAppChooser *self) = nullptr;
|
||||
inline GdkAtom (*gdk_atom_intern)(const gchar *atom_name, gboolean only_if_exists) = nullptr;
|
||||
inline GdkDisplay* (*gdk_display_get_default)(void) = nullptr;
|
||||
inline GdkMonitor* (*gdk_display_get_monitor)(GdkDisplay *display, int monitor_num) = nullptr;
|
||||
inline GdkMonitor* (*gdk_display_get_primary_monitor)(GdkDisplay *display) = nullptr;
|
||||
inline int (*gdk_monitor_get_scale_factor)(GdkMonitor *monitor) = nullptr;
|
||||
inline gboolean (*gdk_pixbuf_get_has_alpha)(const GdkPixbuf *pixbuf) = nullptr;
|
||||
inline guchar* (*gdk_pixbuf_get_pixels)(const GdkPixbuf *pixbuf) = nullptr;
|
||||
inline int (*gdk_pixbuf_get_width)(const GdkPixbuf *pixbuf) = nullptr;
|
||||
|
|
|
@ -403,22 +403,6 @@ bool GenerateDesktopFile(
|
|||
}
|
||||
}
|
||||
|
||||
void SetGtkScaleFactor() {
|
||||
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 SetDarkMode() {
|
||||
static const auto Inited = [] {
|
||||
QObject::connect(
|
||||
|
@ -974,7 +958,6 @@ void start() {
|
|||
integration->waitForInterfaceAnnounce();
|
||||
}
|
||||
|
||||
SetGtkScaleFactor();
|
||||
crl::async(SetDarkMode);
|
||||
|
||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
|
|
Loading…
Reference in New Issue