[libwnck/wip/muktupavels/wnck-handle: 8/8] util: move icon reloading to WnckHandle
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libwnck/wip/muktupavels/wnck-handle: 8/8] util: move icon reloading to WnckHandle
- Date: Mon, 15 Aug 2022 09:57:28 +0000 (UTC)
commit 72fee2a5c40cb7ef320a409d54d2dff6e5fe8321
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Tue Mar 15 16:17:09 2022 +0200
util: move icon reloading to WnckHandle
Missing part from 8260794f4d73219d026c53b6d57244ddf52d34a6.
libwnck/util.c | 23 -----------------------
libwnck/wnck-handle.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 47 insertions(+), 23 deletions(-)
---
diff --git a/libwnck/util.c b/libwnck/util.c
index 701878b4..1f183a95 100644
--- a/libwnck/util.c
+++ b/libwnck/util.c
@@ -191,30 +191,7 @@ wnck_set_default_icon_size (gsize size)
void
wnck_set_default_mini_icon_size (gsize size)
{
- int default_screen;
- WnckScreen *screen;
- GList *l;
-
wnck_handle_set_default_mini_icon_size (_wnck_get_handle (), size);
-
- default_screen = DefaultScreen (_wnck_get_default_display ());
- screen = _wnck_handle_get_existing_screen (_wnck_get_handle (),
- default_screen);
-
- if (WNCK_IS_SCREEN (screen))
- {
- /* Make applications and icons to reload their icons */
- for (l = wnck_screen_get_windows (screen); l; l = l->next)
- {
- WnckWindow *window = WNCK_WINDOW (l->data);
- WnckApplication *application = wnck_window_get_application (window);
-
- _wnck_window_load_icons (window);
-
- if (WNCK_IS_APPLICATION (application))
- _wnck_application_load_icons (application);
- }
- }
}
/**
diff --git a/libwnck/wnck-handle.c b/libwnck/wnck-handle.c
index 6f8579f5..4bfa5c1d 100644
--- a/libwnck/wnck-handle.c
+++ b/libwnck/wnck-handle.c
@@ -64,6 +64,43 @@ static GParamSpec *handle_properties[LAST_PROP] = { NULL };
G_DEFINE_TYPE (WnckHandle, wnck_handle, G_TYPE_OBJECT)
+static void
+invalidate_icons (WnckHandle *self)
+{
+ Display *xdisplay;
+ int i;
+
+ xdisplay = _wnck_get_default_display ();
+
+ for (i = 0; i < ScreenCount (xdisplay); ++i)
+ {
+ WnckScreen *screen;
+ GList *windows;
+ GList *l;
+
+ screen = self->screens[i];
+
+ if (screen == NULL)
+ continue;
+
+ windows = wnck_screen_get_windows (screen);
+
+ for (l = windows; l != NULL; l = l->next)
+ {
+ WnckWindow *window;
+ WnckApplication *application;
+
+ window = WNCK_WINDOW (l->data);
+ application = wnck_window_get_application (window);
+
+ _wnck_window_load_icons (window);
+
+ if (application != NULL)
+ _wnck_application_load_icons (application);
+ }
+ }
+}
+
static GdkFilterReturn
filter_func (GdkXEvent *gdkxevent,
GdkEvent *event,
@@ -471,7 +508,12 @@ wnck_handle_set_default_icon_size (WnckHandle *self,
{
g_return_if_fail (WNCK_IS_HANDLE (self));
+ if (self->default_icon_size == icon_size)
+ return;
+
self->default_icon_size = icon_size;
+
+ invalidate_icons (self);
}
gsize
@@ -496,7 +538,12 @@ wnck_handle_set_default_mini_icon_size (WnckHandle *self,
{
g_return_if_fail (WNCK_IS_HANDLE (self));
+ if (self->default_mini_icon_size == icon_size)
+ return;
+
self->default_mini_icon_size = icon_size;
+
+ invalidate_icons (self);
}
gsize
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]