[mutter/wip/fmuellner/missing-image-missing] window: Handle broken icon themes more gracefully



commit 9622733140c90a472f06362fbbc970513c508735
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Feb 27 22:11:46 2019 +0100

    window: Handle broken icon themes more gracefully
    
    We assert that the icons used as default window icons are loaded correctly,
    but currently this can fail simply because of an incomplete icon theme. After
    all, "image-missing" was only added to the icon-naming spec in 2005 🙄
    
    Handle this case more gracefully by falling back to a completely
    transparent "icon".
    
    https://bugzilla.gnome.org/show_bug.cgi?id=720583
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/462

 src/core/window.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/core/window.c b/src/core/window.c
index c112c7d59..9712e6d87 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -5357,7 +5357,11 @@ load_default_window_icon (int size)
     icon_name = "image-missing";
 
   pixbuf = gtk_icon_theme_load_icon (theme, icon_name, size, 0, NULL);
-  return gdk_cairo_surface_create_from_pixbuf (pixbuf, 1, NULL);
+
+  if (pixbuf != NULL)
+    return gdk_cairo_surface_create_from_pixbuf (pixbuf, 1, NULL);
+
+  return cairo_image_surface_create (CAIRO_FORMAT_ARGB32, size, size);
 }
 
 static cairo_surface_t *


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