[nautilus/wip/antoniof/hidpi-and-icons-cleanup: 12/12] thumbnails: Create larger thumbnails for higher density displays




commit 278435e3c20244b48986c6cd8b72c5317668c72d
Author: António Fernandes <antoniof gnome org>
Date:   Thu Sep 1 12:15:36 2022 +0100

    thumbnails: Create larger thumbnails for higher density displays

 src/nautilus-thumbnails.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)
---
diff --git a/src/nautilus-thumbnails.c b/src/nautilus-thumbnails.c
index 1bad311e1..790b4e36f 100644
--- a/src/nautilus-thumbnails.c
+++ b/src/nautilus-thumbnails.c
@@ -137,7 +137,32 @@ get_thumbnail_factory (void)
 
     if (thumbnail_factory == NULL)
     {
-        thumbnail_factory = gnome_desktop_thumbnail_factory_new (GNOME_DESKTOP_THUMBNAIL_SIZE_LARGE);
+        GdkDisplay *display = gdk_display_get_default ();
+        GListModel *monitors = gdk_display_get_monitors (display);
+        gint max_scale = 1;
+        GnomeDesktopThumbnailSize size;
+
+        for (guint i = 0; i < g_list_model_get_n_items (monitors); i++)
+        {
+            g_autoptr (GdkMonitor) monitor = g_list_model_get_item (monitors, i);
+
+            max_scale = MAX (max_scale, gdk_monitor_get_scale_factor (monitor));
+        }
+
+        if (max_scale <= 1)
+        {
+            size = GNOME_DESKTOP_THUMBNAIL_SIZE_LARGE;
+        }
+        else if (max_scale <= 2)
+        {
+            size = GNOME_DESKTOP_THUMBNAIL_SIZE_XLARGE;
+        }
+        else
+        {
+            size = GNOME_DESKTOP_THUMBNAIL_SIZE_XXLARGE;
+        }
+
+        thumbnail_factory = gnome_desktop_thumbnail_factory_new (size);
     }
 
     return thumbnail_factory;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]