>From e9272bf2b51e8c738916016c7d7f4274ff25afca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]>
Date: Fri, 15 Jun 2012 22:58:15 +0200
Subject: [PATCH] Icon painting moved to makeAppIconFor()
The icon painting is moved to the function makeAppIconFor()
including the check for no_appicon.
wAppIconCreate is now static because is only used in makeAppIconFor()
The function is moved above to avoid the prototype creation.
---
src/appicon.c | 93 ++++++++++++++++++++++++++---------------------------
src/appicon.h | 1 -
src/application.c | 4 ---
3 files changed, 46 insertions(+), 52 deletions(-)
diff --git a/src/appicon.c b/src/appicon.c
index 03f5e35..6a12653 100644
--- a/src/appicon.c
+++ b/src/appicon.c
@@ -155,19 +155,59 @@ WAppIcon *wAppIconCreateForDock(WScreen * scr, char
*command, char *wm_instance,
return dicon;
}
+static WAppIcon *wAppIconCreate(WWindow * leader_win)
+{
+ WAppIcon *aicon;
+ WScreen *scr = leader_win->screen_ptr;
+
+ aicon = wmalloc(sizeof(WAppIcon));
+ wretain(aicon);
+
+ aicon->yindex = -1;
+ aicon->xindex = -1;
+
+ aicon->prev = NULL;
+ aicon->next = scr->app_icon_list;
+ if (scr->app_icon_list)
+ scr->app_icon_list->prev = aicon;
+
+ scr->app_icon_list = aicon;
+
+ if (leader_win->wm_class)
+ aicon->wm_class = wstrdup(leader_win->wm_class);
+
+ if (leader_win->wm_instance)
+ aicon->wm_instance = wstrdup(leader_win->wm_instance);
+
+ aicon->icon = wIconCreate(leader_win);
+#ifdef XDND
+ wXDNDMakeAwareness(aicon->icon->core->window);
+#endif
+
+ /* will be overriden if docked */
+ aicon->icon->core->descriptor.handle_mousedown = appIconMouseDown;
+ aicon->icon->core->descriptor.handle_expose = iconExpose;
+ aicon->icon->core->descriptor.parent_type = WCLASS_APPICON;
+ aicon->icon->core->descriptor.parent = aicon;
+ AddToStackList(aicon->icon->core);
+ aicon->icon->show_title = 0;
+ wIconUpdate(aicon->icon);
+
+ return aicon;
+}
+
void makeAppIconFor(WApplication * wapp)
{
/* If app_icon, work is done, return */
if (wapp->app_icon)
return;
- if (!WFLAGP(wapp->main_window_desc, no_appicon))
- wapp->app_icon = wAppIconCreate(wapp->main_window_desc);
- else
- wapp->app_icon = NULL;
+ /* Create the icon */
+ wapp->app_icon = wAppIconCreate(wapp->main_window_desc);
/* Now, paint the icon */
- paint_app_icon(wapp);
+ if (!WFLAGP(wapp->main_window_desc, no_appicon))
+ paint_app_icon(wapp);
}
void paint_app_icon(WApplication *wapp)
@@ -236,47 +276,6 @@ void removeAppIconFor(WApplication * wapp)
wArrangeIcons(wapp->main_window_desc->screen_ptr, True);
}
-WAppIcon *wAppIconCreate(WWindow * leader_win)
-{
- WAppIcon *aicon;
- WScreen *scr = leader_win->screen_ptr;
-
- aicon = wmalloc(sizeof(WAppIcon));
- wretain(aicon);
-
- aicon->yindex = -1;
- aicon->xindex = -1;
-
- aicon->prev = NULL;
- aicon->next = scr->app_icon_list;
- if (scr->app_icon_list)
- scr->app_icon_list->prev = aicon;
-
- scr->app_icon_list = aicon;
-
- if (leader_win->wm_class)
- aicon->wm_class = wstrdup(leader_win->wm_class);
-
- if (leader_win->wm_instance)
- aicon->wm_instance = wstrdup(leader_win->wm_instance);
-
- aicon->icon = wIconCreate(leader_win);
-#ifdef XDND
- wXDNDMakeAwareness(aicon->icon->core->window);
-#endif
-
- /* will be overriden if docked */
- aicon->icon->core->descriptor.handle_mousedown = appIconMouseDown;
- aicon->icon->core->descriptor.handle_expose = iconExpose;
- aicon->icon->core->descriptor.parent_type = WCLASS_APPICON;
- aicon->icon->core->descriptor.parent = aicon;
- AddToStackList(aicon->icon->core);
- aicon->icon->show_title = 0;
- wIconUpdate(aicon->icon);
-
- return aicon;
-}
-
void wAppIconDestroy(WAppIcon * aicon)
{
WScreen *scr = aicon->icon->core->screen_ptr;
@@ -991,6 +990,6 @@ void app_icon_create_from_docks(WWindow *wwin, WApplication
*wapp, Window main_w
wAppIconPaint(wapp->app_icon);
wAppIconSave(wapp->app_icon);
} else {
- wapp->app_icon = wAppIconCreate(wapp->main_window_desc);
+ makeAppIconFor(wapp);
}
}
diff --git a/src/appicon.h b/src/appicon.h
index e401696..421ba47 100644
--- a/src/appicon.h
+++ b/src/appicon.h
@@ -69,7 +69,6 @@ typedef struct WAppIcon {
unsigned int lock:1; /* do not allow to be destroyed */
} WAppIcon;
-WAppIcon *wAppIconCreate(WWindow *leader_win);
WAppIcon *wAppIconCreateForDock(WScreen *scr, char *command, char *wm_instance,
char *wm_class, int tile);
diff --git a/src/application.c b/src/application.c
index 97943e9..adcb538 100644
--- a/src/application.c
+++ b/src/application.c
@@ -151,10 +151,6 @@ WApplication *wApplicationCreate(WWindow * wwin)
/* Save the app_icon in a file */
save_app_icon(wapp);
- /* Now, paint the icon */
- if (!WFLAGP(wapp->main_window_desc, no_appicon))
- paint_app_icon(wapp);
-
return wapp;
}
--
1.7.10
--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/
>From e9272bf2b51e8c738916016c7d7f4274ff25afca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]>
Date: Fri, 15 Jun 2012 22:58:15 +0200
Subject: [PATCH] Icon painting moved to makeAppIconFor()
The icon painting is moved to the function makeAppIconFor()
including the check for no_appicon.
wAppIconCreate is now static because is only used in makeAppIconFor()
The function is moved above to avoid the prototype creation.
---
src/appicon.c | 93 ++++++++++++++++++++++++++---------------------------
src/appicon.h | 1 -
src/application.c | 4 ---
3 files changed, 46 insertions(+), 52 deletions(-)
diff --git a/src/appicon.c b/src/appicon.c
index 03f5e35..6a12653 100644
--- a/src/appicon.c
+++ b/src/appicon.c
@@ -155,19 +155,59 @@ WAppIcon *wAppIconCreateForDock(WScreen * scr, char *command, char *wm_instance,
return dicon;
}
+static WAppIcon *wAppIconCreate(WWindow * leader_win)
+{
+ WAppIcon *aicon;
+ WScreen *scr = leader_win->screen_ptr;
+
+ aicon = wmalloc(sizeof(WAppIcon));
+ wretain(aicon);
+
+ aicon->yindex = -1;
+ aicon->xindex = -1;
+
+ aicon->prev = NULL;
+ aicon->next = scr->app_icon_list;
+ if (scr->app_icon_list)
+ scr->app_icon_list->prev = aicon;
+
+ scr->app_icon_list = aicon;
+
+ if (leader_win->wm_class)
+ aicon->wm_class = wstrdup(leader_win->wm_class);
+
+ if (leader_win->wm_instance)
+ aicon->wm_instance = wstrdup(leader_win->wm_instance);
+
+ aicon->icon = wIconCreate(leader_win);
+#ifdef XDND
+ wXDNDMakeAwareness(aicon->icon->core->window);
+#endif
+
+ /* will be overriden if docked */
+ aicon->icon->core->descriptor.handle_mousedown = appIconMouseDown;
+ aicon->icon->core->descriptor.handle_expose = iconExpose;
+ aicon->icon->core->descriptor.parent_type = WCLASS_APPICON;
+ aicon->icon->core->descriptor.parent = aicon;
+ AddToStackList(aicon->icon->core);
+ aicon->icon->show_title = 0;
+ wIconUpdate(aicon->icon);
+
+ return aicon;
+}
+
void makeAppIconFor(WApplication * wapp)
{
/* If app_icon, work is done, return */
if (wapp->app_icon)
return;
- if (!WFLAGP(wapp->main_window_desc, no_appicon))
- wapp->app_icon = wAppIconCreate(wapp->main_window_desc);
- else
- wapp->app_icon = NULL;
+ /* Create the icon */
+ wapp->app_icon = wAppIconCreate(wapp->main_window_desc);
/* Now, paint the icon */
- paint_app_icon(wapp);
+ if (!WFLAGP(wapp->main_window_desc, no_appicon))
+ paint_app_icon(wapp);
}
void paint_app_icon(WApplication *wapp)
@@ -236,47 +276,6 @@ void removeAppIconFor(WApplication * wapp)
wArrangeIcons(wapp->main_window_desc->screen_ptr, True);
}
-WAppIcon *wAppIconCreate(WWindow * leader_win)
-{
- WAppIcon *aicon;
- WScreen *scr = leader_win->screen_ptr;
-
- aicon = wmalloc(sizeof(WAppIcon));
- wretain(aicon);
-
- aicon->yindex = -1;
- aicon->xindex = -1;
-
- aicon->prev = NULL;
- aicon->next = scr->app_icon_list;
- if (scr->app_icon_list)
- scr->app_icon_list->prev = aicon;
-
- scr->app_icon_list = aicon;
-
- if (leader_win->wm_class)
- aicon->wm_class = wstrdup(leader_win->wm_class);
-
- if (leader_win->wm_instance)
- aicon->wm_instance = wstrdup(leader_win->wm_instance);
-
- aicon->icon = wIconCreate(leader_win);
-#ifdef XDND
- wXDNDMakeAwareness(aicon->icon->core->window);
-#endif
-
- /* will be overriden if docked */
- aicon->icon->core->descriptor.handle_mousedown = appIconMouseDown;
- aicon->icon->core->descriptor.handle_expose = iconExpose;
- aicon->icon->core->descriptor.parent_type = WCLASS_APPICON;
- aicon->icon->core->descriptor.parent = aicon;
- AddToStackList(aicon->icon->core);
- aicon->icon->show_title = 0;
- wIconUpdate(aicon->icon);
-
- return aicon;
-}
-
void wAppIconDestroy(WAppIcon * aicon)
{
WScreen *scr = aicon->icon->core->screen_ptr;
@@ -991,6 +990,6 @@ void app_icon_create_from_docks(WWindow *wwin, WApplication *wapp, Window main_w
wAppIconPaint(wapp->app_icon);
wAppIconSave(wapp->app_icon);
} else {
- wapp->app_icon = wAppIconCreate(wapp->main_window_desc);
+ makeAppIconFor(wapp);
}
}
diff --git a/src/appicon.h b/src/appicon.h
index e401696..421ba47 100644
--- a/src/appicon.h
+++ b/src/appicon.h
@@ -69,7 +69,6 @@ typedef struct WAppIcon {
unsigned int lock:1; /* do not allow to be destroyed */
} WAppIcon;
-WAppIcon *wAppIconCreate(WWindow *leader_win);
WAppIcon *wAppIconCreateForDock(WScreen *scr, char *command, char *wm_instance,
char *wm_class, int tile);
diff --git a/src/application.c b/src/application.c
index 97943e9..adcb538 100644
--- a/src/application.c
+++ b/src/application.c
@@ -151,10 +151,6 @@ WApplication *wApplicationCreate(WWindow * wwin)
/* Save the app_icon in a file */
save_app_icon(wapp);
- /* Now, paint the icon */
- if (!WFLAGP(wapp->main_window_desc, no_appicon))
- paint_app_icon(wapp);
-
return wapp;
}
--
1.7.10