>From 63d6d9cae5124a47ae1ff95faeb024db3f63811f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]>
Date: Fri, 30 Mar 2012 15:50:37 +0200
Subject: [PATCH 2/5] WindowMaker: New parameter noDefault in wDefaultGetImage

The function wDefaultGetImage calls the function wDefaultGetIconFile using the 
option boolean option "False". wDefaultGetIconFile uses this argument to search 
the default icon (if is False) or don't search it (if is True).

Using the boolean argument in wDefaultGetIconFile too, permits to select if the 
RImage can include the default Image or not. This argument is send in the 
wDefaultGetIconFile function, instead "False".

RImage *wDefaultGetImage(WScreen * scr, char *winstance, char *wclass, int 
max_size, Bool noDefault)
{
[snip]
        /* Get the file name of the image, using instance and class */
        file_name = wDefaultGetIconFile(scr, winstance, wclass, noDefault);
        if (!file_name)
                return NULL;
---
 src/defaults.c    |    2 +-
 src/defaults.h    |    2 +-
 src/icon.c        |    2 +-
 src/screen.c      |    2 +-
 src/switchpanel.c |    2 +-
 src/wdefaults.c   |    4 ++--
 6 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/defaults.c b/src/defaults.c
index 5b5269b..d005bbc 100644
--- a/src/defaults.c
+++ b/src/defaults.c
@@ -979,7 +979,7 @@ void wDefaultsCheckDomains(void* arg)
                                                /* Update the panel image if 
changed */
                                                /* Don't worry. If the image is 
the same these
                                                 * functions will have no 
performance impact. */
-                                               image = wDefaultGetImage(scr, 
"Logo", "WMPanel", wPreferences.icon_size);
+                                               image = wDefaultGetImage(scr, 
"Logo", "WMPanel", wPreferences.icon_size, False);
 
                                                if (!image) {
                                                        wwarning(_("could not 
load logo image for panels: %s"),
diff --git a/src/defaults.h b/src/defaults.h
index 29d242d..9491a27 100644
--- a/src/defaults.h
+++ b/src/defaults.h
@@ -52,7 +52,7 @@ void wSaveDefaults(WScreen *scr);
 char *wDefaultGetIconFile(WScreen *scr, char *instance, char *class,
                           Bool noDefault);
 
-RImage *wDefaultGetImage(WScreen *scr, char *winstance, char *wclass, int 
max_size);
+RImage *wDefaultGetImage(WScreen *scr, char *winstance, char *wclass, int 
max_size, Bool noDefault);
 
 void wDefaultFillAttributes(WScreen *scr, char *instance, char *class,
                             WWindowAttributes *attr, WWindowAttributes *mask,
diff --git a/src/icon.c b/src/icon.c
index d7fd3cd..f32b372 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -157,7 +157,7 @@ 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, wwin->wm_instance, 
wwin->wm_class, wPreferences.icon_size, False);
 
        file = wDefaultGetIconFile(scr, wwin->wm_instance, wwin->wm_class, 
False);
        if (file)
diff --git a/src/screen.c b/src/screen.c
index b0fb88e..cd7daae 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -402,7 +402,7 @@ static void createPixmaps(WScreen * scr)
                pix->shared = 1;
        scr->menu_shade_indicator = pix;
 
-       image = wDefaultGetImage(scr, "Logo", "WMPanel", 
wPreferences.icon_size);
+       image = wDefaultGetImage(scr, "Logo", "WMPanel", 
wPreferences.icon_size, False);
 
        if (!image) {
                wwarning(_("could not load logo image for panels: %s"), 
RMessageForError(RErrorCode));
diff --git a/src/switchpanel.c b/src/switchpanel.c
index 8f9eec1..a8ea585 100644
--- a/src/switchpanel.c
+++ b/src/switchpanel.c
@@ -177,7 +177,7 @@ static void addIconForWindow(WSwitchPanel * panel, WMWidget 
* parent, WWindow *
        // it's very likely that most of them are instances of the same thing,
        // so caching them should get performance acceptable in these cases.
        if (!image)
-               image = wDefaultGetImage(panel->scr, wwin->wm_instance, 
wwin->wm_class, ICON_TILE_SIZE);
+               image = wDefaultGetImage(panel->scr, wwin->wm_instance, 
wwin->wm_class, ICON_TILE_SIZE, False);
 
        if (!image && !panel->defIcon) {
                char *file = wDefaultGetIconFile(panel->scr, NULL, NULL, False);
diff --git a/src/wdefaults.c b/src/wdefaults.c
index c22ad5b..a091b9b 100644
--- a/src/wdefaults.c
+++ b/src/wdefaults.c
@@ -400,14 +400,14 @@ char *wDefaultGetIconFile(WScreen * scr, char *instance, 
char *class, Bool noDef
        return tmp;
 }
 
-RImage *wDefaultGetImage(WScreen * scr, char *winstance, char *wclass, int 
max_size)
+RImage *wDefaultGetImage(WScreen * scr, char *winstance, char *wclass, int 
max_size, Bool noDefault)
 {
        char *file_name;
        char *path;
        RImage *image;
 
        /* Get the file name of the image, using instance and class */
-       file_name = wDefaultGetIconFile(scr, winstance, wclass, False);
+       file_name = wDefaultGetIconFile(scr, winstance, wclass, noDefault);
        if (!file_name)
                return NULL;
 
-- 
1.7.9.1

-- 
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/
>From 63d6d9cae5124a47ae1ff95faeb024db3f63811f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]>
Date: Fri, 30 Mar 2012 15:50:37 +0200
Subject: [PATCH 2/5] WindowMaker: New parameter noDefault in wDefaultGetImage

The function wDefaultGetImage calls the function wDefaultGetIconFile using the option boolean option "False". wDefaultGetIconFile uses this argument to search the default icon (if is False) or don't search it (if is True).

Using the boolean argument in wDefaultGetIconFile too, permits to select if the RImage can include the default Image or not. This argument is send in the wDefaultGetIconFile function, instead "False".

RImage *wDefaultGetImage(WScreen * scr, char *winstance, char *wclass, int max_size, Bool noDefault)
{
[snip]
        /* Get the file name of the image, using instance and class */
        file_name = wDefaultGetIconFile(scr, winstance, wclass, noDefault);
        if (!file_name)
                return NULL;
---
 src/defaults.c    |    2 +-
 src/defaults.h    |    2 +-
 src/icon.c        |    2 +-
 src/screen.c      |    2 +-
 src/switchpanel.c |    2 +-
 src/wdefaults.c   |    4 ++--
 6 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/defaults.c b/src/defaults.c
index 5b5269b..d005bbc 100644
--- a/src/defaults.c
+++ b/src/defaults.c
@@ -979,7 +979,7 @@ void wDefaultsCheckDomains(void* arg)
 						/* Update the panel image if changed */
 						/* Don't worry. If the image is the same these
 						 * functions will have no performance impact. */
-						image = wDefaultGetImage(scr, "Logo", "WMPanel", wPreferences.icon_size);
+						image = wDefaultGetImage(scr, "Logo", "WMPanel", wPreferences.icon_size, False);
 
 						if (!image) {
 							wwarning(_("could not load logo image for panels: %s"),
diff --git a/src/defaults.h b/src/defaults.h
index 29d242d..9491a27 100644
--- a/src/defaults.h
+++ b/src/defaults.h
@@ -52,7 +52,7 @@ void wSaveDefaults(WScreen *scr);
 char *wDefaultGetIconFile(WScreen *scr, char *instance, char *class,
                           Bool noDefault);
 
-RImage *wDefaultGetImage(WScreen *scr, char *winstance, char *wclass, int max_size);
+RImage *wDefaultGetImage(WScreen *scr, char *winstance, char *wclass, int max_size, Bool noDefault);
 
 void wDefaultFillAttributes(WScreen *scr, char *instance, char *class,
                             WWindowAttributes *attr, WWindowAttributes *mask,
diff --git a/src/icon.c b/src/icon.c
index d7fd3cd..f32b372 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -157,7 +157,7 @@ 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, wwin->wm_instance, wwin->wm_class, wPreferences.icon_size, False);
 
 	file = wDefaultGetIconFile(scr, wwin->wm_instance, wwin->wm_class, False);
 	if (file)
diff --git a/src/screen.c b/src/screen.c
index b0fb88e..cd7daae 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -402,7 +402,7 @@ static void createPixmaps(WScreen * scr)
 		pix->shared = 1;
 	scr->menu_shade_indicator = pix;
 
-	image = wDefaultGetImage(scr, "Logo", "WMPanel", wPreferences.icon_size);
+	image = wDefaultGetImage(scr, "Logo", "WMPanel", wPreferences.icon_size, False);
 
 	if (!image) {
 		wwarning(_("could not load logo image for panels: %s"), RMessageForError(RErrorCode));
diff --git a/src/switchpanel.c b/src/switchpanel.c
index 8f9eec1..a8ea585 100644
--- a/src/switchpanel.c
+++ b/src/switchpanel.c
@@ -177,7 +177,7 @@ static void addIconForWindow(WSwitchPanel * panel, WMWidget * parent, WWindow *
 	// it's very likely that most of them are instances of the same thing,
 	// so caching them should get performance acceptable in these cases.
 	if (!image)
-		image = wDefaultGetImage(panel->scr, wwin->wm_instance, wwin->wm_class, ICON_TILE_SIZE);
+		image = wDefaultGetImage(panel->scr, wwin->wm_instance, wwin->wm_class, ICON_TILE_SIZE, False);
 
 	if (!image && !panel->defIcon) {
 		char *file = wDefaultGetIconFile(panel->scr, NULL, NULL, False);
diff --git a/src/wdefaults.c b/src/wdefaults.c
index c22ad5b..a091b9b 100644
--- a/src/wdefaults.c
+++ b/src/wdefaults.c
@@ -400,14 +400,14 @@ char *wDefaultGetIconFile(WScreen * scr, char *instance, char *class, Bool noDef
 	return tmp;
 }
 
-RImage *wDefaultGetImage(WScreen * scr, char *winstance, char *wclass, int max_size)
+RImage *wDefaultGetImage(WScreen * scr, char *winstance, char *wclass, int max_size, Bool noDefault)
 {
 	char *file_name;
 	char *path;
 	RImage *image;
 
 	/* Get the file name of the image, using instance and class */
-	file_name = wDefaultGetIconFile(scr, winstance, wclass, False);
+	file_name = wDefaultGetIconFile(scr, winstance, wclass, noDefault);
 	if (!file_name)
 		return NULL;
 
-- 
1.7.9.1

Reply via email to