diff options
author | Viktor Odintsev <zakhams@gmail.com> | 2017-07-02 16:50:08 +0300 |
---|---|---|
committer | Viktor Odintsev <ninetls@xfce.org> | 2017-07-02 16:50:08 +0300 |
commit | 5b10f726c28c68d0ebc972754b08f5ea199d36b1 (patch) | |
tree | c2196ccea7356ce71ce7d96d811ef50f71094e93 | |
parent | 9d5ac6a4f964ce1b4a12b402486f81c77cd3c5e1 (diff) | |
download | xfwm4-5b10f726c28c68d0ebc972754b08f5ea199d36b1.tar.gz |
Load default icon from icon theme
-rw-r--r-- | icons/48x48/Makefile.am | 3 | ||||
-rw-r--r-- | icons/48x48/xfwm4-default.png | bin | 0 -> 667 bytes | |||
-rw-r--r-- | icons/scalable/Makefile.am | 3 | ||||
-rw-r--r-- | icons/scalable/xfwm4-default.svg (renamed from src/default_icon.svg) | 0 | ||||
-rw-r--r-- | src/Makefile.am | 14 | ||||
-rw-r--r-- | src/default_icon.png | bin | 843 -> 0 bytes | |||
-rw-r--r-- | src/icons.c | 36 |
7 files changed, 21 insertions, 35 deletions
diff --git a/icons/48x48/Makefile.am b/icons/48x48/Makefile.am index d420d4872..8d4c1c760 100644 --- a/icons/48x48/Makefile.am +++ b/icons/48x48/Makefile.am @@ -2,6 +2,7 @@ iconsdir = $(datadir)/icons/hicolor/48x48/apps icons_DATA = \ wmtweaks.png \ xfce4-workspaces.png \ - xfwm4.png + xfwm4.png \ + xfwm4-default.png EXTRA_DIST = $(icons_DATA) diff --git a/icons/48x48/xfwm4-default.png b/icons/48x48/xfwm4-default.png Binary files differnew file mode 100644 index 000000000..6bb8d0a28 --- /dev/null +++ b/icons/48x48/xfwm4-default.png diff --git a/icons/scalable/Makefile.am b/icons/scalable/Makefile.am index 59b92eed3..9c6acf9a7 100644 --- a/icons/scalable/Makefile.am +++ b/icons/scalable/Makefile.am @@ -2,7 +2,8 @@ appiconsdir = $(datadir)/icons/hicolor/scalable/apps appicons_DATA = \ wmtweaks.svg \ xfce4-workspaces.svg \ - xfwm4.svg + xfwm4.svg \ + xfwm4-default.svg actionsiconsdir = $(datadir)/icons/hicolor/scalable/actions actionsicons_DATA = \ diff --git a/src/default_icon.svg b/icons/scalable/xfwm4-default.svg index 53ed5d75e..53ed5d75e 100644 --- a/src/default_icon.svg +++ b/icons/scalable/xfwm4-default.svg diff --git a/src/Makefile.am b/src/Makefile.am index 018cb36ec..8a6309e62 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -21,7 +21,6 @@ xfwm4_SOURCES = \ hints.h \ icons.c \ icons.h \ - inline-default-icon.h \ keyboard.c \ keyboard.h \ main.c \ @@ -116,17 +115,4 @@ AM_CPPFLAGS = \ $(PLATFORM_CPPFLAGS) EXTRA_DIST = \ - default_icon.png \ - default_icon.svg \ gen-color-table.pl - -if MAINTAINER_MODE - -BUILT_SOURCES = \ - inline-default-icon.h - -inline-default-icon.h: $(srcdir)/default_icon.png - $(AM_V_GEN) gdk-pixbuf-csource --raw --build-list \ - default_icon_data $(srcdir)/default_icon.png > inline-default-icon.h - -endif diff --git a/src/default_icon.png b/src/default_icon.png Binary files differdeleted file mode 100644 index 9b74d8dbc..000000000 --- a/src/default_icon.png +++ /dev/null diff --git a/src/icons.c b/src/icons.c index 1066f1e1f..1238d91b1 100644 --- a/src/icons.c +++ b/src/icons.c @@ -33,7 +33,6 @@ #include <gdk-pixbuf/gdk-pixbuf.h> #include <libxfce4util/libxfce4util.h> -#include "inline-default-icon.h" #include "icons.h" #include "display.h" #include "screen.h" @@ -70,34 +69,33 @@ downsize_ratio (guint *width, guint *height, guint dest_w, guint dest_h) * create a GdkPixbuf from inline data and scale it to a given size */ static GdkPixbuf * -inline_icon_at_size (const guint8 *data, guint width, guint height) +default_icon_at_size (GdkScreen *screen, guint width, guint height) { + GtkIconTheme *icon_theme; GdkPixbuf *base; + GdkPixbuf *scaled; - base = gdk_pixbuf_new_from_inline (-1, data, FALSE, NULL); + icon_theme = gtk_icon_theme_get_for_screen (screen); - g_return_val_if_fail (base, NULL); + g_return_val_if_fail (icon_theme != NULL, NULL); - if ((width <= 0 || height <= 0) || - ((guint) gdk_pixbuf_get_width (base) == width && - (guint) gdk_pixbuf_get_height (base) == height)) + if (width <= 0 || height <= 0) { - return base; + width = 160; + height = 160; } - else - { - GdkPixbuf *scaled; - guint w, h; - w = gdk_pixbuf_get_width (base); - h = gdk_pixbuf_get_height (base); - downsize_ratio (&w, &h, width, height); - scaled = gdk_pixbuf_scale_simple (base, w, h, GDK_INTERP_BILINEAR); + base = gtk_icon_theme_load_icon (icon_theme, "xfwm4-default", + MAX (width, height), 0, NULL); + if (base != NULL && width != height) + { + scaled = gdk_pixbuf_scale_simple (base, width, height, GDK_INTERP_BILINEAR); g_object_unref (G_OBJECT (base)); - return scaled; } + + return base; } @@ -573,7 +571,7 @@ getAppIcon (ScreenInfo *screen_info, Window window, guint width, guint height) } } - return inline_icon_at_size (default_icon_data, width, height); + return default_icon_at_size (screen_info->gscr, width, height); } GdkPixbuf * @@ -606,7 +604,7 @@ getClientIcon (Client *c, guint width, guint height) } else { - app_content = inline_icon_at_size (default_icon_data, width, height); + app_content = default_icon_at_size (screen_info->gscr, width, height); } app_icon_width = (guint) gdk_pixbuf_get_width (app_content); |