summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcaja-private/caja-autorun.c10
-rw-r--r--libcaja-private/caja-bookmark.c5
-rw-r--r--libcaja-private/caja-file-conflict-dialog.c4
-rw-r--r--libcaja-private/caja-file.c32
-rw-r--r--libcaja-private/caja-file.h2
-rw-r--r--libcaja-private/caja-icon-canvas-item.c150
-rw-r--r--libcaja-private/caja-icon-info.c54
-rw-r--r--libcaja-private/caja-icon-info.h12
-rw-r--r--libcaja-private/caja-program-choosing.c4
-rw-r--r--libcaja-private/caja-ui-utilities.c22
-rw-r--r--libcaja-private/caja-ui-utilities.h4
-rw-r--r--src/caja-autorun-software.c3
-rw-r--r--src/caja-desktop-window.c3
-rw-r--r--src/caja-emblem-sidebar.c11
-rw-r--r--src/caja-file-management-properties.c5
-rw-r--r--src/caja-navigation-window.c3
-rw-r--r--src/caja-notes-viewer.c4
-rw-r--r--src/caja-pathbar.c23
-rw-r--r--src/caja-places-sidebar.c9
-rw-r--r--src/caja-property-browser.c8
-rw-r--r--src/caja-sidebar-title.c5
-rw-r--r--src/caja-spatial-window.c6
-rw-r--r--src/caja-window-menus.c2
-rw-r--r--src/caja-window-toolbars.c2
-rw-r--r--src/caja-x-content-bar.c5
-rw-r--r--src/file-manager/fm-desktop-icon-view.c7
-rw-r--r--src/file-manager/fm-directory-view.c32
-rw-r--r--src/file-manager/fm-icon-container.c5
-rw-r--r--src/file-manager/fm-list-model.c38
-rw-r--r--src/file-manager/fm-list-view.c14
-rw-r--r--src/file-manager/fm-properties-window.c23
-rw-r--r--src/file-manager/fm-tree-model.c10
32 files changed, 332 insertions, 185 deletions
diff --git a/libcaja-private/caja-autorun.c b/libcaja-private/caja-autorun.c
index 0c08004e..cc19d280 100644
--- a/libcaja-private/caja-autorun.c
+++ b/libcaja-private/caja-autorun.c
@@ -469,7 +469,7 @@ caja_autorun_prepare_combo_box (GtkWidget *combo_box,
GtkListStore *list_store;
GtkTreeIter iter;
GdkPixbuf *pixbuf;
- int icon_size;
+ int icon_size, icon_scale;
int set_active;
int n;
int num_apps;
@@ -485,6 +485,7 @@ caja_autorun_prepare_combo_box (GtkWidget *combo_box,
pref_ask = !pref_start_app && !pref_ignore && !pref_open_folder;
icon_size = caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU);
+ icon_scale = gtk_widget_get_scale_factor (combo_box);
set_active = -1;
data = NULL;
@@ -594,7 +595,7 @@ caja_autorun_prepare_combo_box (GtkWidget *combo_box,
*/
icon = g_app_info_get_icon (app_info);
- icon_info = caja_icon_info_lookup (icon, icon_size);
+ icon_info = caja_icon_info_lookup (icon, icon_size, icon_scale);
pixbuf = caja_icon_info_get_pixbuf_at_size (icon_info, icon_size);
g_object_unref (icon_info);
@@ -935,7 +936,7 @@ do_autorun_for_content_type (GMount *mount, const char *x_content_type, CajaAuto
GIcon *icon;
GdkPixbuf *pixbuf;
CajaIconInfo *icon_info;
- int icon_size;
+ int icon_size, icon_scale;
gboolean user_forced_dialog;
gboolean pref_ask;
gboolean pref_start_app;
@@ -999,7 +1000,8 @@ show_dialog:
icon = g_mount_get_icon (mount);
icon_size = caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_DIALOG);
- icon_info = caja_icon_info_lookup (icon, icon_size);
+ icon_scale = gtk_widget_get_scale_factor (dialog);
+ icon_info = caja_icon_info_lookup (icon, icon_size, icon_scale);
pixbuf = caja_icon_info_get_pixbuf_at_size (icon_info, icon_size);
g_object_unref (icon_info);
g_object_unref (icon);
diff --git a/libcaja-private/caja-bookmark.c b/libcaja-private/caja-bookmark.c
index 700d8f68..0b50a719 100644
--- a/libcaja-private/caja-bookmark.c
+++ b/libcaja-private/caja-bookmark.c
@@ -220,7 +220,7 @@ caja_bookmark_get_pixbuf (CajaBookmark *bookmark,
GdkPixbuf *result;
GIcon *icon;
CajaIconInfo *info;
- int pixel_size;
+ int pixel_size, pixel_scale;
g_return_val_if_fail (CAJA_IS_BOOKMARK (bookmark), NULL);
@@ -232,7 +232,8 @@ caja_bookmark_get_pixbuf (CajaBookmark *bookmark,
}
pixel_size = caja_get_icon_size_for_stock_size (stock_size);
- info = caja_icon_info_lookup (icon, pixel_size);
+ pixel_scale = gdk_window_get_scale_factor (gdk_get_default_root_window ());
+ info = caja_icon_info_lookup (icon, pixel_size, pixel_scale);
result = caja_icon_info_get_pixbuf_at_size (info, pixel_size);
g_object_unref (info);
diff --git a/libcaja-private/caja-file-conflict-dialog.c b/libcaja-private/caja-file-conflict-dialog.c
index 2b9a7955..c51c626e 100644
--- a/libcaja-private/caja-file-conflict-dialog.c
+++ b/libcaja-private/caja-file-conflict-dialog.c
@@ -80,6 +80,7 @@ file_icons_changed (CajaFile *file,
pixbuf = caja_file_get_icon_pixbuf (fcd->details->destination,
CAJA_ICON_SIZE_LARGE,
TRUE,
+ gtk_widget_get_scale_factor (fcd->details->dest_image),
CAJA_FILE_ICON_FLAGS_USE_THUMBNAILS);
gtk_image_set_from_pixbuf (GTK_IMAGE (fcd->details->dest_image), pixbuf);
@@ -88,6 +89,7 @@ file_icons_changed (CajaFile *file,
pixbuf = caja_file_get_icon_pixbuf (fcd->details->source,
CAJA_ICON_SIZE_LARGE,
TRUE,
+ gtk_widget_get_scale_factor (fcd->details->src_image),
CAJA_FILE_ICON_FLAGS_USE_THUMBNAILS);
gtk_image_set_from_pixbuf (GTK_IMAGE (fcd->details->src_image), pixbuf);
@@ -239,6 +241,7 @@ file_list_ready_cb (GList *files,
pixbuf = caja_file_get_icon_pixbuf (dest,
CAJA_ICON_SIZE_LARGE,
TRUE,
+ gtk_widget_get_scale_factor (fcd->details->titles_vbox),
CAJA_FILE_ICON_FLAGS_USE_THUMBNAILS);
details->dest_image = gtk_image_new_from_pixbuf (pixbuf);
gtk_box_pack_start (GTK_BOX (details->first_hbox),
@@ -249,6 +252,7 @@ file_list_ready_cb (GList *files,
pixbuf = caja_file_get_icon_pixbuf (src,
CAJA_ICON_SIZE_LARGE,
TRUE,
+ gtk_widget_get_scale_factor (fcd->details->titles_vbox),
CAJA_FILE_ICON_FLAGS_USE_THUMBNAILS);
details->src_image = gtk_image_new_from_pixbuf (pixbuf);
gtk_box_pack_start (GTK_BOX (details->second_hbox),
diff --git a/libcaja-private/caja-file.c b/libcaja-private/caja-file.c
index 769ca822..667f74af 100644
--- a/libcaja-private/caja-file.c
+++ b/libcaja-private/caja-file.c
@@ -4288,6 +4288,7 @@ get_default_file_icon (CajaFileIconFlags flags)
CajaIconInfo *
caja_file_get_icon (CajaFile *file,
int size,
+ int scale,
CajaFileIconFlags flags)
{
CajaIconInfo *icon;
@@ -4303,7 +4304,7 @@ caja_file_get_icon (CajaFile *file,
if (gicon) {
GdkPixbuf *pixbuf;
- icon = caja_icon_info_lookup (gicon, size);
+ icon = caja_icon_info_lookup (gicon, size, scale);
g_object_unref (gicon);
pixbuf = caja_icon_info_get_pixbuf (icon);
@@ -4313,7 +4314,7 @@ caja_file_get_icon (CajaFile *file,
}
g_object_unref (icon);
- icon = caja_icon_info_new_for_pixbuf (pixbuf);
+ icon = caja_icon_info_new_for_pixbuf (pixbuf, scale);
g_object_unref (pixbuf);
}
@@ -4329,7 +4330,7 @@ caja_file_get_icon (CajaFile *file,
caja_file_should_show_thumbnail (file)) {
if (file->details->thumbnail) {
int w, h, s;
- double scale;
+ double thumb_scale;
raw_pixbuf = g_object_ref (file->details->thumbnail);
@@ -4339,19 +4340,19 @@ caja_file_get_icon (CajaFile *file,
s = MAX (w, h);
/* Don't scale up small thumbnails in the standard view */
if (s <= cached_thumbnail_size) {
- scale = (double)size / CAJA_ICON_SIZE_STANDARD;
+ thumb_scale = (double)size / CAJA_ICON_SIZE_STANDARD;
}
else {
- scale = (double)modified_size / s;
+ thumb_scale = (double)modified_size / s;
}
/* Make sure that icons don't get smaller than CAJA_ICON_SIZE_SMALLEST */
- if (s*scale <= CAJA_ICON_SIZE_SMALLEST) {
- scale = (double) CAJA_ICON_SIZE_SMALLEST / s;
+ if (s*thumb_scale <= CAJA_ICON_SIZE_SMALLEST) {
+ thumb_scale = (double) CAJA_ICON_SIZE_SMALLEST / s;
}
scaled_pixbuf = gdk_pixbuf_scale_simple (raw_pixbuf,
- MAX (w * scale, 1),
- MAX (h * scale, 1),
+ MAX (w * thumb_scale, 1),
+ MAX (h * thumb_scale, 1),
GDK_INTERP_BILINEAR);
/* Render frames only for thumbnails of non-image files
@@ -4377,7 +4378,7 @@ caja_file_get_icon (CajaFile *file,
caja_file_invalidate_attributes (file, CAJA_FILE_ATTRIBUTE_THUMBNAIL);
}
- icon = caja_icon_info_new_for_pixbuf (scaled_pixbuf);
+ icon = caja_icon_info_new_for_pixbuf (scaled_pixbuf, scale);
g_object_unref (scaled_pixbuf);
return icon;
} else if (file->details->thumbnail_path == NULL &&
@@ -4397,15 +4398,15 @@ caja_file_get_icon (CajaFile *file,
gicon = caja_file_get_gicon (file, flags);
if (gicon) {
- icon = caja_icon_info_lookup (gicon, size);
+ icon = caja_icon_info_lookup (gicon, size, scale);
if (caja_icon_info_is_fallback (icon)) {
g_object_unref (icon);
- icon = caja_icon_info_lookup (get_default_file_icon (flags), size);
+ icon = caja_icon_info_lookup (get_default_file_icon (flags), size, scale);
}
g_object_unref (gicon);
return icon;
} else {
- return caja_icon_info_lookup (get_default_file_icon (flags), size);
+ return caja_icon_info_lookup (get_default_file_icon (flags), size, scale);
}
}
@@ -4413,12 +4414,13 @@ GdkPixbuf *
caja_file_get_icon_pixbuf (CajaFile *file,
int size,
gboolean force_size,
+ int scale,
CajaFileIconFlags flags)
{
CajaIconInfo *info;
GdkPixbuf *pixbuf;
- info = caja_file_get_icon (file, size, flags);
+ info = caja_file_get_icon (file, size, scale, flags);
if (force_size) {
pixbuf = caja_icon_info_get_pixbuf_at_size (info, size);
} else {
@@ -6719,7 +6721,7 @@ caja_file_get_emblem_pixbufs (CajaFile *file,
for (l = icons; l != NULL; l = l->next) {
icon = l->data;
- icon_info = caja_icon_info_lookup (icon, size);
+ icon_info = caja_icon_info_lookup (icon, size, 1);
if (force_size) {
pixbuf = caja_icon_info_get_pixbuf_nodefault_at_size (icon_info, size);
} else {
diff --git a/libcaja-private/caja-file.h b/libcaja-private/caja-file.h
index f94bbe33..6a30b618 100644
--- a/libcaja-private/caja-file.h
+++ b/libcaja-private/caja-file.h
@@ -453,10 +453,12 @@ GIcon * caja_file_get_gicon (CajaFile
CajaFileIconFlags flags);
CajaIconInfo * caja_file_get_icon (CajaFile *file,
int size,
+ int scale,
CajaFileIconFlags flags);
GdkPixbuf * caja_file_get_icon_pixbuf (CajaFile *file,
int size,
gboolean force_size,
+ int scale,
CajaFileIconFlags flags);
gboolean caja_file_has_open_window (CajaFile *file);
diff --git a/libcaja-private/caja-icon-canvas-item.c b/libcaja-private/caja-icon-canvas-item.c
index 88908196..98551be4 100644
--- a/libcaja-private/caja-icon-canvas-item.c
+++ b/libcaja-private/caja-icon-canvas-item.c
@@ -83,7 +83,7 @@ struct CajaIconCanvasItemDetails
/* The image, text, font. */
double x, y;
GdkPixbuf *pixbuf;
- GdkPixbuf *rendered_pixbuf;
+ cairo_surface_t *rendered_surface;
GList *emblem_pixbufs;
char *editable_text; /* Text that can be modified by a renaming function */
char *additional_text; /* Text that cannot be modifed, such as file size, etc. */
@@ -278,9 +278,9 @@ caja_icon_canvas_item_finalize (GObject *object)
g_free (details->additional_text);
g_free (details->attach_points);
- if (details->rendered_pixbuf != NULL)
+ if (details->rendered_surface != NULL)
{
- g_object_unref (details->rendered_pixbuf);
+ g_object_unref (details->rendered_surface);
}
if (details->editable_text_layout != NULL)
@@ -498,6 +498,27 @@ caja_icon_canvas_item_get_property (GObject *object,
}
}
+static void
+get_scaled_icon_size (CajaIconCanvasItem *item,
+ gint *width,
+ gint *height)
+{
+ EelCanvas *canvas;
+ GdkPixbuf *pixbuf = NULL;
+ gint scale;
+
+ if (item != NULL) {
+ canvas = EEL_CANVAS_ITEM (item)->canvas;
+ scale = gtk_widget_get_scale_factor (GTK_WIDGET (canvas));
+ pixbuf = item->details->pixbuf;
+ }
+
+ if (width)
+ *width = (pixbuf == NULL) ? 0 : (gdk_pixbuf_get_width (pixbuf) / scale);
+ if (height)
+ *height = (pixbuf == NULL) ? 0 : (gdk_pixbuf_get_height (pixbuf) / scale);
+}
+
cairo_surface_t *
caja_icon_canvas_item_get_drag_surface (CajaIconCanvasItem *item)
{
@@ -506,6 +527,7 @@ caja_icon_canvas_item_get_drag_surface (CajaIconCanvasItem *item)
EelCanvas *canvas;
GdkScreen *screen;
int width, height;
+ int pix_width, pix_height;
int item_offset_x, item_offset_y;
EelIRect icon_rect;
EelIRect emblem_rect;
@@ -554,11 +576,12 @@ caja_icon_canvas_item_get_drag_surface (CajaIconCanvasItem *item)
item_offset_x, item_offset_y);
cairo_surface_destroy (drag_surface);
+ get_scaled_icon_size (item, &pix_width, &pix_height);
icon_rect.x0 = item_offset_x;
icon_rect.y0 = item_offset_y;
- icon_rect.x1 = item_offset_x + gdk_pixbuf_get_width (item->details->pixbuf);
- icon_rect.y1 = item_offset_y + gdk_pixbuf_get_height (item->details->pixbuf);
+ icon_rect.x1 = item_offset_x + pix_width;
+ icon_rect.y1 = item_offset_y + pix_height;
is_rtl = caja_icon_container_is_layout_rtl (CAJA_ICON_CONTAINER (canvas));
@@ -607,10 +630,10 @@ caja_icon_canvas_item_set_image (CajaIconCanvasItem *item,
{
g_object_unref (details->pixbuf);
}
- if (details->rendered_pixbuf != NULL)
+ if (details->rendered_surface != NULL)
{
- g_object_unref (details->rendered_pixbuf);
- details->rendered_pixbuf = NULL;
+ cairo_surface_destroy (details->rendered_surface);
+ details->rendered_surface = NULL;
}
details->pixbuf = image;
@@ -1671,8 +1694,8 @@ draw_pixbuf (GdkPixbuf *pixbuf,
}
/* shared code to highlight or dim the passed-in pixbuf */
-static GdkPixbuf *
-real_map_pixbuf (CajaIconCanvasItem *icon_item)
+static cairo_surface_t *
+real_map_surface (CajaIconCanvasItem *icon_item)
{
EelCanvas *canvas;
char *audio_filename;
@@ -1681,6 +1704,7 @@ real_map_pixbuf (CajaIconCanvasItem *icon_item)
int emblem_size;
GtkStyleContext *style;
GdkRGBA color;
+ cairo_surface_t *surface;
temp_pixbuf = icon_item->details->pixbuf;
canvas = EEL_CANVAS_ITEM(icon_item)->canvas;
@@ -1758,13 +1782,18 @@ real_map_pixbuf (CajaIconCanvasItem *icon_item)
g_object_unref (old_pixbuf);
}
- return temp_pixbuf;
+ surface = gdk_cairo_surface_create_from_pixbuf (temp_pixbuf,
+ gtk_widget_get_scale_factor (GTK_WIDGET (canvas)),
+ gtk_widget_get_window (GTK_WIDGET (canvas)));
+ g_object_unref (temp_pixbuf);
+
+ return surface;
}
-static GdkPixbuf *
-map_pixbuf (CajaIconCanvasItem *icon_item)
+static cairo_surface_t *
+map_surface (CajaIconCanvasItem *icon_item)
{
- if (!(icon_item->details->rendered_pixbuf != NULL
+ if (!(icon_item->details->rendered_surface != NULL
&& icon_item->details->rendered_is_active == icon_item->details->is_active
&& icon_item->details->rendered_is_prelit == icon_item->details->is_prelit
&& icon_item->details->rendered_is_highlighted_for_selection == icon_item->details->is_highlighted_for_selection
@@ -1772,11 +1801,11 @@ map_pixbuf (CajaIconCanvasItem *icon_item)
&& icon_item->details->rendered_is_highlighted_for_clipboard == icon_item->details->is_highlighted_for_clipboard
&& (icon_item->details->is_highlighted_for_selection && icon_item->details->rendered_is_focused == gtk_widget_has_focus (GTK_WIDGET (EEL_CANVAS_ITEM (icon_item)->canvas)))))
{
- if (icon_item->details->rendered_pixbuf != NULL)
+ if (icon_item->details->rendered_surface != NULL)
{
- g_object_unref (icon_item->details->rendered_pixbuf);
+ cairo_surface_destroy (icon_item->details->rendered_surface);
}
- icon_item->details->rendered_pixbuf = real_map_pixbuf (icon_item);
+ icon_item->details->rendered_surface = real_map_surface (icon_item);
icon_item->details->rendered_is_active = icon_item->details->is_active;
icon_item->details->rendered_is_prelit = icon_item->details->is_prelit;
icon_item->details->rendered_is_highlighted_for_selection = icon_item->details->is_highlighted_for_selection;
@@ -1785,9 +1814,9 @@ map_pixbuf (CajaIconCanvasItem *icon_item)
icon_item->details->rendered_is_focused = gtk_widget_has_focus (GTK_WIDGET (EEL_CANVAS_ITEM (icon_item)->canvas));
}
- g_object_ref (icon_item->details->rendered_pixbuf);
+ cairo_surface_reference (icon_item->details->rendered_surface);
- return icon_item->details->rendered_pixbuf;
+ return icon_item->details->rendered_surface;
}
static void
@@ -1863,7 +1892,8 @@ caja_icon_canvas_item_draw (EelCanvasItem *item,
CajaIconCanvasItemDetails *details;
EelIRect icon_rect, emblem_rect;
EmblemLayout emblem_layout;
- GdkPixbuf *emblem_pixbuf, *temp_pixbuf;
+ GdkPixbuf *emblem_pixbuf;
+ cairo_surface_t *temp_surface;
GtkStyleContext *context;
container = CAJA_ICON_CONTAINER (item->canvas);
@@ -1884,12 +1914,12 @@ caja_icon_canvas_item_draw (EelCanvasItem *item,
icon_rect = icon_item->details->canvas_rect;
- temp_pixbuf = map_pixbuf (icon_item);
+ temp_surface = map_surface (icon_item);
- gtk_render_icon (context, cr,
- temp_pixbuf,
- icon_rect.x0, icon_rect.y0);
- g_object_unref (temp_pixbuf);
+ gtk_render_icon_surface (context, cr,
+ temp_surface,
+ icon_rect.x0, icon_rect.y0);
+ cairo_surface_destroy (temp_surface);
draw_embedded_text (icon_item, cr, icon_rect.x0, icon_rect.y0);
@@ -2360,6 +2390,7 @@ caja_icon_canvas_item_ensure_bounds_up_to_date (CajaIconCanvasItem *icon_item)
EelIRect total_rect, total_rect_for_layout, total_rect_for_entire_text;
EelCanvasItem *item;
double pixels_per_unit;
+ gint width, height;
EmblemLayout emblem_layout;
GdkPixbuf *emblem_pixbuf;
gboolean is_rtl;
@@ -2378,20 +2409,13 @@ caja_icon_canvas_item_ensure_bounds_up_to_date (CajaIconCanvasItem *icon_item)
icon_rect.y0 = 0;
icon_rect_raw.x0 = 0;
icon_rect_raw.y0 = 0;
- if (details->pixbuf == NULL)
- {
- icon_rect.x1 = icon_rect.x0;
- icon_rect.y1 = icon_rect.y0;
- icon_rect_raw.x1 = icon_rect_raw.x0;
- icon_rect_raw.y1 = icon_rect_raw.y0;
- }
- else
- {
- icon_rect_raw.x1 = icon_rect_raw.x0 + gdk_pixbuf_get_width (details->pixbuf);
- icon_rect_raw.y1 = icon_rect_raw.y0 + gdk_pixbuf_get_height (details->pixbuf);
- icon_rect.x1 = icon_rect_raw.x1 / pixels_per_unit;
- icon_rect.y1 = icon_rect_raw.y1 / pixels_per_unit;
- }
+
+ get_scaled_icon_size (icon_item, &width, &height);
+
+ icon_rect_raw.x1 = icon_rect_raw.x0 + width;
+ icon_rect_raw.y1 = icon_rect_raw.y0 + height;
+ icon_rect.x1 = icon_rect_raw.x1 / pixels_per_unit;
+ icon_rect.y1 = icon_rect_raw.y1 / pixels_per_unit;
/* Compute text rectangle. */
text_rect = compute_text_rectangle (icon_item, icon_rect, FALSE, BOUNDS_USAGE_FOR_DISPLAY);
@@ -2430,18 +2454,17 @@ caja_icon_canvas_item_get_icon_rectangle (const CajaIconCanvasItem *item)
{
EelDRect rectangle;
double pixels_per_unit;
- GdkPixbuf *pixbuf;
+ gint width, height;
g_return_val_if_fail (CAJA_IS_ICON_CANVAS_ITEM (item), eel_drect_empty);
rectangle.x0 = item->details->x;
rectangle.y0 = item->details->y;
- pixbuf = item->details->pixbuf;
-
pixels_per_unit = EEL_CANVAS_ITEM (item)->canvas->pixels_per_unit;
- rectangle.x1 = rectangle.x0 + (pixbuf == NULL ? 0 : gdk_pixbuf_get_width (pixbuf)) / pixels_per_unit;
- rectangle.y1 = rectangle.y0 + (pixbuf == NULL ? 0 : gdk_pixbuf_get_height (pixbuf)) / pixels_per_unit;
+ get_scaled_icon_size (EEL_CANVAS_ITEM (item), &width, &height);
+ rectangle.x1 = rectangle.x0 + width / pixels_per_unit;
+ rectangle.y1 = rectangle.y0 + height / pixels_per_unit;
eel_canvas_item_i2w (EEL_CANVAS_ITEM (item),
&rectangle.x0,
@@ -2462,18 +2485,17 @@ caja_icon_canvas_item_get_text_rectangle (CajaIconCanvasItem *item,
EelIRect text_rectangle;
EelDRect ret;
double pixels_per_unit;
- GdkPixbuf *pixbuf;
+ gint width, height;
g_return_val_if_fail (CAJA_IS_ICON_CANVAS_ITEM (item), eel_drect_empty);
icon_rectangle.x0 = item->details->x;
icon_rectangle.y0 = item->details->y;
- pixbuf = item->details->pixbuf;
-
pixels_per_unit = EEL_CANVAS_ITEM (item)->canvas->pixels_per_unit;
- icon_rectangle.x1 = icon_rectangle.x0 + (pixbuf == NULL ? 0 : gdk_pixbuf_get_width (pixbuf)) / pixels_per_unit;
- icon_rectangle.y1 = icon_rectangle.y0 + (pixbuf == NULL ? 0 : gdk_pixbuf_get_height (pixbuf)) / pixels_per_unit;
+ get_scaled_icon_size (item, &width, &height);
+ icon_rectangle.x1 = icon_rectangle.x0 + width / pixels_per_unit;
+ icon_rectangle.y1 = icon_rectangle.y0 + height / pixels_per_unit;
measure_label_text (item);
@@ -2495,27 +2517,27 @@ caja_icon_canvas_item_get_text_rectangle (CajaIconCanvasItem *item,
return ret;
}
-
/* Get the rectangle of the icon only, in canvas coordinates. */
static void
get_icon_canvas_rectangle (CajaIconCanvasItem *item,
EelIRect *rect)
{
- GdkPixbuf *pixbuf;
+ gint width, height;
g_assert (CAJA_IS_ICON_CANVAS_ITEM (item));
g_assert (rect != NULL);
+
eel_canvas_w2c (EEL_CANVAS_ITEM (item)->canvas,
item->details->x,
item->details->y,
&rect->x0,
&rect->y0);
- pixbuf = item->details->pixbuf;
+ get_scaled_icon_size (item, &width, &height);
- rect->x1 = rect->x0 + (pixbuf == NULL ? 0 : gdk_pixbuf_get_width (pixbuf));
- rect->y1 = rect->y0 + (pixbuf == NULL ? 0 : gdk_pixbuf_get_height (pixbuf));
+ rect->x1 = rect->x0 + width;
+ rect->y1 = rect->y0 + height;
}
void
@@ -3114,15 +3136,7 @@ caja_icon_canvas_item_accessible_get_image_size
item = CAJA_ICON_CANVAS_ITEM (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (image)));
- if (!item || !item->details->pixbuf)
- {
- *width = *height = 0;
- }
- else
- {
- *width = gdk_pixbuf_get_width (item->details->pixbuf);
- *height = gdk_pixbuf_get_height (item->details->pixbuf);
- }
+ get_scaled_icon_size (item, width, height);
}
static void
@@ -3224,7 +3238,7 @@ caja_icon_canvas_item_accessible_get_offset_at_point (AtkText *text,
char *icon_text;
gboolean have_editable;
gboolean have_additional;
- gint text_offset;
+ gint text_offset, height;
atk_component_get_extents (ATK_COMPONENT (text), &real_x, &real_y,
&real_width, &real_height, coords);
@@ -3236,7 +3250,8 @@ caja_icon_canvas_item_accessible_get_offset_at_point (AtkText *text,
if (item->details->pixbuf)
{
- y -= gdk_pixbuf_get_height (item->details->pixbuf);
+ get_scaled_icon_size (item, NULL, &height);
+ y -= height;
}
have_editable = item->details->editable_text != NULL &&
item->details->editable_text[0] != '\0';
@@ -3353,14 +3368,15 @@ caja_icon_canvas_item_accessible_get_character_extents (AtkText *text,
PangoRectangle rect;
PangoRectangle rect0;
gboolean have_editable;
- gint text_offset;
+ gint text_offset, pix_height;
atk_component_get_extents (ATK_COMPONENT (text), &pos_x, &pos_y, NULL, NULL, coords);
item = CAJA_ICON_CANVAS_ITEM (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text)));
if (item->details->pixbuf)
{
- pos_y += gdk_pixbuf_get_height (item->details->pixbuf);
+ get_scaled_icon_size (item, NULL, &pix_height);
+ pos_y += pix_height;
}
have_editable = item->details->editable_text != NULL &&
diff --git a/libcaja-private/caja-icon-info.c b/libcaja-private/caja-icon-info.c
index 3cb90c54..7c35f713 100644
--- a/libcaja-private/caja-icon-info.c
+++ b/libcaja-private/caja-icon-info.c
@@ -40,6 +40,8 @@ struct _CajaIconInfo
GdkPoint *attach_points;
char *display_name;
char *icon_name;
+
+ gint orig_scale;
};
struct _CajaIconInfoClass
@@ -121,7 +123,8 @@ caja_icon_info_class_init (CajaIconInfoClass *icon_info_class)
}
CajaIconInfo *
-caja_icon_info_new_for_pixbuf (GdkPixbuf *pixbuf)
+caja_icon_info_new_for_pixbuf (GdkPixbuf *pixbuf,
+ gint scale)
{
CajaIconInfo *icon;
@@ -132,11 +135,14 @@ caja_icon_info_new_for_pixbuf (GdkPixbuf *pixbuf)
icon->pixbuf = g_object_ref (pixbuf);
}
+ icon->orig_scale = scale;
+
return icon;
}
static CajaIconInfo *
-caja_icon_info_new_for_icon_info (GtkIconInfo *icon_info)
+caja_icon_info_new_for_icon_info (GtkIconInfo *icon_info,
+ gint scale)
{
CajaIconInfo *icon;
GdkPoint *points;
@@ -171,6 +177,8 @@ caja_icon_info_new_for_icon_info (GtkIconInfo *icon_info)
icon->icon_name = basename;
}
+ icon->orig_scale = scale;
+
return icon;
}
@@ -347,7 +355,8 @@ themed_icon_key_free (ThemedIconKey *key)
CajaIconInfo *
caja_icon_info_lookup (GIcon *icon,
- int size)
+ int size,
+ int scale)
{
CajaIconInfo *icon_info;
GdkPixbuf *pixbuf;
@@ -378,18 +387,19 @@ caja_icon_info_lookup (GIcon *icon,
pixbuf = NULL;
stream = g_loadable_icon_load (G_LOADABLE_ICON (icon),
- size,
+ size * scale,
NULL, NULL, NULL);
if (stream)
{
pixbuf = gdk_pixbuf_new_from_stream_at_scale (stream,
- size, size, TRUE,
+ size * scale, size * scale,
+ TRUE,
NULL, NULL);
g_input_stream_close (stream, NULL, NULL);
g_object_unref (stream);
}
- icon_info = caja_icon_info_new_for_pixbuf (pixbuf);
+ icon_info = caja_icon_info_new_for_pixbuf (pixbuf, scale);
key = loadable_icon_key_new (icon, size);
g_hash_table_insert (loadable_icon_cache, key, icon_info);
@@ -417,17 +427,18 @@ caja_icon_info_lookup (GIcon *icon,
names = g_themed_icon_get_names (G_THEMED_ICON (icon));
icon_theme = gtk_icon_theme_get_default ();
- gtkicon_info = gtk_icon_theme_choose_icon (icon_theme, (const char **)names, size, 0);
+ gtkicon_info = gtk_icon_theme_choose_icon_for_scale (icon_theme, (const char **)names,
+ size, scale, 0);
if (gtkicon_info == NULL)
{
- return caja_icon_info_new_for_pixbuf (NULL);
+ return caja_icon_info_new_for_pixbuf (NULL, scale);
}
filename = gtk_icon_info_get_filename (gtkicon_info);
if (filename == NULL) {
g_object_unref (gtkicon_info);
- return caja_icon_info_new_for_pixbuf (NULL);
+ return caja_icon_info_new_for_pixbuf (NULL, scale);
}
lookup_key.filename = (char *)filename;
@@ -440,7 +451,7 @@ caja_icon_info_lookup (GIcon *icon,
return g_object_ref (icon_info);
}
- icon_info = caja_icon_info_new_for_icon_info (gtkicon_info);
+ icon_info = caja_icon_info_new_for_icon_info (gtkicon_info, scale);
key = themed_icon_key_new (filename, size);
g_hash_table_insert (themed_icon_cache, key, icon_info);
@@ -454,9 +465,10 @@ caja_icon_info_lookup (GIcon *icon,
GdkPixbuf *pixbuf;
GtkIconInfo *gtk_icon_info;
- gtk_icon_info = gtk_icon_theme_lookup_by_gicon (gtk_icon_theme_get_default (),
+ gtk_icon_info = gtk_icon_theme_lookup_by_gicon_for_scale (gtk_icon_theme_get_default (),
icon,
size,
+ scale,
GTK_ICON_LOOKUP_FORCE_SIZE);
if (gtk_icon_info != NULL)
{
@@ -468,7 +480,7 @@ caja_icon_info_lookup (GIcon *icon,
pixbuf = NULL;
}
- icon_info = caja_icon_info_new_for_pixbuf (pixbuf);
+ icon_info = caja_icon_info_new_for_pixbuf (pixbuf, scale);
if (pixbuf != NULL) {
g_object_unref (pixbuf);
@@ -480,20 +492,22 @@ caja_icon_info_lookup (GIcon *icon,
CajaIconInfo *
caja_icon_info_lookup_from_name (const char *name,
- int size)
+ int size,
+ int scale)
{
GIcon *icon;
CajaIconInfo *info;
icon = g_themed_icon_new (name);
- info = caja_icon_info_lookup (icon, size);
+ info = caja_icon_info_lookup (icon, size, scale);
g_object_unref (icon);
return info;
}
CajaIconInfo *
caja_icon_info_lookup_from_path (const char *path,
- int size)
+ int size,
+ int scale)
{
GFile *icon_file;
GIcon *icon;
@@ -501,7 +515,7 @@ caja_icon_info_lookup_from_path (const char *path,
icon_file = g_file_new_for_path (path);
icon = g_file_icon_new (icon_file);
- info = caja_icon_info_lookup (icon, size);
+ info = caja_icon_info_lookup (icon, size, scale);
g_object_unref (icon);
g_object_unref (icon_file);
return info;
@@ -568,8 +582,8 @@ caja_icon_info_get_pixbuf_nodefault_at_size (CajaIconInfo *icon,
if (pixbuf == NULL)
return NULL;
- w = gdk_pixbuf_get_width (pixbuf);
- h = gdk_pixbuf_get_height (pixbuf);
+ w = gdk_pixbuf_get_width (pixbuf) / icon->orig_scale;
+ h = gdk_pixbuf_get_height (pixbuf) / icon->orig_scale;
s = MAX (w, h);
if (s == forced_size)
{
@@ -595,8 +609,8 @@ caja_icon_info_get_pixbuf_at_size (CajaIconInfo *icon,
pixbuf = caja_icon_info_get_pixbuf (icon);
- w = gdk_pixbuf_get_width (pixbuf);
- h = gdk_pixbuf_get_height (pixbuf);
+ w = gdk_pixbuf_get_width (pixbuf) / icon->orig_scale;
+ h = gdk_pixbuf_get_height (pixbuf) / icon->orig_scale;
s = MAX (w, h);
if (s == forced_size)
{
diff --git a/libcaja-private/caja-icon-info.h b/libcaja-private/caja-icon-info.h
index d4523d1a..d456e575 100644
--- a/libcaja-private/caja-icon-info.h
+++ b/libcaja-private/caja-icon-info.h
@@ -56,13 +56,17 @@ extern "C" {
GType caja_icon_info_get_type (void) G_GNUC_CONST;
- CajaIconInfo * caja_icon_info_new_for_pixbuf (GdkPixbuf *pixbuf);
+ CajaIconInfo * caja_icon_info_new_for_pixbuf (GdkPixbuf *pixbuf,
+ int scale);
CajaIconInfo * caja_icon_info_lookup (GIcon *icon,
- int size);
+ int size,
+ int scale);
CajaIconInfo * caja_icon_info_lookup_from_name (const char *name,
- int size);
+ int size,
+ int scale);
CajaIconInfo * caja_icon_info_lookup_from_path (const char *path,
- int size);
+ int size,
+ int scale);
gboolean caja_icon_info_is_fallback (CajaIconInfo *icon);
GdkPixbuf * caja_icon_info_get_pixbuf (CajaIconInfo *icon);
GdkPixbuf * caja_icon_info_get_pixbuf_nodefault (CajaIconInfo *icon);
diff --git a/libcaja-private/caja-program-choosing.c b/libcaja-private/caja-program-choosing.c
index 27043583..a49a96e9 100644
--- a/libcaja-private/caja-program-choosing.c
+++ b/libcaja-private/caja-program-choosing.c
@@ -244,7 +244,9 @@ caja_launch_application_by_uri (GAppInfo *application,
}
file = caja_file_get_by_uri (uris->data);
- icon = caja_file_get_icon (file, 48, 0);
+ icon = caja_file_get_icon (file,
+ 48, gtk_widget_get_scale_factor (GTK_WIDGET (parent_window)),
+ 0);
caja_file_unref (file);
if (icon)
{
diff --git a/libcaja-private/caja-ui-utilities.c b/libcaja-private/caja-ui-utilities.c
index 8077e975..0bd096e1 100644
--- a/libcaja-private/caja-ui-utilities.c
+++ b/libcaja-private/caja-ui-utilities.c
@@ -138,18 +138,23 @@ extension_action_sensitive_callback (CajaMenuItem *item,
}
static GdkPixbuf *
-get_action_icon (const char *icon_name, int size)
+get_action_icon (const char *icon_name,
+ int size,
+ GtkWidget *parent_widget)
{
CajaIconInfo *info;
GdkPixbuf *pixbuf;
+ int scale;
+
+ scale = gtk_widget_get_scale_factor (parent_widget);
if (g_path_is_absolute (icon_name))
{
- info = caja_icon_info_lookup_from_path (icon_name, size);
+ info = caja_icon_info_lookup_from_path (icon_name, size, scale);
}
else
{
- info = caja_icon_info_lookup_from_name (icon_name, size);
+ info = caja_icon_info_lookup_from_name (icon_name, size, scale);
}
pixbuf = caja_icon_info_get_pixbuf_nodefault_at_size (info, size);
g_object_unref (info);
@@ -158,7 +163,8 @@ get_action_icon (const char *icon_name, int size)
}
GtkAction *
-caja_action_from_menu_item (CajaMenuItem *item)
+caja_action_from_menu_item (CajaMenuItem *item,
+ GtkWidget *parent_widget)
{
char *name, *label, *tip, *icon_name;
gboolean sensitive, priority;
@@ -180,7 +186,8 @@ caja_action_from_menu_item (CajaMenuItem *item)
if (icon_name != NULL)
{
pixbuf = get_action_icon (icon_name,
- caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU));
+ caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU),
+ parent_widget);
if (pixbuf != NULL)
{
g_object_set_data_full (G_OBJECT (action), "menu-icon",
@@ -206,7 +213,7 @@ caja_action_from_menu_item (CajaMenuItem *item)
}
GtkAction *
-caja_toolbar_action_from_menu_item (CajaMenuItem *item)
+caja_toolbar_action_from_menu_item (CajaMenuItem *item, GtkWidget *parent_widget)
{
char *name, *label, *tip, *icon_name;
gboolean sensitive, priority;
@@ -228,7 +235,8 @@ caja_toolbar_action_from_menu_item (CajaMenuItem *item)
if (icon_name != NULL)
{
pixbuf = get_action_icon (icon_name,
- caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_LARGE_TOOLBAR));
+ caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_LARGE_TOOLBAR),
+ parent_widget);
if (pixbuf != NULL)
{
g_object_set_data_full (G_OBJECT (action), "toolbar-icon",
diff --git a/libcaja-private/caja-ui-utilities.h b/libcaja-private/caja-ui-utilities.h
index 7fed1f5e..c7a8d595 100644
--- a/libcaja-private/caja-ui-utilities.h
+++ b/libcaja-private/caja-ui-utilities.h
@@ -36,8 +36,8 @@ void caja_ui_prepare_merge_ui (GtkUIManager *ui_manager,
const char *name,
guint *merge_id,
GtkActionGroup **action_group);
-GtkAction * caja_action_from_menu_item (CajaMenuItem *item);
-GtkAction * caja_toolbar_action_from_menu_item (CajaMenuItem *item);
+GtkAction * caja_action_from_menu_item (CajaMenuItem *item, GtkWidget *parent_widget);
+GtkAction * caja_toolbar_action_from_menu_item (CajaMenuItem *item, GtkWidget *parent_widget);
const char *caja_ui_string_get (const char *filename);
void caja_ui_frame_image (GdkPixbuf **pixbuf);
diff --git a/src/caja-autorun-software.c b/src/caja-autorun-software.c
index 8bd4514d..4e24fa80 100644
--- a/src/caja-autorun-software.c
+++ b/src/caja-autorun-software.c
@@ -230,7 +230,8 @@ present_autorun_for_software_dialog (GMount *mount)
icon = g_mount_get_icon (mount);
icon_size = caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_DIALOG);
- icon_info = caja_icon_info_lookup (icon, icon_size);
+ icon_info = caja_icon_info_lookup (icon, icon_size,
+ gtk_widget_get_scale_factor (GTK_WIDGET (dialog)));
pixbuf = caja_icon_info_get_pixbuf_at_size (icon_info, icon_size);
image = gtk_image_new_from_pixbuf (pixbuf);
gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
diff --git a/src/caja-desktop-window.c b/src/caja-desktop-window.c
index aae03b5e..2aa0c2f5 100644
--- a/src/caja-desktop-window.c
+++ b/src/caja-desktop-window.c
@@ -268,7 +268,8 @@ static CajaIconInfo *
real_get_icon (CajaWindow *window,
CajaWindowSlot *slot)
{
- return caja_icon_info_lookup_from_name (CAJA_ICON_DESKTOP, 48);
+ gint scale = gtk_widget_get_scale_factor (GTK_WIDGET (window));
+ return caja_icon_info_lookup_from_name (CAJA_ICON_DESKTOP, 48, scale);
}
static void
diff --git a/src/caja-emblem-sidebar.c b/src/caja-emblem-sidebar.c
index 6bb0d815..ae8fcfee 100644
--- a/src/caja-emblem-sidebar.c
+++ b/src/caja-emblem-sidebar.c
@@ -392,14 +392,15 @@ create_emblem_widget_with_pixbuf (CajaEmblemSidebar *emblem_sidebar,
{
GtkWidget *image, *event_box;
GdkPixbuf *prelight_pixbuf;
-
+ gint scale;
image = eel_labeled_image_new (display_name, pixbuf);
+ scale = gtk_widget_get_scale_factor (image);
eel_labeled_image_set_fixed_image_height (EEL_LABELED_IMAGE (image),
- STANDARD_EMBLEM_HEIGHT);
+ STANDARD_EMBLEM_HEIGHT * scale);
eel_labeled_image_set_spacing (EEL_LABELED_IMAGE (image),
- EMBLEM_LABEL_SPACING);
+ EMBLEM_LABEL_SPACING * scale);
event_box = gtk_event_box_new ();
gtk_container_add (GTK_CONTAINER (event_box), image);
@@ -455,8 +456,10 @@ create_emblem_widget (CajaEmblemSidebar *emblem_sidebar,
char *keyword;
GdkPixbuf *pixbuf;
CajaIconInfo *info;
+ gint scale;
- info = caja_icon_info_lookup_from_name (name, CAJA_ICON_SIZE_STANDARD);
+ scale = gtk_widget_get_scale_factor (GTK_WIDGET (emblem_sidebar->details->emblems_table));
+ info = caja_icon_info_lookup_from_name (name, CAJA_ICON_SIZE_STANDARD, scale);
pixbuf = caja_icon_info_get_pixbuf_at_size (info, CAJA_ICON_SIZE_STANDARD);
diff --git a/src/caja-file-management-properties.c b/src/caja-file-management-properties.c
index 7800c7a4..dc687688 100644
--- a/src/caja-file-management-properties.c
+++ b/src/caja-file-management-properties.c
@@ -735,7 +735,7 @@ caja_file_management_properties_dialog_setup_media_page (GtkBuilder *builder)
GIcon *icon;
CajaIconInfo *icon_info;
GdkPixbuf *pixbuf;
- int icon_size;
+ int icon_size, icon_scale;
if (!g_str_has_prefix (content_type, "x-content/"))
continue;
@@ -748,13 +748,14 @@ caja_file_management_properties_dialog_setup_media_page (GtkBuilder *builder)
}
icon_size = caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU);
+ icon_scale = gtk_widget_get_scale_factor (other_type_combo_box);
description = g_content_type_get_description (content_type);
gtk_list_store_append (other_type_list_store, &iter);
icon = g_content_type_get_icon (content_type);
if (icon != NULL)
{
- icon_info = caja_icon_info_lookup (icon, icon_size);
+ icon_info = caja_icon_info_lookup (icon, icon_size, icon_scale);
g_object_unref (icon);
pixbuf = caja_icon_info_get_pixbuf_nodefault_at_size (icon_info, icon_size);
g_object_unref (icon_info);
diff --git a/src/caja-navigation-window.c b/src/caja-navigation-window.c
index 08a7704b..531c9ae0 100644
--- a/src/caja-navigation-window.c
+++ b/src/caja-navigation-window.c
@@ -756,7 +756,8 @@ static CajaIconInfo *
real_get_icon (CajaWindow *window,
CajaWindowSlot *slot)
{
- return caja_file_get_icon (slot->viewed_file, 48,
+ return caja_file_get_icon (slot->viewed_file,
+ 48, gtk_widget_get_scale_factor (GTK_WIDGET (window)),
CAJA_FILE_ICON_FLAGS_IGNORE_VISITING |
CAJA_FILE_ICON_FLAGS_USE_MOUNT_ICON);
}
diff --git a/src/caja-notes-viewer.c b/src/caja-notes-viewer.c
index b479cc56..46ffdeae 100644
--- a/src/caja-notes-viewer.c
+++ b/src/caja-notes-viewer.c
@@ -324,13 +324,15 @@ caja_notes_viewer_init (CajaNotesViewer *sidebar)
{
CajaNotesViewerDetails *details;
CajaIconInfo *info;
+ gint scale;
details = g_new0 (CajaNotesViewerDetails, 1);
sidebar->details = details;
details->uri = g_strdup ("");
- info = caja_icon_info_lookup_from_name ("emblem-note", 16);
+ scale = gdk_window_get_scale_factor (gdk_get_default_root_window ());
+ info = caja_icon_info_lookup_from_name ("emblem-note", 16, scale);
details->icon = caja_icon_info_get_pixbuf (info);
/* create the text container */
diff --git a/src/caja-pathbar.c b/src/caja-pathbar.c
index 863e0623..533f2f7f 100644
--- a/src/caja-pathbar.c
+++ b/src/caja-pathbar.c
@@ -206,8 +206,10 @@ trash_state_changed_cb (CajaTrashMonitor *monitor,
{
GFile *file;
GList *list;
+ gint scale;
file = g_file_new_for_uri ("trash:///");
+ scale = gtk_widget_get_scale_factor (GTK_WIDGET (path_bar));
for (list = path_bar->button_list; list; list = list->next)
{
ButtonData *button_data;
@@ -219,7 +221,7 @@ trash_state_changed_cb (CajaTrashMonitor *monitor,
GdkPixbuf *pixbuf;
icon = caja_trash_monitor_get_icon ();
- icon_info = caja_icon_info_lookup (icon, CAJA_PATH_BAR_ICON_SIZE);
+ icon_info = caja_icon_info_lookup (icon, CAJA_PATH_BAR_ICON_SIZE, scale);
pixbuf = caja_icon_info_get_pixbuf_at_size (icon_info, CAJA_PATH_BAR_ICON_SIZE);
gtk_image_set_from_pixbuf (GTK_IMAGE (button_data->image), pixbuf);
}
@@ -1339,25 +1341,30 @@ button_clicked_cb (GtkWidget *button,
static CajaIconInfo *
get_type_icon_info (ButtonData *button_data)
{
+ gint icon_scale = gtk_widget_get_scale_factor (GTK_WIDGET (button_data->button));
+
switch (button_data->type)
{
case ROOT_BUTTON:
return caja_icon_info_lookup_from_name (CAJA_ICON_FILESYSTEM,
- CAJA_PATH_BAR_ICON_SIZE);
+ CAJA_PATH_BAR_ICON_SIZE,
+ icon_scale);
case HOME_BUTTON:
return caja_icon_info_lookup_from_name (CAJA_ICON_HOME,
- CAJA_PATH_BAR_ICON_SIZE);
+ CAJA_PATH_BAR_ICON_SIZE,
+ icon_scale);
case DESKTOP_BUTTON:
return caja_icon_info_lookup_from_name (CAJA_ICON_DESKTOP,
- CAJA_PATH_BAR_ICON_SIZE);
+ CAJA_PATH_BAR_ICON_SIZE,
+ icon_scale);
case NORMAL_BUTTON:
if (button_data->is_base_dir)
{
return caja_file_get_icon (button_data->file,
- CAJA_PATH_BAR_ICON_SIZE,
+ CAJA_PATH_BAR_ICON_SIZE, icon_scale,
CAJA_FILE_ICON_FLAGS_NONE);
}
@@ -1529,10 +1536,12 @@ setup_file_path_mounted_mount (GFile *location, ButtonData *button_data)
GIcon *icon;
CajaIconInfo *info;
GFile *root, *default_location;
+ gint scale;
result = FALSE;
volume_monitor = g_volume_monitor_get ();
mounts = g_volume_monitor_get_mounts (volume_monitor);
+ scale = gtk_widget_get_scale_factor (GTK_WIDGET (button_data->button));
for (l = mounts; l != NULL; l = l->next)
{
mount = l->data;
@@ -1556,7 +1565,7 @@ setup_file_path_mounted_mount (GFile *location, ButtonData *button_data)
{
icon = g_themed_icon_new (CAJA_ICON_FOLDER);
}
- info = caja_icon_info_lookup (icon, CAJA_PATH_BAR_ICON_SIZE);
+ info = caja_icon_info_lookup (icon, CAJA_PATH_BAR_ICON_SIZE, scale);
g_object_unref (icon);
button_data->custom_icon = caja_icon_info_get_pixbuf_at_size (info, CAJA_PATH_BAR_ICON_SIZE);
g_object_unref (info);
@@ -1580,7 +1589,7 @@ setup_file_path_mounted_mount (GFile *location, ButtonData *button_data)
{
icon = g_themed_icon_new (CAJA_ICON_FOLDER);
}
- info = caja_icon_info_lookup (icon, CAJA_PATH_BAR_ICON_SIZE);
+ info = caja_icon_info_lookup (icon, CAJA_PATH_BAR_ICON_SIZE, scale);
g_object_unref (icon);
button_data->custom_icon = caja_icon_info_get_pixbuf_at_size (info, CAJA_PATH_BAR_ICON_SIZE);
g_object_unref (info);
diff --git a/src/caja-places-sidebar.c b/src/caja-places-sidebar.c
index c5566c15..1a475b17 100644
--- a/src/caja-places-sidebar.c
+++ b/src/caja-places-sidebar.c
@@ -233,11 +233,12 @@ get_eject_icon (gboolean highlighted)
{
GdkPixbuf *eject;
CajaIconInfo *eject_icon_info;
- int icon_size;
+ int icon_size, icon_scale;
icon_size = caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU);
+ icon_scale = gdk_window_get_scale_factor (gdk_get_default_root_window ());
- eject_icon_info = caja_icon_info_lookup_from_name ("media-eject", icon_size);
+ eject_icon_info = caja_icon_info_lookup_from_name ("media-eject", icon_size, icon_scale);
eject = caja_icon_info_get_pixbuf_at_size (eject_icon_info, icon_size);
if (highlighted) {
@@ -342,6 +343,7 @@ add_place (CajaPlacesSidebar *sidebar,
GdkPixbuf *eject;
CajaIconInfo *icon_info;
int icon_size;
+ int icon_scale;
gboolean show_eject;
gboolean show_unmount;
gboolean show_eject_button;
@@ -349,7 +351,8 @@ add_place (CajaPlacesSidebar *sidebar,
check_heading_for_section (sidebar, section_type);
icon_size = caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU);
- icon_info = caja_icon_info_lookup (icon, icon_size);
+ icon_scale = gtk_widget_get_scale_factor (GTK_WIDGET (sidebar));
+ icon_info = caja_icon_info_lookup (icon, icon_size, icon_scale);
pixbuf = caja_icon_info_get_pixbuf_at_size (icon_info, icon_size);
g_object_unref (icon_info);
diff --git a/src/caja-property-browser.c b/src/caja-property-browser.c
index ca161803..aee03041 100644
--- a/src/caja-property-browser.c
+++ b/src/caja-property-browser.c
@@ -725,6 +725,7 @@ make_drag_image (CajaPropertyBrowser *property_browser, const char* file_name)
char *icon_name;
gboolean is_reset;
CajaIconInfo *info;
+ gint icon_scale;
if (property_browser->details->category_type == CAJA_PROPERTY_EMBLEM)
{
@@ -742,7 +743,8 @@ make_drag_image (CajaPropertyBrowser *property_browser, const char* file_name)
else
{
icon_name = caja_emblem_get_icon_name_from_keyword (file_name);
- info = caja_icon_info_lookup_from_name (icon_name, CAJA_ICON_SIZE_STANDARD);
+ icon_scale = gtk_widget_get_scale_factor (GTK_WIDGET (property_browser->details->content_table));
+ info = caja_icon_info_lookup_from_name (icon_name, CAJA_ICON_SIZE_STANDARD, icon_scale);
pixbuf = caja_icon_info_get_pixbuf_at_size (info, CAJA_ICON_SIZE_STANDARD);
g_object_unref (info);
g_free (icon_name);
@@ -1814,6 +1816,7 @@ make_properties_from_directories (CajaPropertyBrowser *property_browser)
guint num_images;
char *path;
CajaIconInfo *info;
+ gint icon_scale;
g_return_if_fail (CAJA_IS_PROPERTY_BROWSER (property_browser));
g_return_if_fail (EEL_IS_IMAGE_TABLE (property_browser->details->content_table));
@@ -1826,6 +1829,7 @@ make_properties_from_directories (CajaPropertyBrowser *property_browser)
property_browser->details->keywords = NULL;
icons = caja_emblem_list_available ();
+ icon_scale = gtk_widget_get_scale_factor (GTK_WIDGET (property_browser->details->content_table));
property_browser->details->has_local = FALSE;
l = icons;
@@ -1849,7 +1853,7 @@ make_properties_from_directories (CajaPropertyBrowser *property_browser)
g_free (object_name);
continue;
}
- info = caja_icon_info_lookup_from_name (icon_name, CAJA_ICON_SIZE_STANDARD);
+ info = caja_icon_info_lookup_from_name (icon_name, CAJA_ICON_SIZE_STANDARD, icon_scale);
object_pixbuf = caja_icon_info_get_pixbuf_at_size (info, CAJA_ICON_SIZE_STANDARD);
object_label = g_strdup (caja_icon_info_get_display_name (info));
g_object_unref (info);
diff --git a/src/caja-sidebar-title.c b/src/caja-sidebar-title.c
index 372e7ee1..3b257230 100644
--- a/src/caja-sidebar-title.c
+++ b/src/caja-sidebar-title.c
@@ -356,16 +356,18 @@ update_icon (CajaSidebarTitle *sidebar_title)
CajaIconInfo *info;
char *icon_name;
gboolean leave_pixbuf_unchanged;
+ gint icon_scale;
leave_pixbuf_unchanged = FALSE;
/* see if the current content view is specifying an icon */
icon_name = get_property_from_component (sidebar_title, "icon_name");
+ icon_scale = gtk_widget_get_scale_factor (GTK_WIDGET (sidebar_title));
pixbuf = NULL;
if (icon_name != NULL && icon_name[0] != '\0')
{
- info = caja_icon_info_lookup_from_name (icon_name, CAJA_ICON_SIZE_LARGE);
+ info = caja_icon_info_lookup_from_name (icon_name, CAJA_ICON_SIZE_LARGE, icon_scale);
pixbuf = caja_icon_info_get_pixbuf_at_size (info, CAJA_ICON_SIZE_LARGE);
g_object_unref (info);
}
@@ -376,6 +378,7 @@ update_icon (CajaSidebarTitle *sidebar_title)
pixbuf = caja_file_get_icon_pixbuf (sidebar_title->details->file,
sidebar_title->details->best_icon_size,
TRUE,
+ icon_scale,
CAJA_FILE_ICON_FLAGS_USE_THUMBNAILS |
CAJA_FILE_ICON_FLAGS_USE_MOUNT_ICON_AS_EMBLEM);
}
diff --git a/src/caja-spatial-window.c b/src/caja-spatial-window.c
index 1e043b07..a9545013 100644
--- a/src/caja-spatial-window.c
+++ b/src/caja-spatial-window.c
@@ -356,7 +356,8 @@ static CajaIconInfo *
real_get_icon (CajaWindow *window,
CajaWindowSlot *slot)
{
- return caja_file_get_icon (slot->viewed_file, 48,
+ return caja_file_get_icon (slot->viewed_file,
+ 48, gtk_widget_get_scale_factor (GTK_WIDGET (window)),
CAJA_FILE_ICON_FLAGS_IGNORE_VISITING |
CAJA_FILE_ICON_FLAGS_USE_MOUNT_ICON);
}
@@ -581,6 +582,7 @@ got_file_info_for_location_menu_callback (CajaFile *file,
pixbuf = caja_file_get_icon_pixbuf (file,
caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU),
TRUE,
+ gtk_widget_get_scale_factor (GTK_WIDGET (menu_item)),
CAJA_FILE_ICON_FLAGS_IGNORE_VISITING);
if (pixbuf != NULL)
@@ -785,6 +787,7 @@ location_button_drag_begin_callback (GtkWidget *widget,
pixbuf = caja_file_get_icon_pixbuf (slot->viewed_file,
get_dnd_icon_size (window),
FALSE,
+ gtk_widget_get_scale_factor (widget),
CAJA_FILE_ICON_FLAGS_IGNORE_VISITING | CAJA_FILE_ICON_FLAGS_FOR_DRAG_ACCEPT);
gtk_drag_set_icon_pixbuf (context, pixbuf, 0, 0);
@@ -862,6 +865,7 @@ caja_spatial_window_set_location_button (CajaSpatialWindow *window,
pixbuf = caja_file_get_icon_pixbuf (file,
caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU),
TRUE,
+ gtk_widget_get_scale_factor (window->details->location_button),
CAJA_FILE_ICON_FLAGS_IGNORE_VISITING);
if (pixbuf != NULL)
diff --git a/src/caja-window-menus.c b/src/caja-window-menus.c
index d425b6d7..890c9dac 100644
--- a/src/caja-window-menus.c
+++ b/src/caja-window-menus.c
@@ -1051,7 +1051,7 @@ add_extension_menu_items (CajaWindow *window,
g_object_get (item, "menu", &menu, NULL);
- action = caja_action_from_menu_item (item);
+ action = caja_action_from_menu_item (item, GTK_WIDGET (window));
gtk_action_group_add_action_with_accel (action_group, action, NULL);
path = g_build_path ("/", POPUP_PATH_EXTENSION_ACTIONS, subdirectory, NULL);
diff --git a/src/caja-window-toolbars.c b/src/caja-window-toolbars.c
index 0ad576fa..1611e16e 100644
--- a/src/caja-window-toolbars.c
+++ b/src/caja-window-toolbars.c
@@ -181,7 +181,7 @@ caja_navigation_window_load_extension_toolbar_items (CajaNavigationWindow *windo
{
item = CAJA_MENU_ITEM (l->data);
- action = caja_toolbar_action_from_menu_item (item);
+ action = caja_toolbar_action_from_menu_item (item, GTK_WIDGET (window));
gtk_action_group_add_action (action_group,
GTK_ACTION (action));
diff --git a/src/caja-x-content-bar.c b/src/caja-x-content-bar.c
index 0e2c916d..e38c75d8 100644
--- a/src/caja-x-content-bar.c
+++ b/src/caja-x-content-bar.c
@@ -130,10 +130,11 @@ caja_x_content_bar_set_x_content_type (CajaXContentBar *bar, const char *x_conte
if (icon != NULL)
{
GdkPixbuf *pixbuf;
- int icon_size;
+ int icon_size, icon_scale;
CajaIconInfo *icon_info;
icon_size = caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_BUTTON);
- icon_info = caja_icon_info_lookup (icon, icon_size);
+ icon_scale = gtk_widget_get_scale_factor (GTK_WIDGET (bar));
+ icon_info = caja_icon_info_lookup (icon, icon_size, icon_scale);
pixbuf = caja_icon_info_get_pixbuf_at_size (icon_info, icon_size);
image = gtk_image_new_from_pixbuf (pixbuf);
g_object_unref (pixbuf);
diff --git a/src/file-manager/fm-desktop-icon-view.c b/src/file-manager/fm-desktop-icon-view.c
index 98a0258e..8cbf0b62 100644
--- a/src/file-manager/fm-desktop-icon-view.c
+++ b/src/file-manager/fm-desktop-icon-view.c
@@ -120,11 +120,10 @@ icon_container_set_workarea (CajaIconContainer *icon_container,
left = right = top = bottom = 0;
- screen_width = WidthOfScreen (gdk_x11_screen_get_xscreen (screen));
- screen_height = HeightOfScreen (gdk_x11_screen_get_xscreen (screen));
-
scale = gdk_window_get_scale_factor (gdk_screen_get_root_window (screen));
- scale = scale ? scale : 1;
+
+ screen_width = WidthOfScreen (gdk_x11_screen_get_xscreen (screen)) / scale;
+ screen_height = HeightOfScreen (gdk_x11_screen_get_xscreen (screen)) / scale;
for (i = 0; i < n_items; i += 4)
{
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index 90697145..46a8fd42 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -4903,18 +4903,20 @@ extension_action_callback (GtkAction *action,
}
static GdkPixbuf *
-get_menu_icon (const char *icon_name)
+get_menu_icon (const char *icon_name,
+ GtkWidget *widget)
{
CajaIconInfo *info;
GdkPixbuf *pixbuf;
- int size;
+ int size, scale;
size = caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU);
+ scale = gtk_widget_get_scale_factor (widget);
if (g_path_is_absolute (icon_name)) {
- info = caja_icon_info_lookup_from_path (icon_name, size);
+ info = caja_icon_info_lookup_from_path (icon_name, size, scale);
} else {
- info = caja_icon_info_lookup_from_name (icon_name, size);
+ info = caja_icon_info_lookup_from_name (icon_name, size, scale);
}
pixbuf = caja_icon_info_get_pixbuf_nodefault_at_size (info, size);
g_object_unref (info);
@@ -4923,15 +4925,17 @@ get_menu_icon (const char *icon_name)
}
static GdkPixbuf *
-get_menu_icon_for_file (CajaFile *file)
+get_menu_icon_for_file (CajaFile *file,
+ GtkWidget *widget)
{
CajaIconInfo *info;
GdkPixbuf *pixbuf;
- int size;
+ int size, scale;
size = caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU);
+ scale = gtk_widget_get_scale_factor (widget);
- info = caja_file_get_icon (file, size, 0);
+ info = caja_file_get_icon (file, size, scale, 0);
pixbuf = caja_icon_info_get_pixbuf_nodefault_at_size (info, size);
g_object_unref (info);
@@ -4962,7 +4966,7 @@ add_extension_action_for_files (FMDirectoryView *view,
icon);
if (icon != NULL) {
- pixbuf = get_menu_icon (icon);
+ pixbuf = get_menu_icon (icon, GTK_WIDGET (view));
if (pixbuf != NULL) {
g_object_set_data_full (G_OBJECT (action), "menu-icon",
pixbuf,
@@ -5429,7 +5433,7 @@ add_script_to_scripts_menus (FMDirectoryView *directory_view,
tip,
NULL);
- pixbuf = get_menu_icon_for_file (file);
+ pixbuf = get_menu_icon_for_file (file, GTK_WIDGET (directory_view));
if (pixbuf != NULL) {
g_object_set_data_full (G_OBJECT (action), "menu-icon",
pixbuf,
@@ -5493,7 +5497,7 @@ add_submenu_to_directory_menus (FMDirectoryView *directory_view,
ui_manager = caja_window_info_get_ui_manager (directory_view->details->window);
uri = caja_file_get_uri (file);
name = caja_file_get_display_name (file);
- pixbuf = get_menu_icon_for_file (file);
+ pixbuf = get_menu_icon_for_file (file, GTK_WIDGET (directory_view));
add_submenu (ui_manager, action_group, merge_id, menu_path, uri, name, pixbuf, TRUE);
add_submenu (ui_manager, action_group, merge_id, popup_path, uri, name, pixbuf, FALSE);
add_submenu (ui_manager, action_group, merge_id, popup_bg_path, uri, name, pixbuf, FALSE);
@@ -5680,7 +5684,7 @@ add_template_to_templates_menus (FMDirectoryView *directory_view,
tip,
NULL);
- pixbuf = get_menu_icon_for_file (file);
+ pixbuf = get_menu_icon_for_file (file, GTK_WIDGET (directory_view));
if (pixbuf != NULL) {
g_object_set_data_full (G_OBJECT (action), "menu-icon",
pixbuf,
@@ -6978,6 +6982,7 @@ action_connect_to_server_link_callback (GtkAction *action,
GtkWidget *entry;
GtkWidget *box;
char *title;
+ gint scale;
view = FM_DIRECTORY_VIEW (data);
@@ -6989,9 +6994,10 @@ action_connect_to_server_link_callback (GtkAction *action,
}
file = CAJA_FILE (selection->data);
+ scale = gtk_widget_get_scale_factor (GTK_WIDGET (view));
uri = caja_file_get_activation_uri (file);
- icon = caja_file_get_icon (file, CAJA_ICON_SIZE_STANDARD, 0);
+ icon = caja_file_get_icon (file, CAJA_ICON_SIZE_STANDARD, scale, 0);
icon_name = caja_icon_info_get_used_name (icon);
name = caja_file_get_display_name (file);
@@ -7583,7 +7589,7 @@ connect_proxy (FMDirectoryView *view,
if (strcmp (gtk_action_get_name (action), FM_ACTION_NEW_EMPTY_FILE) == 0 &&
GTK_IS_IMAGE_MENU_ITEM (proxy)) {
- pixbuf = get_menu_icon ("text-x-generic");
+ pixbuf = get_menu_icon ("text-x-generic", GTK_WIDGET (view));
if (pixbuf != NULL) {
image = gtk_image_new_from_pixbuf (pixbuf);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (proxy), image);
diff --git a/src/file-manager/fm-icon-container.c b/src/file-manager/fm-icon-container.c
index be3acee2..f744d65a 100644
--- a/src/file-manager/fm-icon-container.c
+++ b/src/file-manager/fm-icon-container.c
@@ -65,6 +65,7 @@ fm_icon_container_get_icon_images (CajaIconContainer *container,
gboolean use_embedding;
CajaFileIconFlags flags;
guint emblem_size;
+ gint scale;
file = (CajaFile *) data;
@@ -119,7 +120,9 @@ fm_icon_container_get_icon_images (CajaIconContainer *container,
flags |= CAJA_FILE_ICON_FLAGS_FOR_DRAG_ACCEPT;
}
- return caja_file_get_icon (file, size, flags);
+ scale = gtk_widget_get_scale_factor (GTK_WIDGET (icon_view));
+
+ return caja_file_get_icon (file, size, scale, flags);
}
static char *
diff --git a/src/file-manager/fm-list-model.c b/src/file-manager/fm-list-model.c
index 315fef70..715303b5 100644
--- a/src/file-manager/fm-list-model.c
+++ b/src/file-manager/fm-list-model.c
@@ -34,10 +34,12 @@
#include <glib/gi18n.h>
#include <libcaja-private/caja-dnd.h>
#include <glib.h>
+#include <cairo-gobject.h>
enum
{
SUBDIRECTORY_UNLOADED,
+ GET_ICON_SCALE,
LAST_SIGNAL
};
@@ -163,7 +165,7 @@ fm_list_model_get_column_type (GtkTreeModel *tree_model, int index)
case FM_LIST_MODEL_LARGE_ICON_COLUMN:
case FM_LIST_MODEL_LARGER_ICON_COLUMN:
case FM_LIST_MODEL_LARGEST_ICON_COLUMN:
- return GDK_TYPE_PIXBUF;
+ return CAIRO_GOBJECT_TYPE_SURFACE;
case FM_LIST_MODEL_FILE_NAME_IS_EDITABLE_COLUMN:
return G_TYPE_BOOLEAN;
default:
@@ -259,6 +261,21 @@ fm_list_model_get_path (GtkTreeModel *tree_model, GtkTreeIter *iter)
return path;
}
+static gint
+fm_list_model_get_icon_scale (FMListModel *model)
+{
+ gint retval = -1;
+
+ g_signal_emit (model, list_model_signals[GET_ICON_SCALE], 0,
+ &retval);
+
+ if (retval == -1) {
+ retval = gdk_screen_get_monitor_scale_factor (gdk_screen_get_default (), 0);
+ }
+
+ return retval;
+}
+
static void
fm_list_model_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, int column, GValue *value)
{
@@ -271,12 +288,13 @@ fm_list_model_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, int column
CajaIconInfo *icon_info;
GEmblem *emblem;
GList *emblem_icons, *l;
- int icon_size;
+ int icon_size, icon_scale;
CajaZoomLevel zoom_level;
CajaFile *parent_file;
char *emblems_to_ignore[3];
int i;
CajaFileIconFlags flags;
+ cairo_surface_t *surface;
model = (FMListModel *)tree_model;
@@ -305,12 +323,13 @@ fm_list_model_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, int column
case FM_LIST_MODEL_LARGE_ICON_COLUMN:
case FM_LIST_MODEL_LARGER_ICON_COLUMN:
case FM_LIST_MODEL_LARGEST_ICON_COLUMN:
- g_value_init (value, GDK_TYPE_PIXBUF);
+ g_value_init (value, CAIRO_GOBJECT_TYPE_SURFACE);
if (file != NULL)
{
zoom_level = fm_list_model_get_zoom_level_from_column_id (column);
icon_size = caja_get_icon_size_for_zoom_level (zoom_level);
+ icon_scale = fm_list_model_get_icon_scale (model);
flags = CAJA_FILE_ICON_FLAGS_USE_THUMBNAILS |
CAJA_FILE_ICON_FLAGS_FORCE_THUMBNAIL_SIZE |
@@ -376,7 +395,7 @@ fm_list_model_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, int column
gicon = emblemed_icon;
}
- icon_info = caja_icon_info_lookup (gicon, icon_size);
+ icon_info = caja_icon_info_lookup (gicon, icon_size, icon_scale);
icon = caja_icon_info_get_pixbuf_at_size (icon_info, icon_size);
g_object_unref (icon_info);
@@ -395,7 +414,8 @@ fm_list_model_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, int column
}
}
- g_value_set_object (value, icon);
+ surface = gdk_cairo_surface_create_from_pixbuf (icon, icon_scale, NULL);
+ g_value_take_boxed (value, surface);
g_object_unref (icon);
}
break;
@@ -1675,6 +1695,14 @@ fm_list_model_class_init (FMListModelClass *klass)
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
CAJA_TYPE_DIRECTORY);
+
+ list_model_signals[GET_ICON_SCALE] =
+ g_signal_new ("get-icon-scale",
+ FM_TYPE_LIST_MODEL,
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL,
+ NULL,
+ G_TYPE_INT, 0);
}
static void
diff --git a/src/file-manager/fm-list-view.c b/src/file-manager/fm-list-view.c
index d2353e7a..b68b6a31 100644
--- a/src/file-manager/fm-list-view.c
+++ b/src/file-manager/fm-list-view.c
@@ -1638,6 +1638,13 @@ focus_in_event_callback (GtkWidget *widget, GdkEventFocus *event, gpointer user_
return FALSE;
}
+static gint
+get_icon_scale_callback (FMListModel *model,
+ FMListView *view)
+{
+ return gtk_widget_get_scale_factor (GTK_WIDGET (view->details->tree_view));
+}
+
static void
create_and_set_up_tree_view (FMListView *view)
{
@@ -1727,6 +1734,9 @@ create_and_set_up_tree_view (FMListView *view)
g_signal_connect_object (view->details->model, "subdirectory_unloaded",
G_CALLBACK (subdirectory_unloaded_callback), view, 0);
+ g_signal_connect_object (view->details->model, "get-icon-scale",
+ G_CALLBACK (get_icon_scale_callback), view, 0);
+
gtk_tree_selection_set_mode (gtk_tree_view_get_selection (view->details->tree_view), GTK_SELECTION_MULTIPLE);
caja_columns = caja_get_all_columns ();
@@ -1782,7 +1792,7 @@ create_and_set_up_tree_view (FMListView *view)
gtk_tree_view_column_pack_start (view->details->file_name_column, cell, FALSE);
gtk_tree_view_column_set_attributes (view->details->file_name_column,
cell,
- "pixbuf", FM_LIST_MODEL_SMALLEST_ICON_COLUMN,
+ "surface", FM_LIST_MODEL_SMALLEST_ICON_COLUMN,
NULL);
cell = gtk_cell_renderer_text_new ();
@@ -2779,7 +2789,7 @@ fm_list_view_set_zoom_level (FMListView *view,
column = fm_list_model_get_column_id_from_zoom_level (new_level);
gtk_tree_view_column_set_attributes (view->details->file_name_column,
GTK_CELL_RENDERER (view->details->pixbuf_cell),
- "pixbuf", column,
+ "surface", column,
NULL);
/* Scale text. */
diff --git a/src/file-manager/fm-properties-window.c b/src/file-manager/fm-properties-window.c
index 56af2094..6de9f98a 100644
--- a/src/file-manager/fm-properties-window.c
+++ b/src/file-manager/fm-properties-window.c
@@ -363,17 +363,24 @@ get_image_for_properties_window (FMPropertiesWindow *window,
{
CajaIconInfo *icon, *new_icon;
GList *l;
+ gint icon_scale;
icon = NULL;
+ icon_scale = gtk_widget_get_scale_factor (GTK_WIDGET (window->details->notebook));
+
for (l = window->details->original_files; l != NULL; l = l->next) {
CajaFile *file;
file = CAJA_FILE (l->data);
if (!icon) {
- icon = caja_file_get_icon (file, CAJA_ICON_SIZE_STANDARD, CAJA_FILE_ICON_FLAGS_USE_THUMBNAILS | CAJA_FILE_ICON_FLAGS_IGNORE_VISITING);
+ icon = caja_file_get_icon (file, CAJA_ICON_SIZE_STANDARD, icon_scale,
+ CAJA_FILE_ICON_FLAGS_USE_THUMBNAILS |
+ CAJA_FILE_ICON_FLAGS_IGNORE_VISITING);
} else {
- new_icon = caja_file_get_icon (file, CAJA_ICON_SIZE_STANDARD, CAJA_FILE_ICON_FLAGS_USE_THUMBNAILS | CAJA_FILE_ICON_FLAGS_IGNORE_VISITING);
+ new_icon = caja_file_get_icon (file, CAJA_ICON_SIZE_STANDARD, icon_scale,
+ CAJA_FILE_ICON_FLAGS_USE_THUMBNAILS |
+ CAJA_FILE_ICON_FLAGS_IGNORE_VISITING);
if (!new_icon || new_icon != icon) {
g_object_unref (icon);
g_object_unref (new_icon);
@@ -385,7 +392,9 @@ get_image_for_properties_window (FMPropertiesWindow *window,
}
if (!icon) {
- icon = caja_icon_info_lookup_from_name ("text-x-generic", CAJA_ICON_SIZE_STANDARD);
+ icon = caja_icon_info_lookup_from_name ("text-x-generic",
+ CAJA_ICON_SIZE_STANDARD,
+ icon_scale);
}
if (icon_name != NULL) {
@@ -3412,6 +3421,7 @@ create_emblems_page (FMPropertiesWindow *window)
char *label;
GList *icons, *l;
CajaIconInfo *info;
+ gint scale;
/* The emblems wrapped table */
scroller = eel_scrolled_wrap_table_new (TRUE, GTK_SHADOW_NONE, &emblems_table);
@@ -3427,6 +3437,7 @@ create_emblems_page (FMPropertiesWindow *window)
scroller, gtk_label_new (_("Emblems")));
icons = caja_emblem_list_available ();
+ scale = gtk_widget_get_scale_factor (scroller);
window->details->initial_emblems = get_initial_emblems (window->details->original_files);
@@ -3439,7 +3450,7 @@ create_emblems_page (FMPropertiesWindow *window)
continue;
}
- info = caja_icon_info_lookup_from_name (emblem_name, CAJA_ICON_SIZE_SMALL);
+ info = caja_icon_info_lookup_from_name (emblem_name, CAJA_ICON_SIZE_SMALL, scale);
pixbuf = caja_icon_info_get_pixbuf_nodefault_at_size (info, CAJA_ICON_SIZE_SMALL);
if (pixbuf == NULL) {
@@ -3454,8 +3465,8 @@ create_emblems_page (FMPropertiesWindow *window)
}
button = eel_labeled_image_check_button_new (label, pixbuf);
- eel_labeled_image_set_fixed_image_height (EEL_LABELED_IMAGE (gtk_bin_get_child (GTK_BIN (button))), STANDARD_EMBLEM_HEIGHT);
- eel_labeled_image_set_spacing (EEL_LABELED_IMAGE (gtk_bin_get_child (GTK_BIN (button))), EMBLEM_LABEL_SPACING);
+ eel_labeled_image_set_fixed_image_height (EEL_LABELED_IMAGE (gtk_bin_get_child (GTK_BIN (button))), STANDARD_EMBLEM_HEIGHT * scale);
+ eel_labeled_image_set_spacing (EEL_LABELED_IMAGE (gtk_bin_get_child (GTK_BIN (button))), EMBLEM_LABEL_SPACING * scale);
g_free (label);
g_object_unref (pixbuf);
diff --git a/src/file-manager/fm-tree-model.c b/src/file-manager/fm-tree-model.c
index cf400375..e3bcfd3c 100644
--- a/src/file-manager/fm-tree-model.c
+++ b/src/file-manager/fm-tree-model.c
@@ -258,11 +258,12 @@ get_menu_icon (GIcon *icon)
{
CajaIconInfo *info;
GdkPixbuf *pixbuf;
- int size;
+ int size, scale;
size = caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU);
+ scale = gdk_window_get_scale_factor (gdk_get_default_root_window ());
- info = caja_icon_info_lookup (icon, size);
+ info = caja_icon_info_lookup (icon, size, scale);
pixbuf = caja_icon_info_get_pixbuf_nodefault_at_size (info, size);
g_object_unref (info);
@@ -279,13 +280,14 @@ get_menu_icon_for_file (TreeNode *node,
GEmblem *emblem;
GdkPixbuf *pixbuf, *retval;
gboolean highlight;
- int size;
+ int size, scale;
FMTreeModel *model;
GList *emblem_icons, *l;
char *emblems_to_ignore[3];
int i;
size = caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU);
+ scale = gdk_window_get_scale_factor (gdk_get_default_root_window ());
gicon = caja_file_get_gicon (file, flags);
@@ -321,7 +323,7 @@ get_menu_icon_for_file (TreeNode *node,
g_list_free_full (emblem_icons, g_object_unref);
- info = caja_icon_info_lookup (gicon, size);
+ info = caja_icon_info_lookup (gicon, size, scale);
retval = caja_icon_info_get_pixbuf_nodefault_at_size (info, size);
model = node->root->model;