>From ecec4089c66f5f5a3affac96c0a99d78aba4e5d5 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 11/12] 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()
---
 src/appicon.c     |   14 +++++++-------
 src/appicon.h     |    1 -
 src/application.c |    4 ----
 3 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/src/appicon.c b/src/appicon.c
index 47051c7..62c1019 100644
--- a/src/appicon.c
+++ b/src/appicon.c
@@ -67,6 +67,7 @@ void appIconMouseDown(WObjDescriptor * desc, XEvent * event);
 static void iconDblClick(WObjDescriptor * desc, XEvent * event);
 static void iconExpose(WObjDescriptor * desc, XEvent * event);
 static void wApplicationSaveIconPathFor(char *iconPath, char *wm_instance, 
char *wm_class);
+static WAppIcon *wAppIconCreate(WWindow * leader_win);
 
 /* This function is used if the application is a .app. It checks if it has an 
icon in it
  * like for example /usr/local/GNUstep/Applications/WPrefs.app/WPrefs.tiff
@@ -161,13 +162,12 @@ void makeAppIconFor(WApplication * wapp)
        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,7 +236,7 @@ void removeAppIconFor(WApplication * wapp)
                wArrangeIcons(wapp->main_window_desc->screen_ptr, True);
 }
 
-WAppIcon *wAppIconCreate(WWindow * leader_win)
+static WAppIcon *wAppIconCreate(WWindow * leader_win)
 {
        WAppIcon *aicon;
        WScreen *scr = leader_win->screen_ptr;
@@ -991,6 +991,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 43803c2..33ee7ba 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 ecec4089c66f5f5a3affac96c0a99d78aba4e5d5 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 11/12] 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()
---
 src/appicon.c     |   14 +++++++-------
 src/appicon.h     |    1 -
 src/application.c |    4 ----
 3 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/src/appicon.c b/src/appicon.c
index 47051c7..62c1019 100644
--- a/src/appicon.c
+++ b/src/appicon.c
@@ -67,6 +67,7 @@ void appIconMouseDown(WObjDescriptor * desc, XEvent * event);
 static void iconDblClick(WObjDescriptor * desc, XEvent * event);
 static void iconExpose(WObjDescriptor * desc, XEvent * event);
 static void wApplicationSaveIconPathFor(char *iconPath, char *wm_instance, char *wm_class);
+static WAppIcon *wAppIconCreate(WWindow * leader_win);
 
 /* This function is used if the application is a .app. It checks if it has an icon in it
  * like for example /usr/local/GNUstep/Applications/WPrefs.app/WPrefs.tiff
@@ -161,13 +162,12 @@ void makeAppIconFor(WApplication * wapp)
 	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,7 +236,7 @@ void removeAppIconFor(WApplication * wapp)
 		wArrangeIcons(wapp->main_window_desc->screen_ptr, True);
 }
 
-WAppIcon *wAppIconCreate(WWindow * leader_win)
+static WAppIcon *wAppIconCreate(WWindow * leader_win)
 {
 	WAppIcon *aicon;
 	WScreen *scr = leader_win->screen_ptr;
@@ -991,6 +991,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 43803c2..33ee7ba 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

Reply via email to