summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorosch <oliver at luced de>2019-04-12 23:48:52 +0200
committerlukefromdc <[email protected]>2019-04-23 18:35:39 +0000
commit54d6dd4cd27c97c3560c3ff2eb66fcfbbe5a51c0 (patch)
tree7ea59fcfd5b6b26c409904d34083d428c2f447a4 /src/core
parent5e2f54dbf2417c3b5f8b1614010565a0a500382a (diff)
downloadmarco-54d6dd4cd27c97c3560c3ff2eb66fcfbbe5a51c0.tar.bz2
marco-54d6dd4cd27c97c3560c3ff2eb66fcfbbe5a51c0.tar.xz
reload icons if icon size preference changed
Diffstat (limited to 'src/core')
-rw-r--r--src/core/core.c22
-rw-r--r--src/core/iconcache.c34
-rw-r--r--src/core/iconcache.h5
-rw-r--r--src/core/main.c4
4 files changed, 61 insertions, 4 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;