diff options
author | osch <oliver at luced de> | 2019-04-12 23:48:52 +0200 |
---|---|---|
committer | lukefromdc <[email protected]> | 2019-04-23 18:35:39 +0000 |
commit | 54d6dd4cd27c97c3560c3ff2eb66fcfbbe5a51c0 (patch) | |
tree | 7ea59fcfd5b6b26c409904d34083d428c2f447a4 /src | |
parent | 5e2f54dbf2417c3b5f8b1614010565a0a500382a (diff) | |
download | marco-54d6dd4cd27c97c3560c3ff2eb66fcfbbe5a51c0.tar.bz2 marco-54d6dd4cd27c97c3560c3ff2eb66fcfbbe5a51c0.tar.xz |
reload icons if icon size preference changed
Diffstat (limited to 'src')
-rw-r--r-- | src/core/core.c | 22 | ||||
-rw-r--r-- | src/core/iconcache.c | 34 | ||||
-rw-r--r-- | src/core/iconcache.h | 5 | ||||
-rw-r--r-- | src/core/main.c | 4 | ||||
-rw-r--r-- | src/include/core.h | 2 | ||||
-rw-r--r-- | src/ui/ui.c | 9 |
6 files changed, 69 insertions, 7 deletions
diff --git a/src/core/core.c b/src/core/core.c index 535a3820..0e98959f 100644 --- a/src/core/core.c +++ b/src/core/core.c @@ -812,3 +812,25 @@ meta_invalidate_default_icons (void) g_slist_free (windows); } +void +meta_invalidate_all_icons (void) +{ + MetaDisplay *display = meta_get_display (); + GSList *windows; + GSList *l; + + if (display == NULL) + return; /* We can validly be called before the display is opened. */ + + windows = meta_display_list_windows (display); + for (l = windows; l != NULL; l = l->next) + { + MetaWindow *window = (MetaWindow*)l->data; + + meta_icon_cache_invalidate (&(window->icon_cache)); + meta_window_update_icon_now (window); + } + + g_slist_free (windows); +} + diff --git a/src/core/iconcache.c b/src/core/iconcache.c index d3b5c67b..3c0f1b8d 100644 --- a/src/core/iconcache.c +++ b/src/core/iconcache.c @@ -523,6 +523,10 @@ meta_icon_cache_init (MetaIconCache *icon_cache) icon_cache->wm_hints_dirty = TRUE; icon_cache->kwm_win_icon_dirty = TRUE; icon_cache->net_wm_icon_dirty = TRUE; + + icon_cache->wm_hints_dirty_forced = FALSE; + icon_cache->kwm_win_icon_dirty_forced = FALSE; + icon_cache->fallback_icon_dirty_forced = FALSE; } static void @@ -556,6 +560,18 @@ meta_icon_cache_free (MetaIconCache *icon_cache) } void +meta_icon_cache_invalidate (MetaIconCache *icon_cache) +{ + icon_cache->wm_hints_dirty = TRUE; + icon_cache->kwm_win_icon_dirty = TRUE; + icon_cache->net_wm_icon_dirty = TRUE; + + icon_cache->wm_hints_dirty_forced = TRUE; + icon_cache->kwm_win_icon_dirty_forced = TRUE; + icon_cache->fallback_icon_dirty_forced = TRUE; +} + +void meta_icon_cache_property_changed (MetaIconCache *icon_cache, MetaDisplay *display, Atom atom) @@ -773,9 +789,12 @@ meta_read_icons (MetaScreen *screen, * hints change */ if ((pixmap != icon_cache->prev_pixmap || - mask != icon_cache->prev_mask) && + mask != icon_cache->prev_mask || + icon_cache->wm_hints_dirty_forced) && pixmap != None) { + icon_cache->wm_hints_dirty_forced = FALSE; + if (try_pixmap_and_mask (screen->display, pixmap, mask, iconp, ideal_width, ideal_height, @@ -800,9 +819,12 @@ meta_read_icons (MetaScreen *screen, get_kwm_win_icon (screen->display, xwindow, &pixmap, &mask); if ((pixmap != icon_cache->prev_pixmap || - mask != icon_cache->prev_mask) && + mask != icon_cache->prev_mask || + icon_cache->kwm_win_icon_dirty_forced) && pixmap != None) { + icon_cache->kwm_win_icon_dirty_forced = FALSE; + if (try_pixmap_and_mask (screen->display, pixmap, mask, iconp, ideal_width, ideal_height, mini_iconp, ideal_mini_width, ideal_mini_height)) @@ -818,9 +840,13 @@ meta_read_icons (MetaScreen *screen, } } - if (icon_cache->want_fallback && - icon_cache->origin < USING_FALLBACK_ICON) + if ((icon_cache->want_fallback && + icon_cache->origin < USING_FALLBACK_ICON) + || (icon_cache->fallback_icon_dirty_forced && + icon_cache->origin == USING_FALLBACK_ICON)) { + icon_cache->fallback_icon_dirty_forced = FALSE; + get_fallback_icons (screen, iconp, ideal_width, diff --git a/src/core/iconcache.h b/src/core/iconcache.h index adb15d9b..4614da02 100644 --- a/src/core/iconcache.h +++ b/src/core/iconcache.h @@ -51,10 +51,15 @@ struct _MetaIconCache guint wm_hints_dirty : 1; guint kwm_win_icon_dirty : 1; guint net_wm_icon_dirty : 1; + + guint wm_hints_dirty_forced : 1; + guint kwm_win_icon_dirty_forced : 1; + guint fallback_icon_dirty_forced : 1; }; void meta_icon_cache_init (MetaIconCache *icon_cache); void meta_icon_cache_free (MetaIconCache *icon_cache); +void meta_icon_cache_invalidate (MetaIconCache *icon_cache); void meta_icon_cache_property_changed (MetaIconCache *icon_cache, MetaDisplay *display, Atom atom); diff --git a/src/core/main.c b/src/core/main.c index 6f6170d6..72542bff 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -52,6 +52,7 @@ #include "ui.h" #include "session.h" #include "prefs.h" +#include "core.h" #include <glib-object.h> #include <glib/gprintf.h> @@ -659,6 +660,9 @@ prefs_changed_callback (MetaPreference pref, meta_display_set_cursor_theme (meta_prefs_get_cursor_theme (), meta_prefs_get_cursor_size ()); break; + case META_PREF_ICON_SIZE: + meta_invalidate_all_icons(); + break; default: /* handled elsewhere or otherwise */ break; diff --git a/src/include/core.h b/src/include/core.h index faf792ed..c95d0fce 100644 --- a/src/include/core.h +++ b/src/include/core.h @@ -205,6 +205,8 @@ void meta_core_increment_event_serial (Display *display); void meta_invalidate_default_icons (void); +void meta_invalidate_all_icons (void); + #endif diff --git a/src/ui/ui.c b/src/ui/ui.c index 7b5bcdfc..f44b68cf 100644 --- a/src/ui/ui.c +++ b/src/ui/ui.c @@ -586,13 +586,16 @@ GdkPixbuf* meta_ui_get_default_window_icon (MetaUI *ui) { static GdkPixbuf *default_icon = NULL; - int scale; + static int icon_size = 0; + int current_icon_size = meta_prefs_get_icon_size(); - if (default_icon == NULL) + int scale; + if (default_icon == NULL || current_icon_size != icon_size) { scale = gtk_widget_get_scale_factor (GTK_WIDGET (ui->frames)); - default_icon = load_default_window_icon (meta_prefs_get_icon_size(), scale); + default_icon = load_default_window_icon (current_icon_size, scale); g_assert (default_icon); + icon_size = current_icon_size; } g_object_ref (G_OBJECT (default_icon)); |