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

[Git][debian-mate-team/mate-control-center][master] debian/patches: Add 0001_uniform_icon_size.patch. Enforce uniform size on icons.



Title: GitLab

Martin Wimpress pushed to branch master at Debian and Ubuntu MATE Packaging Team / mate-control-center

Commits:

2 changed files:

Changes:

  • debian/patches/0001_uniform_icon_size.patch
    1
    +Author: Victor Kareh <vkareh@redhat.com>
    
    2
    +Description: Force uniform size on icons
    
    3
    +
    
    4
    +diff --git a/libslab/mate-utils.c b/libslab/mate-utils.c
    
    5
    +index 8dafe11a..e42d02c4 100644
    
    6
    +--- a/libslab/mate-utils.c
    
    7
    ++++ b/libslab/mate-utils.c
    
    8
    +@@ -3,11 +3,12 @@
    
    9
    + #include <string.h>
    
    10
    + 
    
    11
    + gboolean
    
    12
    +-load_image_by_id (GtkImage * image, GtkIconSize size, const gchar * image_id)
    
    13
    ++load_image_by_id (GtkImage *image, GtkIconSize size, const gchar *image_id)
    
    14
    + {
    
    15
    +-	GdkPixbuf *pixbuf;
    
    16
    ++	cairo_surface_t *surface;
    
    17
    + 	gint width;
    
    18
    + 	gint height;
    
    19
    ++	gint scale_factor;
    
    20
    + 
    
    21
    + 	GtkIconTheme *icon_theme;
    
    22
    + 
    
    23
    +@@ -19,20 +20,25 @@ load_image_by_id (GtkImage * image, GtkIconSize size, const gchar * image_id)
    
    24
    + 		return FALSE;
    
    25
    + 
    
    26
    + 	id = g_strdup (image_id);
    
    27
    ++	scale_factor = gtk_widget_get_scale_factor (GTK_WIDGET (image));
    
    28
    + 
    
    29
    + 	gtk_icon_size_lookup (size, &width, &height);
    
    30
    + 	gtk_image_set_pixel_size (image, width);
    
    31
    + 
    
    32
    + 	if (g_path_is_absolute (id))
    
    33
    + 	{
    
    34
    +-		pixbuf = gdk_pixbuf_new_from_file_at_size (id, width, height, NULL);
    
    35
    ++		GdkPixbuf *pixbuf;
    
    36
    ++
    
    37
    ++		pixbuf = gdk_pixbuf_new_from_file_at_size (id, width * scale_factor, height * scale_factor, NULL);
    
    38
    + 
    
    39
    + 		icon_exists = (pixbuf != NULL);
    
    40
    + 
    
    41
    + 		if (icon_exists)
    
    42
    + 		{
    
    43
    +-			gtk_image_set_from_pixbuf (image, pixbuf);
    
    44
    ++			surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, scale_factor, NULL);
    
    45
    ++			gtk_image_set_from_surface (image, surface);
    
    46
    + 
    
    47
    ++			cairo_surface_destroy (surface);
    
    48
    + 			g_object_unref (pixbuf);
    
    49
    + 		}
    
    50
    + 		else
    
    51
    +@@ -55,11 +61,15 @@ load_image_by_id (GtkImage * image, GtkIconSize size, const gchar * image_id)
    
    52
    + 		else
    
    53
    + 			icon_theme = gtk_icon_theme_get_default ();
    
    54
    + 
    
    55
    +-		pixbuf = gtk_icon_theme_load_icon (icon_theme, id, width, 0, NULL);
    
    56
    +-		icon_exists = (pixbuf != NULL);
    
    57
    ++		surface = gtk_icon_theme_load_surface (icon_theme, id,
    
    58
    ++		                                       width, scale_factor,
    
    59
    ++		                                       NULL,
    
    60
    ++		                                       GTK_ICON_LOOKUP_FORCE_SIZE,
    
    61
    ++		                                       NULL);
    
    62
    ++		icon_exists = (surface != NULL);
    
    63
    + 		if (icon_exists) {
    
    64
    +-			gtk_image_set_from_pixbuf (image, pixbuf);
    
    65
    +-			g_object_unref (pixbuf);
    
    66
    ++			gtk_image_set_from_surface (image, surface);
    
    67
    ++			cairo_surface_destroy (surface);
    
    68
    + 		}
    
    69
    + 		else
    
    70
    + 			gtk_image_set_from_icon_name (image, "image-missing", size);

  • debian/patches/series
    1
    +0001_uniform_icon_size.patch


  • Reply to: