This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project wmaker-crm.git.
The branch, next has been updated
via 0e15a1003792a91b86e5dbf0eca5c6a724546c9a (commit)
via 02035dc6ac99a2da3a2bf067e1444e9ca6443f6e (commit)
via 21fb6db616f0098cc599968cb0742b7436a4c6b5 (commit)
via 219315aa58ab2d4742d0893eaccaac9c027305c2 (commit)
via ad373ef0ddb27802237df191d039ceeb8e14b35d (commit)
via 761fd37e5172b245d98a3cc2c459b7e559d0bc02 (commit)
via afe2e5d9d6ba5ee8945aae703440d22f4c22b0b9 (commit)
from b3afad67ff75dc7bd22b31b8370bbabd9786bbdd (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/wmaker-crm.git/commit/0e15a1003792a91b86e5dbf0eca5c6a724546c9a
commit 0e15a1003792a91b86e5dbf0eca5c6a724546c9a
Author: Rodolfo GarcÃa Peñas (kix) <[email protected]>
Date: Sun Apr 15 20:20:29 2012 +0200
WindowMaker: wIconStore() don't save the icon if exists
The function wIconStore() don't write a new file overwriting the
previous icon if the icon file exists.
diff --git a/src/icon.c b/src/icon.c
index 98df353..e7910c7 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -475,6 +475,10 @@ char *wIconStore(WIcon * icon)
if (!path)
return NULL;
+ /* If icon exists, exit */
+ if (access(path, F_OK) == 0)
+ return path;
+
if (wwin->net_icon_image) {
image = RRetainImage(wwin->net_icon_image);
} else if (wwin->wm_hints && (wwin->wm_hints->flags & IconPixmapHint)
http://repo.or.cz/w/wmaker-crm.git/commit/02035dc6ac99a2da3a2bf067e1444e9ca6443f6e
commit 02035dc6ac99a2da3a2bf067e1444e9ca6443f6e
Author: Rodolfo GarcÃa Peñas (kix) <[email protected]>
Date: Sat Apr 14 13:54:22 2012 +0200
WindowMaker: getnameforicon() function splitted
The function getnameforicon() is splitted in two:
getnameforicon + get_cached_pixmap_folder
to do a better understanding and clean code.
diff --git a/src/icon.c b/src/icon.c
index e8382bb..98df353 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -398,30 +398,14 @@ Bool wIconChangeImageFile(WIcon * icon, char *file)
return !error;
}
-static char *getnameforicon(WWindow * wwin)
+/* This function returns the user folder for cached pixmaps */
+static char * get_cached_pixmap_folder(void)
{
- char *prefix, *suffix;
- char *path;
+ char *prefix, *path;
int len;
- if (wwin->wm_class && wwin->wm_instance) {
- int len = strlen(wwin->wm_class) + strlen(wwin->wm_instance) +
2;
- suffix = wmalloc(len);
- snprintf(suffix, len, "%s.%s", wwin->wm_instance,
wwin->wm_class);
- } else if (wwin->wm_class) {
- int len = strlen(wwin->wm_class) + 1;
- suffix = wmalloc(len);
- snprintf(suffix, len, "%s", wwin->wm_class);
- } else if (wwin->wm_instance) {
- int len = strlen(wwin->wm_instance) + 1;
- suffix = wmalloc(len);
- snprintf(suffix, len, "%s", wwin->wm_instance);
- } else {
- return NULL;
- }
-
prefix = wusergnusteppath();
- len = strlen(prefix) + 64 + strlen(suffix);
+ len = strlen(prefix) + 64;
path = wmalloc(len + 1);
snprintf(path, len, "%s/Library/WindowMaker", prefix);
@@ -429,23 +413,41 @@ static char *getnameforicon(WWindow * wwin)
if (mkdir(path, S_IRUSR | S_IWUSR | S_IXUSR)) {
werror(_("could not create directory %s"), path);
wfree(path);
- wfree(suffix);
return NULL;
}
}
+
strcat(path, "/CachedPixmaps");
if (access(path, F_OK) != 0) {
if (mkdir(path, S_IRUSR | S_IWUSR | S_IXUSR) != 0) {
werror(_("could not create directory %s"), path);
wfree(path);
- wfree(suffix);
return NULL;
}
}
- strcat(path, "/");
- strcat(path, suffix);
- strcat(path, ".xpm");
+ return path;
+}
+
+static char *getnameforicon(WWindow * wwin)
+{
+ char *prefix, *suffix, *path;
+ int len;
+
+ if (!wwin->wm_class && !wwin->wm_instance)
+ return NULL;
+
+ prefix = get_cached_pixmap_folder();
+ if (!prefix)
+ return NULL;
+
+ suffix = StrConcatDot(wwin->wm_instance, wwin->wm_class, False);
+
+ len = strlen(prefix) + strlen(suffix) + 6;
+ path = wmalloc(len);
+ snprintf(path, len, "%s/%s.xpm", prefix, suffix);
+
+ wfree(prefix);
wfree(suffix);
return path;
http://repo.or.cz/w/wmaker-crm.git/commit/21fb6db616f0098cc599968cb0742b7436a4c6b5
commit 21fb6db616f0098cc599968cb0742b7436a4c6b5
Author: Rodolfo GarcÃa Peñas (kix) <[email protected]>
Date: Sat Apr 14 13:31:09 2012 +0200
WindowMaker: New function wIconCreateCore()
The new function wIconCreateCore do the common work to create a WIcon.
This code was before in wIconCreateWithIconFile() and
wIconCreateWithIconFile().
diff --git a/src/icon.c b/src/icon.c
index d7fd3cd..e8382bb 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -56,6 +56,8 @@ static void miniwindowExpose(WObjDescriptor * desc, XEvent *
event);
static void miniwindowMouseDown(WObjDescriptor * desc, XEvent * event);
static void miniwindowDblClick(WObjDescriptor * desc, XEvent * event);
+static WIcon *wIconCreateCore(WScreen *scr, int coord_x, int coord_y);
+
void get_pixmap_icon_from_icon_win(WIcon *icon);
int get_pixmap_icon_from_wm_hints(WScreen *scr, WWindow *wwin, WIcon *icon);
void get_pixmap_icon_from_user_icon(WScreen *scr, WIcon * icon);
@@ -110,35 +112,8 @@ WIcon *wIconCreate(WWindow * wwin)
WScreen *scr = wwin->screen_ptr;
WIcon *icon;
char *file;
- unsigned long vmask = 0;
- XSetWindowAttributes attribs;
-
- icon = wmalloc(sizeof(WIcon));
- memset(icon, 0, sizeof(WIcon));
- icon->core = wCoreCreateTopLevel(scr, wwin->icon_x, wwin->icon_y,
- wPreferences.icon_size,
wPreferences.icon_size, 0);
-
- if (wPreferences.use_saveunders) {
- vmask |= CWSaveUnder;
- attribs.save_under = True;
- }
- /* a white border for selecting it */
- vmask |= CWBorderPixel;
- attribs.border_pixel = scr->white_pixel;
- XChangeWindowAttributes(dpy, icon->core->window, vmask, &attribs);
-
- /* will be overriden if this is an application icon */
- icon->core->descriptor.handle_mousedown = miniwindowMouseDown;
- icon->core->descriptor.handle_expose = miniwindowExpose;
- icon->core->descriptor.parent_type = WCLASS_MINIWINDOW;
- icon->core->descriptor.parent = icon;
-
- icon->core->stacking = wmalloc(sizeof(WStacking));
- icon->core->stacking->above = NULL;
- icon->core->stacking->under = NULL;
- icon->core->stacking->window_level = NORMAL_ICON_LEVEL;
- icon->core->stacking->child_of = NULL;
+ icon = wIconCreateCore(scr, wwin->icon_x, wwin->icon_y);
icon->owner = wwin;
if (wwin->wm_hints && (wwin->wm_hints->flags & IconWindowHint)) {
@@ -183,16 +158,50 @@ WIcon *wIconCreate(WWindow * wwin)
WIcon *wIconCreateWithIconFile(WScreen * scr, char *iconfile, int tile)
{
WIcon *icon;
+
+ icon = wIconCreateCore(scr, 0, 0);
+
+ if (iconfile) {
+ icon->file_image = RLoadImage(scr->rcontext, iconfile, 0);
+ if (!icon->file_image) {
+ wwarning(_("error loading image file "%s": %s"),
iconfile, RMessageForError(RErrorCode));
+ }
+
+ icon->file_image = wIconValidateIconSize(scr, icon->file_image,
wPreferences.icon_size);
+
+ icon->file = wstrdup(iconfile);
+ }
+
+ icon->tile_type = tile;
+
+ wIconUpdate(icon);
+
+ WMAddNotificationObserver(appearanceObserver, icon,
WNIconAppearanceSettingsChanged, icon);
+ WMAddNotificationObserver(tileObserver, icon,
WNIconTileSettingsChanged, icon);
+
+ return icon;
+}
+
+static WIcon *wIconCreateCore(WScreen *scr, int coord_x, int coord_y)
+{
+ WIcon *icon;
unsigned long vmask = 0;
XSetWindowAttributes attribs;
icon = wmalloc(sizeof(WIcon));
memset(icon, 0, sizeof(WIcon));
- icon->core = wCoreCreateTopLevel(scr, 0, 0, wPreferences.icon_size,
wPreferences.icon_size, 0);
+ icon->core = wCoreCreateTopLevel(scr,
+ coord_x,
+ coord_y,
+ wPreferences.icon_size,
+ wPreferences.icon_size,
+ 0);
+
if (wPreferences.use_saveunders) {
vmask = CWSaveUnder;
attribs.save_under = True;
}
+
/* a white border for selecting it */
vmask |= CWBorderPixel;
attribs.border_pixel = scr->white_pixel;
@@ -211,24 +220,6 @@ WIcon *wIconCreateWithIconFile(WScreen * scr, char
*iconfile, int tile)
icon->core->stacking->window_level = NORMAL_ICON_LEVEL;
icon->core->stacking->child_of = NULL;
- if (iconfile) {
- icon->file_image = RLoadImage(scr->rcontext, iconfile, 0);
- if (!icon->file_image) {
- wwarning(_("error loading image file "%s": %s"),
iconfile, RMessageForError(RErrorCode));
- }
-
- icon->file_image = wIconValidateIconSize(scr, icon->file_image,
wPreferences.icon_size);
-
- icon->file = wstrdup(iconfile);
- }
-
- icon->tile_type = tile;
-
- wIconUpdate(icon);
-
- WMAddNotificationObserver(appearanceObserver, icon,
WNIconAppearanceSettingsChanged, icon);
- WMAddNotificationObserver(tileObserver, icon,
WNIconTileSettingsChanged, icon);
-
return icon;
}
http://repo.or.cz/w/wmaker-crm.git/commit/219315aa58ab2d4742d0893eaccaac9c027305c2
commit 219315aa58ab2d4742d0893eaccaac9c027305c2
Author: Rodolfo GarcÃa Peñas (kix) <[email protected]>
Date: Sat Apr 14 12:11:34 2012 +0200
WindowMaker: Check iconPath variable only if needed
The variable iconPath should only checked inside the if block,
because outside is never initialized.
diff --git a/src/application.c b/src/application.c
index 0b82078..584c0aa 100644
--- a/src/application.c
+++ b/src/application.c
@@ -185,9 +185,9 @@ void wApplicationSaveIconPathFor(char *iconPath, char
*wm_instance, char *wm_cla
void wApplicationExtractDirPackIcon(WScreen * scr, char *path, char
*wm_instance, char *wm_class)
{
char *iconPath = NULL;
- if (strstr(path, ".app")) {
- char *tmp;
+ char *tmp = NULL;
+ if (strstr(path, ".app")) {
tmp = wmalloc(strlen(path) + 16);
if (scr->flags.supports_tiff) {
@@ -206,11 +206,11 @@ void wApplicationExtractDirPackIcon(WScreen * scr, char
*path, char *wm_instance
if (!iconPath)
wfree(tmp);
- }
- if (iconPath) {
- wApplicationSaveIconPathFor(iconPath, wm_instance, wm_class);
- wfree(iconPath);
+ if (iconPath) {
+ wApplicationSaveIconPathFor(iconPath, wm_instance,
wm_class);
+ wfree(iconPath);
+ }
}
}
http://repo.or.cz/w/wmaker-crm.git/commit/ad373ef0ddb27802237df191d039ceeb8e14b35d
commit ad373ef0ddb27802237df191d039ceeb8e14b35d
Author: Rodolfo GarcÃa Peñas (kix) <[email protected]>
Date: Sat Apr 14 11:53:43 2012 +0200
WindowMaker: New function wGetWorkspaceNumber
The new function wGetWorkspaceNumber returns the workspace number
for a given workspace name.
The code of this function is already used in session.c and wdefaults.c
and now is moved to workspace.c
In wSessionRestoreLastWorkspace the char value is checked before
calling the function, because without string, the function don't do
nothing.
diff --git a/src/session.c b/src/session.c
index 8ae5fb8..2d020c7 100644
--- a/src/session.c
+++ b/src/session.c
@@ -518,8 +518,8 @@ void wSessionRestoreState(WScreen * scr)
void wSessionRestoreLastWorkspace(WScreen * scr)
{
WMPropList *wks;
- int w, i;
- char *tmp;
+ int w;
+ char *value;
make_keys();
@@ -532,23 +532,18 @@ void wSessionRestoreLastWorkspace(WScreen * scr)
if (!wks || !WMIsPLString(wks))
return;
- tmp = WMGetFromPLString(wks);
+ value = WMGetFromPLString(wks);
+ if (!value)
+ return;
/* clean up */
WMPLSetCaseSensitive(False);
- if (sscanf(tmp, "%i", &w) != 1) {
- w = -1;
- for (i = 0; i < scr->workspace_count; i++) {
- if (strcmp(scr->workspaces[i]->name, tmp) == 0) {
- w = i;
- break;
- }
- }
- } else {
- w--;
- }
+ /* Get the workspace number for the workspace name */
+ w = wGetWorkspaceNumber(scr, value);
+
+ wfree(value);
if (w != scr->current_workspace && w < scr->workspace_count)
wWorkspaceChange(scr, w);
diff --git a/src/wdefaults.c b/src/wdefaults.c
index c22ad5b..d89671b 100644
--- a/src/wdefaults.c
+++ b/src/wdefaults.c
@@ -433,7 +433,7 @@ RImage *wDefaultGetImage(WScreen * scr, char *winstance,
char *wclass, int max_s
int wDefaultGetStartWorkspace(WScreen * scr, char *instance, char *class)
{
WMPropList *value;
- int w, i;
+ int w;
char *tmp;
if (!ANoTitlebar)
@@ -452,17 +452,10 @@ int wDefaultGetStartWorkspace(WScreen * scr, char
*instance, char *class)
if (!tmp || strlen(tmp) == 0)
return -1;
- if (sscanf(tmp, "%i", &w) != 1) {
- w = -1;
- for (i = 0; i < scr->workspace_count; i++) {
- if (strcmp(scr->workspaces[i]->name, tmp) == 0) {
- w = i;
- break;
- }
- }
- } else {
- w--;
- }
+ /* Get the workspace number for the workspace name */
+ w = wGetWorkspaceNumber(scr, tmp);
+
+ wfree(value);
return w;
}
diff --git a/src/workspace.c b/src/workspace.c
index dc53d03..7702d12 100644
--- a/src/workspace.c
+++ b/src/workspace.c
@@ -877,3 +877,23 @@ void wWorkspaceRestoreState(WScreen * scr)
WMPostNotificationName(WMNWorkspaceNameChanged, scr, (void
*)(uintptr_t) i);
}
}
+
+/* Returns the workspace number for a given workspace name */
+int wGetWorkspaceNumber(WScreen * scr, char * value)
+{
+ int w, i;
+
+ if (sscanf(value, "%i", &w) != 1) {
+ w = -1;
+ for (i = 0; i < scr->workspace_count; i++) {
+ if (strcmp(scr->workspaces[i]->name, value) == 0) {
+ w = i;
+ break;
+ }
+ }
+ } else {
+ w--;
+ }
+
+ return w;
+}
diff --git a/src/workspace.h b/src/workspace.h
index 3dad8e7..e28c5c2 100644
--- a/src/workspace.h
+++ b/src/workspace.h
@@ -31,6 +31,7 @@ typedef struct WWorkspace {
void wWorkspaceMake(WScreen *scr, int count);
int wWorkspaceNew(WScreen *scr);
+int wGetWorkspaceNumber(WScreen * scr, char * value);
Bool wWorkspaceDelete(WScreen *scr, int workspace);
void wWorkspaceChange(WScreen *scr, int workspace);
void wWorkspaceForceChange(WScreen *scr, int workspace);
http://repo.or.cz/w/wmaker-crm.git/commit/761fd37e5172b245d98a3cc2c459b7e559d0bc02
commit 761fd37e5172b245d98a3cc2c459b7e559d0bc02
Author: Rodolfo GarcÃa Peñas (kix) <[email protected]>
Date: Sat Apr 14 10:53:12 2012 +0200
WindowMaker: Clean curly brackets
This patch removes the unneeded curly brackets in multiple files.
It also add some comments in the code. In usermenu.c removes some
variables not used.
diff --git a/src/application.c b/src/application.c
index 8a1e3bb..0b82078 100644
--- a/src/application.c
+++ b/src/application.c
@@ -114,8 +114,10 @@ static void extractIcon(WWindow * wwin)
{
char *progname;
+ /* Get the application name */
progname = GetProgramNameForWindow(wwin->client_win);
if (progname) {
+ /* Save the icon path if the application is ".app" */
wApplicationExtractDirPackIcon(wwin->screen_ptr, progname,
wwin->wm_instance, wwin->wm_class);
wfree(progname);
}
@@ -148,8 +150,8 @@ void wApplicationSaveIconPathFor(char *iconPath, char
*wm_instance, char *wm_cla
key = WMCreatePLString(tmp);
wfree(tmp);
- adict = WMGetFromPLDictionary(dict, key);
+ adict = WMGetFromPLDictionary(dict, key);
iconk = WMCreatePLString("Icon");
if (adict) {
@@ -161,6 +163,7 @@ void wApplicationSaveIconPathFor(char *iconPath, char
*wm_instance, char *wm_cla
WMReleasePropList(adict);
val = NULL;
}
+
if (!val) {
val = WMCreatePLString(iconPath);
WMPutInPLDictionary(adict, iconk, val);
@@ -168,20 +171,20 @@ void wApplicationSaveIconPathFor(char *iconPath, char
*wm_instance, char *wm_cla
} else {
val = NULL;
}
+
WMReleasePropList(key);
WMReleasePropList(iconk);
- if (val && !wPreferences.flags.noupdates) {
+ if (val && !wPreferences.flags.noupdates)
UpdateDomainFile(WDWindowAttributes);
- }
}
+/* 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
+ */
void wApplicationExtractDirPackIcon(WScreen * scr, char *path, char
*wm_instance, char *wm_class)
{
char *iconPath = NULL;
- /* Maybe the app is a .app and it has an icon in it, like
- * /usr/local/GNUstep/Applications/WPrefs.app/WPrefs.tiff
- */
if (strstr(path, ".app")) {
char *tmp;
diff --git a/src/defaults.c b/src/defaults.c
index 793d1d5..6983275 100644
--- a/src/defaults.c
+++ b/src/defaults.c
@@ -906,10 +906,12 @@ void wDefaultsCheckDomains(void* arg)
if (stat(WDWindowMaker->path, &stbuf) >= 0 && WDWindowMaker->timestamp
< stbuf.st_mtime) {
WDWindowMaker->timestamp = stbuf.st_mtime;
- /* global dictionary */
+ /* Global dictionary */
shared_dict = readGlobalDomain("WindowMaker", True);
- /* user dictionary */
+
+ /* User dictionary */
dict = WMReadPropListFromFile(WDWindowMaker->path);
+
if (dict) {
if (!WMIsPLDictionary(dict)) {
WMReleasePropList(dict);
@@ -923,22 +925,25 @@ void wDefaultsCheckDomains(void* arg)
dict = shared_dict;
shared_dict = NULL;
}
+
for (i = 0; i < wScreenCount; i++) {
scr = wScreenWithNumber(i);
if (scr)
wReadDefaults(scr, dict);
}
- if (WDWindowMaker->dictionary) {
+
+ if (WDWindowMaker->dictionary)
WMReleasePropList(WDWindowMaker->dictionary);
- }
+
WDWindowMaker->dictionary = dict;
}
} else {
wwarning(_("could not load domain %s from user defaults
database"), "WindowMaker");
}
- if (shared_dict) {
+
+ if (shared_dict)
WMReleasePropList(shared_dict);
- }
+
}
if (stat(WDWindowAttributes->path, &stbuf) >= 0 &&
WDWindowAttributes->timestamp < stbuf.st_mtime) {
@@ -1051,9 +1056,9 @@ void wReadDefaults(WScreen * scr, WMPropList * new_dict)
if (!plvalue && !old_value) {
/* no default in the DB. Use builtin default */
plvalue = entry->plvalue;
- if (plvalue && new_dict) {
+ if (plvalue && new_dict)
WMPutInPLDictionary(new_dict, entry->plkey,
plvalue);
- }
+
} else if (!plvalue) {
/* value was deleted from DB. Keep current value */
continue;
@@ -1062,7 +1067,6 @@ void wReadDefaults(WScreen * scr, WMPropList * new_dict)
} else if (!WMIsPropListEqualTo(plvalue, old_value)) {
/* value has changed */
} else {
-
if (strcmp(entry->key, "WorkspaceBack") == 0
&& update_workspace_back &&
scr->flags.backimage_helper_launched) {
} else {
@@ -1080,13 +1084,13 @@ void wReadDefaults(WScreen * scr, WMPropList * new_dict)
* sure to send the default background texture
config
* to the helper.
*/
- if (strcmp(entry->key, "WorkspaceSpecificBack")
== 0
- && !scr->flags.backimage_helper_launched) {
+ if (strcmp(entry->key, "WorkspaceSpecificBack")
== 0 &&
+ !scr->flags.backimage_helper_launched)
update_workspace_back = 1;
- }
- if (entry->update) {
+
+ if (entry->update)
needs_refresh |= (*entry->update) (scr,
entry, tdata, entry->extra_data);
- }
+
}
}
}
@@ -1116,29 +1120,23 @@ void wReadDefaults(WScreen * scr, WMPropList * new_dict)
WMPostNotificationName(WNMenuAppearanceSettingsChanged,
NULL, (void *)(uintptr_t) foo);
foo = 0;
- if (needs_refresh & REFRESH_WINDOW_FONT) {
+ if (needs_refresh & REFRESH_WINDOW_FONT)
foo |= WFontSettings;
- }
- if (needs_refresh & REFRESH_WINDOW_TEXTURES) {
+ if (needs_refresh & REFRESH_WINDOW_TEXTURES)
foo |= WTextureSettings;
- }
- if (needs_refresh & REFRESH_WINDOW_TITLE_COLOR) {
+ if (needs_refresh & REFRESH_WINDOW_TITLE_COLOR)
foo |= WColorSettings;
- }
if (foo)
WMPostNotificationName(WNWindowAppearanceSettingsChanged, NULL, (void
*)(uintptr_t) foo);
if (!(needs_refresh & REFRESH_ICON_TILE)) {
foo = 0;
- if (needs_refresh & REFRESH_ICON_FONT) {
+ if (needs_refresh & REFRESH_ICON_FONT)
foo |= WFontSettings;
- }
- if (needs_refresh & REFRESH_ICON_TITLE_COLOR) {
+ if (needs_refresh & REFRESH_ICON_TITLE_COLOR)
foo |= WTextureSettings;
- }
- if (needs_refresh & REFRESH_ICON_TITLE_BACK) {
+ if (needs_refresh & REFRESH_ICON_TITLE_BACK)
foo |= WTextureSettings;
- }
if (foo)
WMPostNotificationName(WNIconAppearanceSettingsChanged, NULL,
(void *)(uintptr_t) foo);
diff --git a/src/main.c b/src/main.c
index 36f5a1e..431d41b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -574,9 +574,9 @@ static void execInitScript()
wfree(paths);
if (file) {
- if (system(file) != 0) {
+ if (system(file) != 0)
werror(_("%s:could not execute initialization script"),
file);
- }
+
wfree(file);
}
}
@@ -592,9 +592,9 @@ void ExecExitScript()
wfree(paths);
if (file) {
- if (system(file) != 0) {
+ if (system(file) != 0)
werror(_("%s:could not execute exit script"), file);
- }
+
wfree(file);
}
}
diff --git a/src/misc.c b/src/misc.c
index 3381c2a..fd283c2 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -407,9 +407,8 @@ char *FindImage(char *paths, char *file)
path = wfindfile(paths, file);
*tmp = ':';
}
- if (!tmp || !path) {
+ if (!tmp || !path)
path = wfindfile(paths, file);
- }
return path;
}
diff --git a/src/rootmenu.c b/src/rootmenu.c
index 9183380..b2b28ce 100644
--- a/src/rootmenu.c
+++ b/src/rootmenu.c
@@ -296,7 +296,7 @@ static void legalPanelCommand(WMenu * menu, WMenuEntry *
entry)
/********************************************************************/
-static char *getLocalizedMenuFile(char *menu)
+static char * getLocalizedMenuFile(char *menu)
{
char *buffer, *ptr, *locale;
int len;
@@ -309,9 +309,8 @@ static char *getLocalizedMenuFile(char *menu)
/* try menu.locale_name */
snprintf(buffer, len, "%s.%s", menu, Locale);
- if (access(buffer, F_OK) == 0) {
+ if (access(buffer, F_OK) == 0)
return buffer;
- }
/* position of locale in our buffer */
locale = buffer + strlen(menu) + 1;
@@ -320,17 +319,16 @@ static char *getLocalizedMenuFile(char *menu)
ptr = strchr(locale, '.');
if (ptr) {
*ptr = 0;
- if (access(buffer, F_OK) == 0) {
+ if (access(buffer, F_OK) == 0)
return buffer;
- }
}
+
/* now check for aa */
ptr = strchr(locale, '_');
if (ptr) {
*ptr = 0;
- if (access(buffer, F_OK) == 0) {
+ if (access(buffer, F_OK) == 0)
return buffer;
- }
}
wfree(buffer);
diff --git a/src/session.c b/src/session.c
index a2795a3..8ae5fb8 100644
--- a/src/session.c
+++ b/src/session.c
@@ -214,9 +214,8 @@ static WMPropList *makeWindowState(WWindow * wwin,
WApplication * wapp)
for (mask = 0, i = 0; i < MAX_WINDOW_SHORTCUTS; i++) {
if (scr->shortcutWindows[i] != NULL &&
- WMGetFirstInArray(scr->shortcutWindows[i], wwin) !=
WANotFound) {
+ WMGetFirstInArray(scr->shortcutWindows[i], wwin) !=
WANotFound)
mask |= 1 << i;
- }
}
snprintf(buffer, sizeof(buffer), "%u", mask);
@@ -535,6 +534,7 @@ void wSessionRestoreLastWorkspace(WScreen * scr)
tmp = WMGetFromPLString(wks);
+
/* clean up */
WMPLSetCaseSensitive(False);
@@ -550,7 +550,6 @@ void wSessionRestoreLastWorkspace(WScreen * scr)
w--;
}
- if (w != scr->current_workspace && w < scr->workspace_count) {
+ if (w != scr->current_workspace && w < scr->workspace_count)
wWorkspaceChange(scr, w);
- }
}
diff --git a/src/startup.c b/src/startup.c
index 149147c..190cd92 100644
--- a/src/startup.c
+++ b/src/startup.c
@@ -540,9 +540,8 @@ void StartUp(Bool defaultScreenOnly)
{
int i;
- for (i = 0; i < sizeof(atomNames) / sizeof(char *); i++) {
+ for (i = 0; i < sizeof(atomNames) / sizeof(char *); i++)
atom[i] = XInternAtom(dpy, atomNames[i], False);
- }
}
#endif
@@ -591,17 +590,17 @@ void StartUp(Bool defaultScreenOnly)
wCursor[WCUR_QUESTION] = XCreateFontCursor(dpy, XC_question_arrow);
wCursor[WCUR_TEXT] = XCreateFontCursor(dpy, XC_xterm); /* odd name???
*/
wCursor[WCUR_SELECT] = XCreateFontCursor(dpy, XC_cross);
- {
- Pixmap cur = XCreatePixmap(dpy, DefaultRootWindow(dpy), 16, 16,
1);
- GC gc = XCreateGC(dpy, cur, 0, NULL);
- XColor black;
- memset(&black, 0, sizeof(XColor));
- XSetForeground(dpy, gc, 0);
- XFillRectangle(dpy, cur, gc, 0, 0, 16, 16);
- XFreeGC(dpy, gc);
- wCursor[WCUR_EMPTY] = XCreatePixmapCursor(dpy, cur, cur,
&black, &black, 0, 0);
- XFreePixmap(dpy, cur);
- }
+
+ Pixmap cur = XCreatePixmap(dpy, DefaultRootWindow(dpy), 16, 16, 1);
+ GC gc = XCreateGC(dpy, cur, 0, NULL);
+ XColor black;
+ memset(&black, 0, sizeof(XColor));
+ XSetForeground(dpy, gc, 0);
+ XFillRectangle(dpy, cur, gc, 0, 0, 16, 16);
+ XFreeGC(dpy, gc);
+ wCursor[WCUR_EMPTY] = XCreatePixmapCursor(dpy, cur, cur, &black,
&black, 0, 0);
+ XFreePixmap(dpy, cur);
+
#ifndef HAVE_INOTIFY
/* signal handler stuff that gets called when a signal is caught */
@@ -668,9 +667,8 @@ void StartUp(Bool defaultScreenOnly)
/* initialize defaults stuff */
WDWindowMaker = wDefaultsInitDomain("WindowMaker", True);
- if (!WDWindowMaker->dictionary) {
+ if (!WDWindowMaker->dictionary)
wwarning(_("could not read domain "%s" from defaults
database"), "WindowMaker");
- }
/* read defaults that don't change until a restart and are
* screen independent */
@@ -685,15 +683,14 @@ void StartUp(Bool defaultScreenOnly)
/* init other domains */
WDRootMenu = wDefaultsInitDomain("WMRootMenu", False);
- if (!WDRootMenu->dictionary) {
+ if (!WDRootMenu->dictionary)
wwarning(_("could not read domain "%s" from defaults
database"), "WMRootMenu");
- }
+
wDefaultsMergeGlobalMenus(WDRootMenu);
WDWindowAttributes = wDefaultsInitDomain("WMWindowAttributes", True);
- if (!WDWindowAttributes->dictionary) {
+ if (!WDWindowAttributes->dictionary)
wwarning(_("could not read domain "%s" from defaults
database"), "WMWindowAttributes");
- }
XSetErrorHandler((XErrorHandler) catchXError);
@@ -714,11 +711,11 @@ void StartUp(Bool defaultScreenOnly)
}
#endif
- if (defaultScreenOnly) {
+ if (defaultScreenOnly)
max = 1;
- } else {
+ else
max = ScreenCount(dpy);
- }
+
wScreen = wmalloc(sizeof(WScreen *) * max);
wScreenCount = 0;
@@ -783,11 +780,10 @@ void StartUp(Bool defaultScreenOnly)
}
/* go to workspace where we were before restart */
- if (lastDesktop >= 0) {
+ if (lastDesktop >= 0)
wWorkspaceForceChange(wScreen[j], lastDesktop);
- } else {
+ else
wSessionRestoreLastWorkspace(wScreen[j]);
- }
}
if (wScreenCount == 0) {
@@ -796,10 +792,9 @@ void StartUp(Bool defaultScreenOnly)
}
#ifndef HAVE_INOTIFY
- if (!wPreferences.flags.nopolling && !wPreferences.flags.noupdates) {
- /* setup defaults file polling */
+ /* setup defaults file polling */
+ if (!wPreferences.flags.nopolling && !wPreferences.flags.noupdates)
WMAddTimerHandler(3000, wDefaultsCheckDomains, NULL);
- }
#endif
}
diff --git a/src/usermenu.c b/src/usermenu.c
index 49473c8..e0acc57 100644
--- a/src/usermenu.c
+++ b/src/usermenu.c
@@ -125,6 +125,7 @@ static void removeUserMenudata(void *menudata)
WUserMenuData *data = menudata;
if (data->key)
wfree(data->key);
+
wfree(data);
}
@@ -132,22 +133,21 @@ static WUserMenuData *convertShortcuts(WScreen * scr,
WMPropList * shortcut)
{
WUserMenuData *data;
KeySym ksym;
- char *k;
- char *buffer;
- char buf[MAX_SHORTCUT_LENGTH], *b;
+ char *k, *buffer, buf[MAX_SHORTCUT_LENGTH], *b;
int keycount, i, j, mod;
if (WMIsPLString(shortcut)) {
keycount = 1;
} else if (WMIsPLArray(shortcut)) {
keycount = WMGetPropListItemCount(shortcut);
- } else
+ } else {
return NULL;
- /*for (i=0;i<keycount;i++){ */
+ }
data = wmalloc(sizeof(WUserMenuData));
if (!data)
return NULL;
+
data->key = wmalloc(sizeof(WShortKey) * keycount);
if (!data->key) {
wfree(data);
@@ -156,32 +156,30 @@ static WUserMenuData *convertShortcuts(WScreen * scr,
WMPropList * shortcut)
for (i = 0, j = 0; i < keycount; i++) {
data->key[j].modifier = 0;
- if (WMIsPLArray(shortcut)) {
+ if (WMIsPLArray(shortcut))
wstrlcpy(buf,
WMGetFromPLString(WMGetFromPLArray(shortcut, i)), MAX_SHORTCUT_LENGTH);
- } else {
+ else
wstrlcpy(buf, WMGetFromPLString(shortcut),
MAX_SHORTCUT_LENGTH);
- }
+
b = (char *)buf;
while ((k = strchr(b, '+')) != NULL) {
*k = 0;
mod = wXModifierFromKey(b);
- if (mod < 0) {
+ if (mod < 0)
break;
- }
+
data->key[j].modifier |= mod;
b = k + 1;
}
ksym = XStringToKeysym(b);
- if (ksym == NoSymbol) {
+ if (ksym == NoSymbol)
continue;
- }
data->key[j].keycode = XKeysymToKeycode(dpy, ksym);
- if (data->key[j].keycode) {
+ if (data->key[j].keycode)
j++;
- }
}
keyover:
@@ -209,18 +207,17 @@ static WMenu *configureUserMenu(WScreen * scr, WMPropList
* plum)
if (!plum)
return NULL;
- if (!WMIsPLArray(plum)) {
+
+ if (!WMIsPLArray(plum))
return NULL;
- }
count = WMGetPropListItemCount(plum);
if (!count)
return NULL;
elem = WMGetFromPLArray(plum, 0);
- if (!WMIsPLString(elem)) {
+ if (!WMIsPLString(elem))
return NULL;
- }
mtitle = WMGetFromPLString(elem);
@@ -257,10 +254,10 @@ static WMenu *configureUserMenu(WScreen * scr, WMPropList
* plum)
notifyClient,
data);
if (entry) {
- if (WMIsPLString(params)) {
+ if (WMIsPLString(params))
entry->rtext =
GetShortcutString(WMGetFromPLString(params));
- }
+
entry->free_cdata =
removeUserMenudata;
if
(WMGetPropListItemCount(elem) >= 4) {
@@ -323,14 +320,11 @@ void wUserMenuRefreshInstances(WMenu * menu, WWindow *
wwin)
static WMenu *readUserMenuFile(WScreen * scr, char *file_name)
{
- WMenu *menu;
- char *mtitle;
- WMPropList *plum, *elem, *title, *command, *params;
- int count, i;
+ WMenu *menu = NULL;
+ WMPropList *plum;
- menu = NULL;
plum = WMReadPropListFromFile(file_name);
- /**/ if (plum) {
+ if (plum) {
menu = configureUserMenu(scr, plum);
WMReleasePropList(plum);
}
@@ -353,9 +347,8 @@ WMenu *wUserMenuGet(WScreen * scr, WWindow * wwin)
if (!path)
return NULL;
- if (wwin) {
+ if (wwin)
menu = readUserMenuFile(scr, path);
- }
wfree(path);
}
diff --git a/src/window.c b/src/window.c
index d6a2a1b..f05be9e 100644
--- a/src/window.c
+++ b/src/window.c
@@ -786,10 +786,10 @@ WWindow *wManageWindow(WScreen *scr, Window window)
index = WMFindInArray(scr->fakeGroupLeaders, matchIdentifier,
(void *)buffer);
if (index != WANotFound) {
fPtr = WMGetFromArray(scr->fakeGroupLeaders, index);
- if (fPtr->retainCount == 0) {
+ if (fPtr->retainCount == 0)
fPtr->leader = createFakeWindowGroupLeader(scr,
wwin->main_window,
instance, class);
- }
+
fPtr->retainCount++;
if (fPtr->origLeader == None) {
if (ADEQUATE(wwin->main_window)) {
diff --git a/src/winspector.c b/src/winspector.c
index adaf8b7..37ae0b2 100644
--- a/src/winspector.c
+++ b/src/winspector.c
@@ -648,9 +648,8 @@ static void saveSettings(WMButton * button, InspectorPanel
* panel)
different |= different2;
} else {
WMRemoveFromPLDictionary(dict, key2);
- if (different2) {
+ if (different2)
WMPutInPLDictionary(dict, key2, appDic);
- }
}
WMReleasePropList(key2);
WMReleasePropList(appDic);
@@ -1053,11 +1052,10 @@ static void selectSpecification(WMWidget * bPtr, void
*data)
WWindow *wwin = panel->inspected;
int len;
- if (bPtr == panel->defaultRb && (wwin->wm_instance || wwin->wm_class)) {
+ if (bPtr == panel->defaultRb && (wwin->wm_instance || wwin->wm_class))
WMSetButtonEnabled(panel->applyBtn, False);
- } else {
+ else
WMSetButtonEnabled(panel->applyBtn, True);
- }
len = 16 + strlen(wwin->wm_instance ? wwin->wm_instance : "?")
+ strlen(wwin->wm_class ? wwin->wm_class : "?");
http://repo.or.cz/w/wmaker-crm.git/commit/afe2e5d9d6ba5ee8945aae703440d22f4c22b0b9
commit afe2e5d9d6ba5ee8945aae703440d22f4c22b0b9
Author: Rodolfo GarcÃa Peñas (kix) <[email protected]>
Date: Sat Apr 14 01:52:40 2012 +0200
WindowMaker: appicon.h clean code
Changes to appicon.h:
- Spaces replaced by tabs in the struct
- Removed unused variables:
- client_machine, never assigned
- gnustep_app, never used
- Functions sort by return type
Then, in dock.c, the block with client_machine is never true,
then can be removed. The host variable then is never used.
diff --git a/src/appicon.h b/src/appicon.h
index f10f847..c8a96dc 100644
--- a/src/appicon.h
+++ b/src/appicon.h
@@ -29,73 +29,53 @@
#include "icon.h"
#include "application.h"
-
typedef struct WAppIcon {
- short xindex;
- short yindex;
- struct WAppIcon *next;
- struct WAppIcon *prev;
- WIcon *icon;
-
- char *client_machine;
-
- int x_pos, y_pos; /* absolute screen coordinate */
-
- char *command; /* command used to launch app */
-
+ short xindex;
+ short yindex;
+ struct WAppIcon *next;
+ struct WAppIcon *prev;
+ WIcon *icon;
+ int x_pos, y_pos; /* absolute screen coordinate */
+ char *command; /* command used to launch app */
#ifdef XDND
- char *dnd_command; /* command to use when something is */
- /* dropped on us */
+ char *dnd_command; /* command to use when something is */
+ /* dropped on us */
#endif
-
- char *paste_command; /* command to run when something is
pasted */
-
- char *wm_class;
- char *wm_instance;
- pid_t pid; /* for apps launched from the dock */
- Window main_window;
-
- struct WDock *dock; /* In which dock is docked. */
-
- struct _AppSettingsPanel *panel; /* Settings Panel */
-
- unsigned int gnustep_app:1; /* if this is a GNUstep
application */
- unsigned int docked:1;
- unsigned int omnipresent:1; /* If omnipresent when docked in clip */
- unsigned int attracted:1; /* If it was attracted by the clip */
- unsigned int launching:1;
- unsigned int running:1; /* application is already running */
- unsigned int relaunching:1; /* launching 2nd instance */
-
- unsigned int forced_dock:1;
- unsigned int auto_launch:1; /* launch app on startup */
- unsigned int remote_start:1;
- unsigned int updated:1;
- unsigned int editing:1; /* editing docked icon */
- unsigned int drop_launch:1; /* launching from drop action */
- unsigned int paste_launch:1; /* launching from paste action */
- unsigned int destroyed:1; /* appicon was destroyed */
- unsigned int buggy_app:1; /* do not make dock rely on hints
- * set by app */
-
- unsigned int lock:1; /* do not allow to be destroyed */
-
+ char *paste_command; /* command to run when
+ * something is pasted */
+ char *wm_class;
+ char *wm_instance;
+ pid_t pid; /* for apps launched from the dock */
+ Window main_window;
+ struct WDock *dock; /* In which dock is docked. */
+ struct _AppSettingsPanel *panel; /* Settings Panel */
+ unsigned int docked:1;
+ unsigned int omnipresent:1; /* If omnipresent when
+ * docked in clip */
+ unsigned int attracted:1; /* If it was attracted by the clip */
+ unsigned int launching:1;
+ unsigned int running:1; /* application is already running */
+ unsigned int relaunching:1; /* launching 2nd instance */
+ unsigned int forced_dock:1;
+ unsigned int auto_launch:1; /* launch app on startup */
+ unsigned int remote_start:1;
+ unsigned int updated:1;
+ unsigned int editing:1; /* editing docked icon */
+ unsigned int drop_launch:1; /* launching from drop action */
+ unsigned int paste_launch:1; /* launching from paste action */
+ unsigned int destroyed:1; /* appicon was destroyed */
+ unsigned int buggy_app:1; /* do not make dock rely on hints
+ * set by app */
+ 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);
+WAppIcon * wAppIconCreateForDock(WScreen *scr, char *command, char
*wm_instance,
+ char *wm_class, int tile);
void wAppIconDestroy(WAppIcon *aicon);
-
void wAppIconPaint(WAppIcon *aicon);
-
-Bool wAppIconChangeImage(WAppIcon *icon, char *file);
-
void wAppIconMove(WAppIcon *aicon, int x, int y);
-
+Bool wAppIconChangeImage(WAppIcon *icon, char *file);
Bool wAppIconSave(WAppIcon *aicon);
-
#endif
-
diff --git a/src/dock.c b/src/dock.c
index 71bef02..88ea6eb 100644
--- a/src/dock.c
+++ b/src/dock.c
@@ -1183,7 +1183,7 @@ static void dockIconPaint(WAppIcon *btn)
static WMPropList *make_icon_state(WAppIcon *btn)
{
WMPropList *node = NULL;
- WMPropList *command, *autolaunch, *lock, *name, *forced, *host;
+ WMPropList *command, *autolaunch, *lock, *name, *forced;
WMPropList *position, *buggy, *omnipresent;
char *tmp;
char buffer[64];
@@ -1240,12 +1240,6 @@ static WMPropList *make_icon_state(WAppIcon *btn)
WMPutInPLDictionary(node, dPasteCommand, command);
WMReleasePropList(command);
}
-
- if (btn->client_machine && btn->remote_start) {
- host = WMCreatePLString(btn->client_machine);
- WMPutInPLDictionary(node, dHost, host);
- WMReleasePropList(host);
- }
}
return node;
-----------------------------------------------------------------------
Summary of changes:
src/appicon.h | 96 ++++++++++++++----------------------
src/application.c | 27 ++++++-----
src/defaults.c | 50 +++++++++----------
src/dock.c | 8 +---
src/icon.c | 141 ++++++++++++++++++++++++++---------------------------
src/main.c | 8 ++--
src/misc.c | 3 +-
src/rootmenu.c | 12 ++---
src/session.c | 30 +++++-------
src/startup.c | 51 +++++++++-----------
src/usermenu.c | 49 ++++++++-----------
src/wdefaults.c | 17 ++-----
src/window.c | 4 +-
src/winspector.c | 8 +--
src/workspace.c | 20 ++++++++
src/workspace.h | 1 +
16 files changed, 244 insertions(+), 281 deletions(-)
repo.or.cz automatic notification. Contact project admin [email protected]
if you want to unsubscribe, or site admin [email protected] if you receive
no reply.
--
wmaker-crm.git ("The Window Maker window manager")
--
To unsubscribe, send mail to [email protected].