mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-22 22:28:02 +01:00
Split makeAppIconFor()
The function makeAppIconFor is splitted in two: makeAppIconFor: Create the new icon if needed paint_app_icon: Paint the icon
This commit is contained in:
committed by
Carlos R. Mafra
parent
cab8bbc495
commit
2e7b039558
@@ -119,8 +119,7 @@ WAppIcon *wAppIconCreateForDock(WScreen * scr, char *command, char *wm_instance,
|
|||||||
|
|
||||||
void makeAppIconFor(WApplication * wapp)
|
void makeAppIconFor(WApplication * wapp)
|
||||||
{
|
{
|
||||||
WScreen *scr = wapp->main_window_desc->screen_ptr;
|
/* If app_icon, work is done, return */
|
||||||
|
|
||||||
if (wapp->app_icon)
|
if (wapp->app_icon)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -129,30 +128,45 @@ void makeAppIconFor(WApplication * wapp)
|
|||||||
else
|
else
|
||||||
wapp->app_icon = NULL;
|
wapp->app_icon = NULL;
|
||||||
|
|
||||||
if (wapp->app_icon) {
|
/* Now, paint the icon */
|
||||||
WIcon *icon = wapp->app_icon->icon;
|
paint_app_icon(wapp);
|
||||||
WDock *clip = scr->workspaces[scr->current_workspace]->clip;
|
}
|
||||||
int x = 0, y = 0;
|
|
||||||
|
|
||||||
wapp->app_icon->main_window = wapp->main_window;
|
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;
|
||||||
|
|
||||||
if (clip && clip->attract_icons && wDockFindFreeSlot(clip, &x, &y)) {
|
if (!wapp || !wapp->app_icon)
|
||||||
wapp->app_icon->attracted = 1;
|
return;
|
||||||
if (!wapp->app_icon->icon->shadowed) {
|
|
||||||
wapp->app_icon->icon->shadowed = 1;
|
icon = wapp->app_icon->icon;
|
||||||
wapp->app_icon->icon->force_paint = 1;
|
wapp->app_icon->main_window = wapp->main_window;
|
||||||
}
|
|
||||||
wDockAttachIcon(clip, wapp->app_icon, x, y);
|
/* If the icon is docked, don't continue */
|
||||||
} else {
|
if (wapp->app_icon->docked)
|
||||||
PlaceIcon(scr, &x, &y, wGetHeadForWindow(wapp->main_window_desc));
|
return;
|
||||||
wAppIconMove(wapp->app_icon, x, y);
|
|
||||||
|
if (clip && clip->attract_icons && wDockFindFreeSlot(clip, &x, &y)) {
|
||||||
|
wapp->app_icon->attracted = 1;
|
||||||
|
if (!icon->shadowed) {
|
||||||
|
icon->shadowed = 1;
|
||||||
|
icon->force_paint = 1;
|
||||||
}
|
}
|
||||||
if (!clip || !wapp->app_icon->attracted || !clip->collapsed)
|
wDockAttachIcon(clip, wapp->app_icon, x, y);
|
||||||
XMapWindow(dpy, icon->core->window);
|
} else {
|
||||||
|
PlaceIcon(scr, &x, &y, wGetHeadForWindow(wapp->main_window_desc));
|
||||||
if (wPreferences.auto_arrange_icons && !wapp->app_icon->attracted)
|
wAppIconMove(wapp->app_icon, x, y);
|
||||||
wArrangeIcons(wapp->main_window_desc->screen_ptr, True);
|
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)
|
void removeAppIconFor(WApplication * wapp)
|
||||||
@@ -177,7 +191,9 @@ void removeAppIconFor(WApplication * wapp)
|
|||||||
} else {
|
} else {
|
||||||
wAppIconDestroy(wapp->app_icon);
|
wAppIconDestroy(wapp->app_icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
wapp->app_icon = NULL;
|
wapp->app_icon = NULL;
|
||||||
|
|
||||||
if (wPreferences.auto_arrange_icons)
|
if (wPreferences.auto_arrange_icons)
|
||||||
wArrangeIcons(wapp->main_window_desc->screen_ptr, True);
|
wArrangeIcons(wapp->main_window_desc->screen_ptr, True);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ void wAppIconMove(WAppIcon *aicon, int x, int y);
|
|||||||
void makeAppIconFor(WApplication * wapp);
|
void makeAppIconFor(WApplication * wapp);
|
||||||
void removeAppIconFor(WApplication * wapp);
|
void removeAppIconFor(WApplication * wapp);
|
||||||
void save_app_icon(WWindow *wwin, WApplication *wapp);
|
void save_app_icon(WWindow *wwin, WApplication *wapp);
|
||||||
|
void paint_app_icon(WApplication *wapp);
|
||||||
|
|
||||||
Bool wAppIconChangeImage(WAppIcon *icon, char *file);
|
Bool wAppIconChangeImage(WAppIcon *icon, char *file);
|
||||||
Bool wAppIconSave(WAppIcon *aicon);
|
Bool wAppIconSave(WAppIcon *aicon);
|
||||||
|
|||||||
Reference in New Issue
Block a user