>From 33769e4d9e30e5c6c10018934d12a368f18d11a5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]>
Date: Tue, 3 Jul 2012 16:15:54 +0200
Subject: [PATCH 06/13] wIconCreate new interface
The function wIconCreate has now a new interface:
-WIcon * wIconCreate(WWindow *wwin);
+WIcon *wIconCreate(WWindow *wwin, WScreen *scr, char *command,
+ char *instance, char *class, int tile_type);
This new interface is easy to set, because the screen, instance and class
are included in the WWindow struct. Only command and tile_type are added.
This change is done to join the functions wIconCreate and
wIconCreateWithIconFile.
---
src/actions.c | 4 +++-
src/appicon.c | 2 +-
src/icon.c | 17 +++++++++++------
src/icon.h | 3 ++-
4 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/src/actions.c b/src/actions.c
index 988e90a..e33d0cd 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -1112,7 +1112,9 @@ void wIconifyWindow(WWindow * wwin)
if (!wwin->flags.icon_moved)
PlaceIcon(wwin->screen_ptr, &wwin->icon_x,
&wwin->icon_y, wGetHeadForWindow(wwin));
- wwin->icon = wIconCreate(wwin);
+ wwin->icon = wIconCreate(wwin, wwin->screen_ptr, NULL,
wwin->wm_instance,
+ wwin->wm_class, TILE_NORMAL);
+
wwin->icon->mapped = 1;
}
diff --git a/src/appicon.c b/src/appicon.c
index 795b020..c06a806 100644
--- a/src/appicon.c
+++ b/src/appicon.c
@@ -256,7 +256,7 @@ static WAppIcon *wAppIconCreate(WWindow * leader_win)
if (leader_win->wm_instance)
aicon->wm_instance = wstrdup(leader_win->wm_instance);
- aicon->icon = wIconCreate(leader_win);
+ aicon->icon = wIconCreate(leader_win, scr, NULL,
leader_win->wm_instance, leader_win->wm_class, TILE_NORMAL);
#ifdef XDND
wXDNDMakeAwareness(aicon->icon->core->window);
#endif
diff --git a/src/icon.c b/src/icon.c
index 6537ece..60da345 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -100,11 +100,11 @@ INLINE static void getSize(Drawable d, unsigned int *w,
unsigned int *h, unsigne
XGetGeometry(dpy, d, &rjunk, &xjunk, &yjunk, w, h, &bjunk, dep);
}
-WIcon *wIconCreate(WWindow * wwin)
+WIcon *wIconCreate(WWindow *wwin, WScreen *scr, char *command,
+ char *instance, char *class, int tile_type)
{
- WScreen *scr = wwin->screen_ptr;
WIcon *icon;
- char *file;
+ char *file = NULL;
icon = wIconCreateCore(scr, wwin->icon_x, wwin->icon_y);
@@ -125,9 +125,9 @@ WIcon *wIconCreate(WWindow * wwin)
#else
icon->show_title = 1;
#endif
- icon->file_image = wDefaultGetImage(scr, wwin->wm_instance,
wwin->wm_class, wPreferences.icon_size);
+ icon->file_image = wDefaultGetImage(scr, instance, class,
wPreferences.icon_size);
- file = wDefaultGetIconFile(wwin->wm_instance, wwin->wm_class, False);
+ file = wDefaultGetIconFile(instance, class, False);
if (file)
icon->file = wstrdup(file);
@@ -137,7 +137,7 @@ WIcon *wIconCreate(WWindow * wwin)
else
wGetIconName(dpy, wwin->client_win, &icon->icon_name);
- icon->tile_type = TILE_NORMAL;
+ icon->tile_type = tile_type;
wIconUpdate(icon);
@@ -145,6 +145,7 @@ WIcon *wIconCreate(WWindow * wwin)
WMAddNotificationObserver(appearanceObserver, icon,
WNIconAppearanceSettingsChanged, icon);
WMAddNotificationObserver(tileObserver, icon,
WNIconTileSettingsChanged, icon);
+
return icon;
}
@@ -168,6 +169,7 @@ WIcon *wIconCreateWithIconFile(WScreen * scr, char
*iconfile, int tile)
wIconUpdate(icon);
+
WMAddNotificationObserver(appearanceObserver, icon,
WNIconAppearanceSettingsChanged, icon);
WMAddNotificationObserver(tileObserver, icon,
WNIconTileSettingsChanged, icon);
@@ -211,6 +213,9 @@ static WIcon *wIconCreateCore(WScreen *scr, int coord_x,
int coord_y)
icon->core->stacking->window_level = NORMAL_ICON_LEVEL;
icon->core->stacking->child_of = NULL;
+ icon->file = NULL;
+ icon->file_image = NULL;
+
return icon;
}
diff --git a/src/icon.h b/src/icon.h
index 62a1844..109f1d6 100644
--- a/src/icon.h
+++ b/src/icon.h
@@ -55,7 +55,8 @@ typedef struct WIcon {
} WIcon;
WIcon * wIconCreateWithIconFile(WScreen *scr, char *iconfile, int tile);
-WIcon * wIconCreate(WWindow *wwin);
+WIcon *wIconCreate(WWindow *wwin, WScreen *scr, char *command,
+ char *instance, char *class, int tile_type);
void wIconDestroy(WIcon *icon);
void wIconPaint(WIcon *icon);
--
1.7.10
--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/
>From 33769e4d9e30e5c6c10018934d12a368f18d11a5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]>
Date: Tue, 3 Jul 2012 16:15:54 +0200
Subject: [PATCH 06/13] wIconCreate new interface
The function wIconCreate has now a new interface:
-WIcon * wIconCreate(WWindow *wwin);
+WIcon *wIconCreate(WWindow *wwin, WScreen *scr, char *command,
+ char *instance, char *class, int tile_type);
This new interface is easy to set, because the screen, instance and class
are included in the WWindow struct. Only command and tile_type are added.
This change is done to join the functions wIconCreate and
wIconCreateWithIconFile.
---
src/actions.c | 4 +++-
src/appicon.c | 2 +-
src/icon.c | 17 +++++++++++------
src/icon.h | 3 ++-
4 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/src/actions.c b/src/actions.c
index 988e90a..e33d0cd 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -1112,7 +1112,9 @@ void wIconifyWindow(WWindow * wwin)
if (!wwin->flags.icon_moved)
PlaceIcon(wwin->screen_ptr, &wwin->icon_x, &wwin->icon_y, wGetHeadForWindow(wwin));
- wwin->icon = wIconCreate(wwin);
+ wwin->icon = wIconCreate(wwin, wwin->screen_ptr, NULL, wwin->wm_instance,
+ wwin->wm_class, TILE_NORMAL);
+
wwin->icon->mapped = 1;
}
diff --git a/src/appicon.c b/src/appicon.c
index 795b020..c06a806 100644
--- a/src/appicon.c
+++ b/src/appicon.c
@@ -256,7 +256,7 @@ static WAppIcon *wAppIconCreate(WWindow * leader_win)
if (leader_win->wm_instance)
aicon->wm_instance = wstrdup(leader_win->wm_instance);
- aicon->icon = wIconCreate(leader_win);
+ aicon->icon = wIconCreate(leader_win, scr, NULL, leader_win->wm_instance, leader_win->wm_class, TILE_NORMAL);
#ifdef XDND
wXDNDMakeAwareness(aicon->icon->core->window);
#endif
diff --git a/src/icon.c b/src/icon.c
index 6537ece..60da345 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -100,11 +100,11 @@ INLINE static void getSize(Drawable d, unsigned int *w, unsigned int *h, unsigne
XGetGeometry(dpy, d, &rjunk, &xjunk, &yjunk, w, h, &bjunk, dep);
}
-WIcon *wIconCreate(WWindow * wwin)
+WIcon *wIconCreate(WWindow *wwin, WScreen *scr, char *command,
+ char *instance, char *class, int tile_type)
{
- WScreen *scr = wwin->screen_ptr;
WIcon *icon;
- char *file;
+ char *file = NULL;
icon = wIconCreateCore(scr, wwin->icon_x, wwin->icon_y);
@@ -125,9 +125,9 @@ WIcon *wIconCreate(WWindow * wwin)
#else
icon->show_title = 1;
#endif
- icon->file_image = wDefaultGetImage(scr, wwin->wm_instance, wwin->wm_class, wPreferences.icon_size);
+ icon->file_image = wDefaultGetImage(scr, instance, class, wPreferences.icon_size);
- file = wDefaultGetIconFile(wwin->wm_instance, wwin->wm_class, False);
+ file = wDefaultGetIconFile(instance, class, False);
if (file)
icon->file = wstrdup(file);
@@ -137,7 +137,7 @@ WIcon *wIconCreate(WWindow * wwin)
else
wGetIconName(dpy, wwin->client_win, &icon->icon_name);
- icon->tile_type = TILE_NORMAL;
+ icon->tile_type = tile_type;
wIconUpdate(icon);
@@ -145,6 +145,7 @@ WIcon *wIconCreate(WWindow * wwin)
WMAddNotificationObserver(appearanceObserver, icon, WNIconAppearanceSettingsChanged, icon);
WMAddNotificationObserver(tileObserver, icon, WNIconTileSettingsChanged, icon);
+
return icon;
}
@@ -168,6 +169,7 @@ WIcon *wIconCreateWithIconFile(WScreen * scr, char *iconfile, int tile)
wIconUpdate(icon);
+
WMAddNotificationObserver(appearanceObserver, icon, WNIconAppearanceSettingsChanged, icon);
WMAddNotificationObserver(tileObserver, icon, WNIconTileSettingsChanged, icon);
@@ -211,6 +213,9 @@ static WIcon *wIconCreateCore(WScreen *scr, int coord_x, int coord_y)
icon->core->stacking->window_level = NORMAL_ICON_LEVEL;
icon->core->stacking->child_of = NULL;
+ icon->file = NULL;
+ icon->file_image = NULL;
+
return icon;
}
diff --git a/src/icon.h b/src/icon.h
index 62a1844..109f1d6 100644
--- a/src/icon.h
+++ b/src/icon.h
@@ -55,7 +55,8 @@ typedef struct WIcon {
} WIcon;
WIcon * wIconCreateWithIconFile(WScreen *scr, char *iconfile, int tile);
-WIcon * wIconCreate(WWindow *wwin);
+WIcon *wIconCreate(WWindow *wwin, WScreen *scr, char *command,
+ char *instance, char *class, int tile_type);
void wIconDestroy(WIcon *icon);
void wIconPaint(WIcon *icon);
--
1.7.10