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 fbab31b7985f5ad788cfe115d7d02caac79743d7 (commit)
via dd6a54bba5a301284f5ffca7b14f84ab9ae51711 (commit)
via bd3fb214416a88a672c2674aa47ef202d9c5ceb9 (commit)
via 2e7b039558456b98d8b453a1f61be6a4e03c597e (commit)
via cab8bbc4958ef8d9e4bbfe2c2d9d578e6863e1f1 (commit)
via 01ea1fa8b428d335a39bcafe01548034449a0501 (commit)
via 1c1697dc40470a7dc88f1941965ab70736da1774 (commit)
via 423b78811aa434d8384b99514d95cdbd2a29b67d (commit)
from e498a8bd79403a96dd5b9835b62ce1d1d9116c9f (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/fbab31b7985f5ad788cfe115d7d02caac79743d7
commit fbab31b7985f5ad788cfe115d7d02caac79743d7
Author: Rodolfo GarcÃa Peñas (kix) <[email protected]>
Date: Fri Jun 1 19:06:59 2012 +0200
Coding style cleanup in application.c
Changes to application.c:
- Curly brackets
- Code commented
- Include not used
diff --git a/src/application.c b/src/application.c
index 4f9e6f6..ff4c5d6 100644
--- a/src/application.c
+++ b/src/application.c
@@ -40,14 +40,11 @@
#include "workspace.h"
#include "dock.h"
-#include "xinerama.h"
-
/******** Global variables ********/
extern XContext wAppWinContext;
extern XContext wWinContext;
extern WPreferences wPreferences;
-
extern WDDomain *WDWindowAttributes;
/******** Local variables ********/
@@ -57,19 +54,15 @@ static WWindow *makeMainWindow(WScreen * scr, Window window)
WWindow *wwin;
XWindowAttributes attr;
- if (!XGetWindowAttributes(dpy, window, &attr)) {
+ if (!XGetWindowAttributes(dpy, window, &attr))
return NULL;
- }
wwin = wWindowCreate();
wwin->screen_ptr = scr;
wwin->client_win = window;
wwin->main_window = window;
wwin->wm_hints = XGetWMHints(dpy, window);
- /* if (!MyXFetchName(dpy, window, &(wwin->frame->title))) {
- wwin->frame->title = NULL;
- }
- */
+
PropGetWMClass(window, &wwin->wm_class, &wwin->wm_instance);
wDefaultFillAttributes(scr, wwin->wm_instance, wwin->wm_class,
@@ -261,18 +254,16 @@ WApplication *wApplicationCreate(WWindow * wwin)
int foo;
unsigned int bar;
/* check if the window is valid */
- if (!XGetGeometry(dpy, main_window, &root, &foo, &foo, &bar,
&bar, &bar, &bar)) {
+ if (!XGetGeometry(dpy, main_window, &root, &foo, &foo, &bar,
&bar, &bar, &bar))
return NULL;
- }
}
wapp = wApplicationOf(main_window);
if (wapp) {
wapp->refcount++;
if (wapp->app_icon && wapp->app_icon->docked &&
- wapp->app_icon->relaunching &&
wapp->main_window_desc->fake_group) {
+ wapp->app_icon->relaunching &&
wapp->main_window_desc->fake_group)
wDockFinishLaunch(wapp->app_icon->dock, wapp->app_icon);
- }
return wapp;
}
http://repo.or.cz/w/wmaker-crm.git/commit/dd6a54bba5a301284f5ffca7b14f84ab9ae51711
commit dd6a54bba5a301284f5ffca7b14f84ab9ae51711
Author: Rodolfo GarcÃa Peñas (kix) <[email protected]>
Date: Fri Jun 1 13:55:11 2012 +0200
Check one time if no_appicon is set
This patch checks if the no_appicon flag is set, then, the icon
is not created, therefore cannot be painted neither saved.
Some comments added to clarify the code.
diff --git a/src/application.c b/src/application.c
index 6508e09..4f9e6f6 100644
--- a/src/application.c
+++ b/src/application.c
@@ -316,17 +316,20 @@ WApplication *wApplicationCreate(WWindow * wwin)
/* application descriptor */
XSaveContext(dpy, main_window, wAppWinContext, (XPointer) wapp);
+ /* Create the application icon */
wapp->app_icon = NULL;
-
- /* Create the application icon using the icon from docks */
- if (!WFLAGP(wapp->main_window_desc, no_appicon))
+ if (!WFLAGP(wapp->main_window_desc, no_appicon)) {
+ /* Create the application icon using the icon from docks
+ * If not found in docks, create a new icon
+ * using the function wAppIconCreate() */
app_icon_create_from_docks(wwin, wapp, main_window);
- /* Now, paint the icon */
- paint_app_icon(wapp);
+ /* Now, paint the icon */
+ paint_app_icon(wapp);
- /* Save the app_icon in a file */
- save_app_icon(wwin, wapp);
+ /* Save the app_icon in a file */
+ save_app_icon(wwin, wapp);
+ }
return wapp;
}
http://repo.or.cz/w/wmaker-crm.git/commit/bd3fb214416a88a672c2674aa47ef202d9c5ceb9
commit bd3fb214416a88a672c2674aa47ef202d9c5ceb9
Author: Rodolfo GarcÃa Peñas (kix) <[email protected]>
Date: Fri Jun 1 12:54:55 2012 +0200
Remove code duplication by calling paint_app_icon()
The code in application.c to create+paint the application icon is
included in appicon.c (function paint_app_icon).
diff --git a/src/application.c b/src/application.c
index c8e4f4b..6508e09 100644
--- a/src/application.c
+++ b/src/application.c
@@ -322,34 +322,8 @@ WApplication *wApplicationCreate(WWindow * wwin)
if (!WFLAGP(wapp->main_window_desc, no_appicon))
app_icon_create_from_docks(wwin, wapp, main_window);
- if (wapp->app_icon)
- wapp->app_icon->main_window = main_window;
-
- if (wapp->app_icon && !wapp->app_icon->docked) {
- WIcon *icon = wapp->app_icon->icon;
- WDock *clip = scr->workspaces[scr->current_workspace]->clip;
- int x = 0, y = 0;
-
- if (clip && clip->attract_icons && wDockFindFreeSlot(clip, &x,
&y)) {
- wapp->app_icon->attracted = 1;
- if (!icon->shadowed) {
- icon->shadowed = 1;
- icon->force_paint = 1;
- /* wAppIconPaint() is done in wDockAttachIcon()
below */
- }
- wDockAttachIcon(clip, wapp->app_icon, x, y);
- } else {
- PlaceIcon(scr, &x, &y,
wGetHeadForWindow(wapp->main_window_desc));
- wAppIconMove(wapp->app_icon, x, y);
- wLowerFrame(icon->core);
- }
-
- if (!clip || !wapp->app_icon->attracted || !clip->collapsed)
- XMapWindow(dpy, icon->core->window);
- }
-
- if (wPreferences.auto_arrange_icons && wapp->app_icon &&
!wapp->app_icon->attracted)
- wArrangeIcons(scr, True);
+ /* Now, paint the icon */
+ paint_app_icon(wapp);
/* Save the app_icon in a file */
save_app_icon(wwin, wapp);
http://repo.or.cz/w/wmaker-crm.git/commit/2e7b039558456b98d8b453a1f61be6a4e03c597e
commit 2e7b039558456b98d8b453a1f61be6a4e03c597e
Author: Rodolfo GarcÃa Peñas (kix) <[email protected]>
Date: Fri Jun 1 12:50:12 2012 +0200
Split makeAppIconFor()
The function makeAppIconFor is splitted in two:
makeAppIconFor: Create the new icon if needed
paint_app_icon: Paint the icon
diff --git a/src/appicon.c b/src/appicon.c
index 9016600..0083944 100644
--- a/src/appicon.c
+++ b/src/appicon.c
@@ -119,8 +119,7 @@ WAppIcon *wAppIconCreateForDock(WScreen * scr, char
*command, char *wm_instance,
void makeAppIconFor(WApplication * wapp)
{
- WScreen *scr = wapp->main_window_desc->screen_ptr;
-
+ /* If app_icon, work is done, return */
if (wapp->app_icon)
return;
@@ -129,30 +128,45 @@ void makeAppIconFor(WApplication * wapp)
else
wapp->app_icon = NULL;
- if (wapp->app_icon) {
- WIcon *icon = wapp->app_icon->icon;
- WDock *clip = scr->workspaces[scr->current_workspace]->clip;
- int x = 0, y = 0;
+ /* Now, paint the icon */
+ paint_app_icon(wapp);
+}
+
+void paint_app_icon(WApplication *wapp)
+{
+ WIcon *icon;
+ WScreen *scr = wapp->main_window_desc->screen_ptr;
+ WDock *clip = scr->workspaces[scr->current_workspace]->clip;
+ int x = 0, y = 0;
- wapp->app_icon->main_window = wapp->main_window;
+ if (!wapp || !wapp->app_icon)
+ return;
- if (clip && clip->attract_icons && wDockFindFreeSlot(clip, &x,
&y)) {
- wapp->app_icon->attracted = 1;
- if (!wapp->app_icon->icon->shadowed) {
- wapp->app_icon->icon->shadowed = 1;
- wapp->app_icon->icon->force_paint = 1;
- }
- wDockAttachIcon(clip, wapp->app_icon, x, y);
- } else {
- PlaceIcon(scr, &x, &y,
wGetHeadForWindow(wapp->main_window_desc));
- wAppIconMove(wapp->app_icon, x, y);
- }
- if (!clip || !wapp->app_icon->attracted || !clip->collapsed)
- XMapWindow(dpy, icon->core->window);
+ icon = wapp->app_icon->icon;
+ wapp->app_icon->main_window = wapp->main_window;
- if (wPreferences.auto_arrange_icons &&
!wapp->app_icon->attracted)
- wArrangeIcons(wapp->main_window_desc->screen_ptr, True);
+ /* If the icon is docked, don't continue */
+ if (wapp->app_icon->docked)
+ return;
+
+ if (clip && clip->attract_icons && wDockFindFreeSlot(clip, &x, &y)) {
+ wapp->app_icon->attracted = 1;
+ if (!icon->shadowed) {
+ icon->shadowed = 1;
+ icon->force_paint = 1;
+ }
+ wDockAttachIcon(clip, wapp->app_icon, x, y);
+ } else {
+ PlaceIcon(scr, &x, &y,
wGetHeadForWindow(wapp->main_window_desc));
+ wAppIconMove(wapp->app_icon, x, y);
+ wLowerFrame(icon->core);
}
+
+ if (!clip || !wapp->app_icon->attracted || !clip->collapsed)
+ XMapWindow(dpy, icon->core->window);
+
+ if (wPreferences.auto_arrange_icons && !wapp->app_icon->attracted)
+ wArrangeIcons(scr, True);
}
void removeAppIconFor(WApplication * wapp)
@@ -177,7 +191,9 @@ void removeAppIconFor(WApplication * wapp)
} else {
wAppIconDestroy(wapp->app_icon);
}
+
wapp->app_icon = NULL;
+
if (wPreferences.auto_arrange_icons)
wArrangeIcons(wapp->main_window_desc->screen_ptr, True);
}
diff --git a/src/appicon.h b/src/appicon.h
index 0c28cbb..774c3e3 100644
--- a/src/appicon.h
+++ b/src/appicon.h
@@ -79,6 +79,7 @@ void wAppIconMove(WAppIcon *aicon, int x, int y);
void makeAppIconFor(WApplication * wapp);
void removeAppIconFor(WApplication * wapp);
void save_app_icon(WWindow *wwin, WApplication *wapp);
+void paint_app_icon(WApplication *wapp);
Bool wAppIconChangeImage(WAppIcon *icon, char *file);
Bool wAppIconSave(WAppIcon *aicon);
http://repo.or.cz/w/wmaker-crm.git/commit/cab8bbc4958ef8d9e4bbfe2c2d9d578e6863e1f1
commit cab8bbc4958ef8d9e4bbfe2c2d9d578e6863e1f1
Author: Rodolfo GarcÃa Peñas (kix) <[email protected]>
Date: Fri Jun 1 12:40:44 2012 +0200
Move makeAppIconFor() and removeAppIconFor()
The functions makeAppIconFor and removeAppIconFor are moved from
winspector.c to appicon.c, and now are not static.
The reason to move these functions is because are used to create
and remove app_icons, therefore should be included in this file.
Finally, this functions will be updated and splitted in next patches.
diff --git a/src/appicon.c b/src/appicon.c
index 4c96643..9016600 100644
--- a/src/appicon.c
+++ b/src/appicon.c
@@ -44,6 +44,7 @@
#include "menu.h"
#include "framewin.h"
#include "dialog.h"
+#include "xinerama.h"
#include "client.h"
#ifdef XDND
#include "xdnd.h"
@@ -116,6 +117,71 @@ WAppIcon *wAppIconCreateForDock(WScreen * scr, char
*command, char *wm_instance,
return dicon;
}
+void makeAppIconFor(WApplication * wapp)
+{
+ WScreen *scr = wapp->main_window_desc->screen_ptr;
+
+ 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;
+
+ if (wapp->app_icon) {
+ WIcon *icon = wapp->app_icon->icon;
+ WDock *clip = scr->workspaces[scr->current_workspace]->clip;
+ int x = 0, y = 0;
+
+ wapp->app_icon->main_window = wapp->main_window;
+
+ if (clip && clip->attract_icons && wDockFindFreeSlot(clip, &x,
&y)) {
+ wapp->app_icon->attracted = 1;
+ if (!wapp->app_icon->icon->shadowed) {
+ wapp->app_icon->icon->shadowed = 1;
+ wapp->app_icon->icon->force_paint = 1;
+ }
+ wDockAttachIcon(clip, wapp->app_icon, x, y);
+ } else {
+ PlaceIcon(scr, &x, &y,
wGetHeadForWindow(wapp->main_window_desc));
+ wAppIconMove(wapp->app_icon, x, y);
+ }
+ if (!clip || !wapp->app_icon->attracted || !clip->collapsed)
+ XMapWindow(dpy, icon->core->window);
+
+ if (wPreferences.auto_arrange_icons &&
!wapp->app_icon->attracted)
+ wArrangeIcons(wapp->main_window_desc->screen_ptr, True);
+ }
+}
+
+void removeAppIconFor(WApplication * wapp)
+{
+ if (!wapp->app_icon)
+ return;
+
+ if (wapp->app_icon->docked && !wapp->app_icon->attracted) {
+ wapp->app_icon->running = 0;
+ /* since we keep it, we don't care if it was attracted or not */
+ wapp->app_icon->attracted = 0;
+ wapp->app_icon->icon->shadowed = 0;
+ wapp->app_icon->main_window = None;
+ wapp->app_icon->pid = 0;
+ wapp->app_icon->icon->owner = NULL;
+ wapp->app_icon->icon->icon_win = None;
+ wapp->app_icon->icon->force_paint = 1;
+ wAppIconPaint(wapp->app_icon);
+ } else if (wapp->app_icon->docked) {
+ wapp->app_icon->running = 0;
+ wDockDetach(wapp->app_icon->dock, wapp->app_icon);
+ } else {
+ wAppIconDestroy(wapp->app_icon);
+ }
+ wapp->app_icon = NULL;
+ if (wPreferences.auto_arrange_icons)
+ wArrangeIcons(wapp->main_window_desc->screen_ptr, True);
+}
+
WAppIcon *wAppIconCreate(WWindow * leader_win)
{
WAppIcon *aicon;
diff --git a/src/appicon.h b/src/appicon.h
index fab712a..0c28cbb 100644
--- a/src/appicon.h
+++ b/src/appicon.h
@@ -76,7 +76,10 @@ WAppIcon * wAppIconCreateForDock(WScreen *scr, char
*command, char *wm_instance,
void wAppIconDestroy(WAppIcon *aicon);
void wAppIconPaint(WAppIcon *aicon);
void wAppIconMove(WAppIcon *aicon, int x, int y);
+void makeAppIconFor(WApplication * wapp);
+void removeAppIconFor(WApplication * wapp);
void save_app_icon(WWindow *wwin, WApplication *wapp);
+
Bool wAppIconChangeImage(WAppIcon *icon, char *file);
Bool wAppIconSave(WAppIcon *aicon);
#endif
diff --git a/src/winspector.c b/src/winspector.c
index a585710..dae8c29 100644
--- a/src/winspector.c
+++ b/src/winspector.c
@@ -47,7 +47,6 @@
#include "dock.h"
#include "client.h"
#include "wmspec.h"
-#include "xinerama.h"
#include <WINGs/WUtil.h>
@@ -674,71 +673,6 @@ static void saveSettings(WMButton * button, InspectorPanel
* panel)
WMPLSetCaseSensitive(False);
}
-static void makeAppIconFor(WApplication * wapp)
-{
- WScreen *scr = wapp->main_window_desc->screen_ptr;
-
- 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;
-
- if (wapp->app_icon) {
- WIcon *icon = wapp->app_icon->icon;
- WDock *clip = scr->workspaces[scr->current_workspace]->clip;
- int x = 0, y = 0;
-
- wapp->app_icon->main_window = wapp->main_window;
-
- if (clip && clip->attract_icons && wDockFindFreeSlot(clip, &x,
&y)) {
- wapp->app_icon->attracted = 1;
- if (!wapp->app_icon->icon->shadowed) {
- wapp->app_icon->icon->shadowed = 1;
- wapp->app_icon->icon->force_paint = 1;
- }
- wDockAttachIcon(clip, wapp->app_icon, x, y);
- } else {
- PlaceIcon(scr, &x, &y,
wGetHeadForWindow(wapp->main_window_desc));
- wAppIconMove(wapp->app_icon, x, y);
- }
- if (!clip || !wapp->app_icon->attracted || !clip->collapsed)
- XMapWindow(dpy, icon->core->window);
-
- if (wPreferences.auto_arrange_icons &&
!wapp->app_icon->attracted)
- wArrangeIcons(wapp->main_window_desc->screen_ptr, True);
- }
-}
-
-static void removeAppIconFor(WApplication * wapp)
-{
- if (!wapp->app_icon)
- return;
-
- if (wapp->app_icon->docked && !wapp->app_icon->attracted) {
- wapp->app_icon->running = 0;
- /* since we keep it, we don't care if it was attracted or not */
- wapp->app_icon->attracted = 0;
- wapp->app_icon->icon->shadowed = 0;
- wapp->app_icon->main_window = None;
- wapp->app_icon->pid = 0;
- wapp->app_icon->icon->owner = NULL;
- wapp->app_icon->icon->icon_win = None;
- wapp->app_icon->icon->force_paint = 1;
- wAppIconPaint(wapp->app_icon);
- } else if (wapp->app_icon->docked) {
- wapp->app_icon->running = 0;
- wDockDetach(wapp->app_icon->dock, wapp->app_icon);
- } else {
- wAppIconDestroy(wapp->app_icon);
- }
- wapp->app_icon = NULL;
- if (wPreferences.auto_arrange_icons)
- wArrangeIcons(wapp->main_window_desc->screen_ptr, True);
-}
-
static void applySettings(WMButton * button, InspectorPanel * panel)
{
WWindow *wwin = panel->inspected;
http://repo.or.cz/w/wmaker-crm.git/commit/01ea1fa8b428d335a39bcafe01548034449a0501
commit 01ea1fa8b428d335a39bcafe01548034449a0501
Author: Rodolfo GarcÃa Peñas (kix) <[email protected]>
Date: Thu May 31 16:39:43 2012 +0200
New function app_icon_create_from_docks
The new function app_icon_create_from_docks do all the needed stuff to
create
the application app_icon using a previous image in docks.
The contents of the app_icon_create_from_docks were moved from the
wApplicationCreate function. Now this function is more clear.
diff --git a/src/application.c b/src/application.c
index 3116514..c8e4f4b 100644
--- a/src/application.c
+++ b/src/application.c
@@ -206,6 +206,46 @@ void wApplicationExtractDirPackIcon(WScreen * scr, char
*path, char *wm_instance
}
}
+static void app_icon_create_from_docks(WWindow *wwin, WApplication *wapp,
Window main_window)
+{
+ WScreen *scr = wwin->screen_ptr;
+
+ if (scr->last_dock)
+ wapp->app_icon = findDockIconFor(scr->last_dock, main_window);
+
+ /* check main dock if we did not find it in last dock */
+ if (!wapp->app_icon && scr->dock)
+ wapp->app_icon = findDockIconFor(scr->dock, main_window);
+
+ /* finally check clips */
+ if (!wapp->app_icon) {
+ int i;
+ for (i = 0; i < scr->workspace_count; i++) {
+ WDock *dock = scr->workspaces[i]->clip;
+ if (dock)
+ wapp->app_icon = findDockIconFor(dock,
main_window);
+ if (wapp->app_icon)
+ break;
+ }
+ }
+
+ /* If created, then set some flags */
+ if (wapp->app_icon) {
+ WWindow *mainw = wapp->main_window_desc;
+
+ wapp->app_icon->running = 1;
+ wapp->app_icon->icon->force_paint = 1;
+ wapp->app_icon->icon->owner = mainw;
+ if (mainw->wm_hints && (mainw->wm_hints->flags &
IconWindowHint))
+ wapp->app_icon->icon->icon_win =
mainw->wm_hints->icon_window;
+
+ wAppIconPaint(wapp->app_icon);
+ wAppIconSave(wapp->app_icon);
+ } else {
+ wapp->app_icon = wAppIconCreate(wapp->main_window_desc);
+ }
+}
+
WApplication *wApplicationCreate(WWindow * wwin)
{
WScreen *scr = wwin->screen_ptr;
@@ -277,40 +317,10 @@ WApplication *wApplicationCreate(WWindow * wwin)
XSaveContext(dpy, main_window, wAppWinContext, (XPointer) wapp);
wapp->app_icon = NULL;
- if (!WFLAGP(wapp->main_window_desc, no_appicon)) {
- if (scr->last_dock)
- wapp->app_icon = findDockIconFor(scr->last_dock,
main_window);
-
- /* check main dock if we did not find it in last dock */
- if (!wapp->app_icon && scr->dock)
- wapp->app_icon = findDockIconFor(scr->dock,
main_window);
-
- /* finally check clips */
- if (!wapp->app_icon) {
- int i;
- for (i = 0; i < scr->workspace_count; i++) {
- WDock *dock = scr->workspaces[i]->clip;
- if (dock)
- wapp->app_icon = findDockIconFor(dock,
main_window);
- if (wapp->app_icon)
- break;
- }
- }
-
- if (wapp->app_icon) {
- WWindow *mainw = wapp->main_window_desc;
- wapp->app_icon->running = 1;
- wapp->app_icon->icon->force_paint = 1;
- wapp->app_icon->icon->owner = mainw;
- if (mainw->wm_hints && (mainw->wm_hints->flags &
IconWindowHint))
- wapp->app_icon->icon->icon_win =
mainw->wm_hints->icon_window;
- wAppIconPaint(wapp->app_icon);
- wAppIconSave(wapp->app_icon);
- } else {
- wapp->app_icon = wAppIconCreate(wapp->main_window_desc);
- }
- }
+ /* Create the application icon using the icon from docks */
+ if (!WFLAGP(wapp->main_window_desc, no_appicon))
+ app_icon_create_from_docks(wwin, wapp, main_window);
if (wapp->app_icon)
wapp->app_icon->main_window = main_window;
http://repo.or.cz/w/wmaker-crm.git/commit/1c1697dc40470a7dc88f1941965ab70736da1774
commit 1c1697dc40470a7dc88f1941965ab70736da1774
Author: Rodolfo GarcÃa Peñas (kix) <[email protected]>
Date: Thu May 31 12:32:04 2012 +0200
New function save_app_icon
New function to save the icon "save_app_icon". This function is
created in appicon.c, because is related to app_icons. The contents
are from application.c. No important modifications are included in
this function. Removed the includes not needed.
diff --git a/src/appicon.c b/src/appicon.c
index cd0e4ad..4c96643 100644
--- a/src/appicon.c
+++ b/src/appicon.c
@@ -26,6 +26,8 @@
#include <X11/Xutil.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/stat.h>
+#include <errno.h>
#include "WindowMaker.h"
#include "window.h"
@@ -759,3 +761,33 @@ void appIconMouseDown(WObjDescriptor * desc, XEvent *
event)
}
}
}
+
+void save_app_icon(WWindow *wwin, WApplication *wapp)
+{
+ char *tmp, *path;
+ struct stat dummy;
+ WScreen *scr = NULL;
+
+ if (!wapp->app_icon)
+ return;
+
+ scr = wwin->screen_ptr;
+ tmp = wDefaultGetIconFile(scr, wapp->app_icon->wm_instance,
wapp->app_icon->wm_class, True);
+
+ /* If the icon was saved by us from the client supplied icon, but is
+ * missing, recreate it. */
+ if (tmp && strstr(tmp, "Library/WindowMaker/CachedPixmaps") != NULL &&
+ stat(tmp, &dummy) != 0 && errno == ENOENT) {
+ wmessage(_("recreating missing icon '%s'"), tmp);
+ path = wIconStore(wapp->app_icon->icon);
+ if (path)
+ wfree(path);
+
+ wIconUpdate(wapp->app_icon->icon);
+ wAppIconPaint(wapp->app_icon);
+ }
+
+ /* if the displayed icon was supplied by the client, save the icon */
+ if (!tmp || strstr(tmp, "Library/WindowMaker/CachedPixmaps") != NULL)
+ wAppIconSave(wapp->app_icon);
+}
diff --git a/src/appicon.h b/src/appicon.h
index c8a96dc..fab712a 100644
--- a/src/appicon.h
+++ b/src/appicon.h
@@ -76,6 +76,7 @@ WAppIcon * wAppIconCreateForDock(WScreen *scr, char *command,
char *wm_instance,
void wAppIconDestroy(WAppIcon *aicon);
void wAppIconPaint(WAppIcon *aicon);
void wAppIconMove(WAppIcon *aicon, int x, int y);
+void save_app_icon(WWindow *wwin, WApplication *wapp);
Bool wAppIconChangeImage(WAppIcon *icon, char *file);
Bool wAppIconSave(WAppIcon *aicon);
#endif
diff --git a/src/application.c b/src/application.c
index ecc77ca..3116514 100644
--- a/src/application.c
+++ b/src/application.c
@@ -22,13 +22,8 @@
#include <X11/Xlib.h>
-#include <stdlib.h>
#include <string.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
#include <unistd.h>
-#include <errno.h>
#include "WindowMaker.h"
#include "menu.h"
@@ -36,15 +31,12 @@
#ifdef USER_MENU
#include "usermenu.h"
#endif /* USER_MENU */
-#include "icon.h"
#include "appicon.h"
#include "application.h"
#include "appmenu.h"
#include "properties.h"
-#include "funcs.h"
#include "stacking.h"
#include "actions.h"
-#include "defaults.h"
#include "workspace.h"
#include "dock.h"
@@ -349,29 +341,9 @@ WApplication *wApplicationCreate(WWindow * wwin)
if (wPreferences.auto_arrange_icons && wapp->app_icon &&
!wapp->app_icon->attracted)
wArrangeIcons(scr, True);
- if (wapp->app_icon) {
- char *tmp, *path;
- struct stat dummy;
-
- tmp = wDefaultGetIconFile(scr, wapp->app_icon->wm_instance,
wapp->app_icon->wm_class, True);
-
- /* If the icon was saved by us from the client supplied icon,
but is
- * missing, recreate it. */
- if (tmp && strstr(tmp, "Library/WindowMaker/CachedPixmaps") !=
NULL &&
- stat(tmp, &dummy) != 0 && errno == ENOENT) {
- wmessage(_("recreating missing icon '%s'"), tmp);
- path = wIconStore(wapp->app_icon->icon);
- if (path) {
- wfree(path);
- }
- wIconUpdate(wapp->app_icon->icon);
- wAppIconPaint(wapp->app_icon);
- }
+ /* Save the app_icon in a file */
+ save_app_icon(wwin, wapp);
- /* if the displayed icon was supplied by the client, save the
icon */
- if (!tmp || strstr(tmp, "Library/WindowMaker/CachedPixmaps") !=
NULL)
- wAppIconSave(wapp->app_icon);
- }
return wapp;
}
http://repo.or.cz/w/wmaker-crm.git/commit/423b78811aa434d8384b99514d95cdbd2a29b67d
commit 423b78811aa434d8384b99514d95cdbd2a29b67d
Author: Rodolfo GarcÃa Peñas (kix) <[email protected]>
Date: Thu May 31 11:23:16 2012 +0200
Initialize app_icon to null
The app_icon initialization to null is common in the if and else blocks.
diff --git a/src/application.c b/src/application.c
index 18ff57b..ecc77ca 100644
--- a/src/application.c
+++ b/src/application.c
@@ -284,8 +284,8 @@ WApplication *wApplicationCreate(WWindow * wwin)
/* application descriptor */
XSaveContext(dpy, main_window, wAppWinContext, (XPointer) wapp);
+ wapp->app_icon = NULL;
if (!WFLAGP(wapp->main_window_desc, no_appicon)) {
- wapp->app_icon = NULL;
if (scr->last_dock)
wapp->app_icon = findDockIconFor(scr->last_dock,
main_window);
@@ -318,8 +318,6 @@ WApplication *wApplicationCreate(WWindow * wwin)
} else {
wapp->app_icon = wAppIconCreate(wapp->main_window_desc);
}
- } else {
- wapp->app_icon = NULL;
}
if (wapp->app_icon)
-----------------------------------------------------------------------
Summary of changes:
src/appicon.c | 114 +++++++++++++++++++++++++++++++++++++
src/appicon.h | 5 ++
src/application.c | 160 ++++++++++++++++++-----------------------------------
src/winspector.c | 66 ----------------------
4 files changed, 173 insertions(+), 172 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].