Last active
December 11, 2015 03:49
-
-
Save dtzWill/4540567 to your computer and use it in GitHub Desktop.
Kludge to force nm-applet icon size to avoid annoying resize flicker on redraw. Applies to 0.9.6.4, YMMV, etc. Adjust height/width as desired. I chose '20' to match the height of my top wibox bar in awesome-wm.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From d156ce54795695c5308f49fb5e741b5d52ef29a7 Mon Sep 17 00:00:00 2001 | |
From: Will Dietz <w@wdtz.org> | |
Date: Tue, 15 Jan 2013 11:30:50 -0600 | |
Subject: [PATCH] Kludge to force applet icon size to avoid annoying resize | |
flicker. | |
--- | |
src/applet.c | 9 ++++++--- | |
1 file changed, 6 insertions(+), 3 deletions(-) | |
diff --git a/src/applet.c b/src/applet.c | |
index 6770529..c5a82a8 100644 | |
--- a/src/applet.c | |
+++ b/src/applet.c | |
@@ -2152,6 +2152,7 @@ static void | |
foo_set_icon (NMApplet *applet, GdkPixbuf *pixbuf, guint32 layer) | |
{ | |
int i; | |
+ const int width = 20, height = 20; | |
if (layer > ICON_LAYER_MAX) { | |
g_warning ("Tried to icon to invalid layer %d", layer); | |
@@ -2172,9 +2173,11 @@ foo_set_icon (NMApplet *applet, GdkPixbuf *pixbuf, guint32 layer) | |
if (!applet->icon_layers[0]) { | |
nma_icon_check_and_load ("nm-no-connection", &applet->no_connection_icon, applet); | |
- pixbuf = g_object_ref (applet->no_connection_icon); | |
+ pixbuf = gdk_pixbuf_scale_simple(applet->no_connection_icon, width, height, | |
+ GDK_INTERP_BILINEAR); | |
} else { | |
- pixbuf = gdk_pixbuf_copy (applet->icon_layers[0]); | |
+ pixbuf = gdk_pixbuf_scale_simple(applet->icon_layers[0], width, height, | |
+ GDK_INTERP_BILINEAR); | |
for (i = ICON_LAYER_LINK + 1; i <= ICON_LAYER_MAX; i++) { | |
GdkPixbuf *top = applet->icon_layers[i]; | |
@@ -2185,7 +2188,7 @@ foo_set_icon (NMApplet *applet, GdkPixbuf *pixbuf, guint32 layer) | |
gdk_pixbuf_composite (top, pixbuf, 0, 0, gdk_pixbuf_get_width (top), | |
gdk_pixbuf_get_height (top), | |
0, 0, 1.0, 1.0, | |
- GDK_INTERP_NEAREST, 255); | |
+ GDK_INTERP_BILINEAR, 255); | |
} | |
} | |
-- | |
1.8.1.1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment