user-chooser: try to find fallback icon more aggressively
Some themes won't give you the nearest icon at the requested size, so first look up the available sizes and choose the closest available one ourselves. If it fails, just fallback to an empty square of the right size.
This commit is contained in:
parent
3edb45eede
commit
985a2890bc
10
gdm.spec
10
gdm.spec
@ -15,7 +15,7 @@
|
||||
Summary: The GNOME Display Manager
|
||||
Name: gdm
|
||||
Version: 2.91.4
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Epoch: 1
|
||||
License: GPLv2+
|
||||
Group: User Interface/X
|
||||
@ -87,7 +87,9 @@ BuildRequires: dbus-glib-devel
|
||||
Provides: service(graphical-login) = %{name}
|
||||
|
||||
Requires: audit-libs >= %{libauditver}
|
||||
|
||||
Patch2: plymouth.patch
|
||||
Patch3: icon-fix.patch
|
||||
|
||||
Patch96: gdm-multistack.patch
|
||||
# Fedora-specific
|
||||
@ -131,6 +133,7 @@ The GDM fingerprint plugin provides functionality necessary to use a fingerprint
|
||||
%prep
|
||||
%setup -q
|
||||
%patch2 -p1 -b .plymouth
|
||||
%patch3 -p1 -b .icon-fix
|
||||
%patch96 -p1 -b .multistack
|
||||
%patch97 -p1 -b .bubble-location
|
||||
%patch98 -p1 -b .tray-padding
|
||||
@ -372,6 +375,11 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor >&/dev/ull || :
|
||||
%{_libdir}/gdm/simple-greeter/plugins/fingerprint.so
|
||||
|
||||
%changelog
|
||||
* Wed Jan 19 2011 Ray Strode <rstrode@redhat.com> 2.91.4-2
|
||||
- Be more aggresive about loading icons
|
||||
(right now we fail, which combined with fatal criticals
|
||||
gives us crashes)
|
||||
|
||||
* Fri Dec 17 2010 Ray Strode <rstrode@redhat.com> 2.91.4-1
|
||||
- Update to 2.91.4
|
||||
|
||||
|
80
icon-fix.patch
Normal file
80
icon-fix.patch
Normal file
@ -0,0 +1,80 @@
|
||||
From 951e72405640b1682072a846118077e927affaaf Mon Sep 17 00:00:00 2001
|
||||
From: Ray Strode <rstrode@redhat.com>
|
||||
Date: Wed, 19 Jan 2011 12:06:42 -0500
|
||||
Subject: [PATCH] user-chooser: try to find fallback icon more aggressively
|
||||
|
||||
Some themes won't give you the nearest icon at the requested size,
|
||||
so first look up the available sizes and choose the closest
|
||||
available one ourselves.
|
||||
|
||||
If it fails, just fallback to an empty square of the right size.
|
||||
---
|
||||
gui/simple-greeter/gdm-user-chooser-widget.c | 35 ++++++++++++++++++++++++-
|
||||
1 files changed, 33 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gui/simple-greeter/gdm-user-chooser-widget.c b/gui/simple-greeter/gdm-user-chooser-widget.c
|
||||
index 8df255f..6d03c38 100644
|
||||
--- a/gui/simple-greeter/gdm-user-chooser-widget.c
|
||||
+++ b/gui/simple-greeter/gdm-user-chooser-widget.c
|
||||
@@ -833,6 +833,9 @@ get_pixbuf_from_icon_names (GdmUserChooserWidget *widget,
|
||||
int size;
|
||||
const char *icon_name;
|
||||
va_list argument_list;
|
||||
+ gint *sizes;
|
||||
+ gint candidate_size;
|
||||
+ int i;
|
||||
|
||||
array = g_ptr_array_new ();
|
||||
|
||||
@@ -849,9 +852,29 @@ get_pixbuf_from_icon_names (GdmUserChooserWidget *widget,
|
||||
|
||||
size = get_icon_height_for_widget (GTK_WIDGET (widget));
|
||||
|
||||
+ sizes = gtk_icon_theme_get_icon_sizes (widget->priv->icon_theme, first_name);
|
||||
+
|
||||
+ candidate_size = 0;
|
||||
+ for (i = 0; sizes[i] != 0; i++) {
|
||||
+
|
||||
+ /* scalable */
|
||||
+ if (sizes[i] == -1) {
|
||||
+ candidate_size = sizes[i];
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (ABS (size - sizes[i]) < ABS (size - candidate_size)) {
|
||||
+ candidate_size = sizes[i];
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (candidate_size == 0) {
|
||||
+ candidate_size = size;
|
||||
+ }
|
||||
+
|
||||
icon_info = gtk_icon_theme_choose_icon (widget->priv->icon_theme,
|
||||
(const char **) array->pdata,
|
||||
- size,
|
||||
+ candidate_size,
|
||||
GTK_ICON_LOOKUP_GENERIC_FALLBACK);
|
||||
g_ptr_array_free (array, FALSE);
|
||||
|
||||
@@ -868,8 +891,16 @@ get_pixbuf_from_icon_names (GdmUserChooserWidget *widget,
|
||||
g_error_free (error);
|
||||
}
|
||||
} else {
|
||||
+ GdkPixbuf *scaled_pixbuf;
|
||||
+
|
||||
+ guchar pixel = 0x00000000;
|
||||
+
|
||||
g_warning ("Could not find icon '%s' or fallbacks", first_name);
|
||||
- pixbuf = NULL;
|
||||
+ pixbuf = gdk_pixbuf_new_from_data (&pixel, GDK_COLORSPACE_RGB,
|
||||
+ TRUE, 8, 1, 1, 1, NULL, NULL);
|
||||
+ scaled_pixbuf = gdk_pixbuf_scale_simple (pixbuf, size, size, GDK_INTERP_NEAREST);
|
||||
+ g_object_unref (pixbuf);
|
||||
+ scaled_pixbuf = pixbuf;
|
||||
}
|
||||
|
||||
return pixbuf;
|
||||
--
|
||||
1.7.3.4
|
||||
|
Loading…
Reference in New Issue
Block a user