1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

wAppIconPaint paint argument

The function wAppIconPaint has a new argument. This argument is used
to force an icon create if needed.
This commit is contained in:
Rodolfo García Peñas (kix)
2012-11-10 20:25:11 +01:00
committed by Carlos R. Mafra
parent a3078a5095
commit 33ebded4f9
11 changed files with 60 additions and 45 deletions

View File

@@ -1540,12 +1540,12 @@ void wHideApplication(WApplication *wapp)
wapp->flags.hidden = 1;
if (wPreferences.auto_arrange_icons) {
if (wPreferences.auto_arrange_icons)
wArrangeIcons(scr, True);
}
#ifdef HIDDENDOT
if (wapp->app_icon)
wAppIconPaint(wapp->app_icon);
wAppIconPaint(wapp->app_icon, False);
#endif
}
@@ -1669,11 +1669,11 @@ void wUnhideApplication(WApplication *wapp, Bool miniwindows, Bool bringToCurren
wSetFocusTo(scr, focused);
}
wapp->last_focused = NULL;
if (wPreferences.auto_arrange_icons) {
if (wPreferences.auto_arrange_icons)
wArrangeIcons(scr, True);
}
#ifdef HIDDENDOT
wAppIconPaint(wapp->app_icon);
wAppIconPaint(wapp->app_icon, False);
#endif
}

View File

@@ -238,7 +238,7 @@ void paint_app_icon(WApplication *wapp)
wArrangeIcons(scr, True);
}
void removeAppIconFor(WApplication * wapp)
void removeAppIconFor(WApplication *wapp)
{
if (!wapp->app_icon)
return;
@@ -252,8 +252,7 @@ void removeAppIconFor(WApplication * wapp)
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);
wAppIconPaint(wapp->app_icon, True);
} else if (wapp->app_icon->docked) {
wapp->app_icon->running = 0;
wDockDetach(wapp->app_icon->dock, wapp->app_icon);
@@ -371,7 +370,7 @@ static void updateDockNumbers(WScreen * scr)
}
#endif /* WS_INDICATOR */
void wAppIconPaint(WAppIcon * aicon)
void wAppIconPaint(WAppIcon *aicon, Bool update_icon)
{
WApplication *wapp;
WScreen *scr = aicon->icon->core->screen_ptr;
@@ -381,6 +380,9 @@ void wAppIconPaint(WAppIcon * aicon)
else
wapp = NULL;
if (update_icon)
aicon->icon->force_paint = 1;
wIconPaint(aicon->icon);
# ifdef WS_INDICATOR
@@ -484,7 +486,7 @@ static void unhideHereCallback(WMenu * menu, WMenuEntry * entry)
wUnhideApplication(wapp, False, True);
}
static void setIconCallback(WMenu * menu, WMenuEntry * entry)
static void setIconCallback(WMenu *menu, WMenuEntry *entry)
{
WAppIcon *icon = ((WApplication *) entry->clientdata)->app_icon;
char *file = NULL;
@@ -513,7 +515,9 @@ static void setIconCallback(WMenu * menu, WMenuEntry * entry)
_("Could not open specified icon file"), _("OK"), NULL, NULL);
} else {
wDefaultChangeIcon(scr, icon->wm_instance, icon->wm_class, file);
wAppIconPaint(icon);
/* The image was updated previously at wIconChangeImageFile,
* so we don't need update it here again */
wAppIconPaint(icon, False);
}
if (file)
wfree(file);
@@ -568,7 +572,7 @@ static void killCallback(WMenu * menu, WMenuEntry * entry)
WCHANGE_STATE(WSTATE_NORMAL);
}
static WMenu *createApplicationMenu(WScreen * scr)
static WMenu *createApplicationMenu(WScreen *scr)
{
WMenu *menu;
@@ -619,12 +623,12 @@ static void openApplicationMenu(WApplication * wapp, int x, int y)
/******************************************************************/
static void iconExpose(WObjDescriptor * desc, XEvent * event)
static void iconExpose(WObjDescriptor *desc, XEvent *event)
{
wAppIconPaint(desc->parent);
wAppIconPaint(desc->parent, False);
}
static void iconDblClick(WObjDescriptor * desc, XEvent * event)
static void iconDblClick(WObjDescriptor *desc, XEvent *event)
{
WAppIcon *aicon = desc->parent;
WApplication *wapp;
@@ -980,12 +984,11 @@ void create_appicon_from_dock(WWindow *wwin, WApplication *wapp, Window main_win
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);
wAppIconPaint(wapp->app_icon, True);
save_appicon(wapp->app_icon, True);
}
}

View File

@@ -74,7 +74,7 @@ WAppIcon *wAppIconCreateForDock(WScreen *scr, char *command, char *wm_instance,
void create_appicon_from_dock(WWindow *wwin, WApplication *wapp, Window main_window);
void wAppIconDestroy(WAppIcon *aicon);
void wAppIconPaint(WAppIcon *aicon);
void wAppIconPaint(WAppIcon *aicon, Bool update_icon);
void wAppIconMove(WAppIcon *aicon, int x, int y);
void makeAppIconFor(WApplication * wapp);
void removeAppIconFor(WApplication * wapp);

View File

@@ -215,7 +215,7 @@ void wApplicationActivate(WApplication *wapp)
#ifdef NEWAPPICON
if (wapp->app_icon) {
wIconSetHighlited(wapp->app_icon->icon, True);
wAppIconPaint(wapp->app_icon);
wAppIconPaint(wapp->app_icon, False);
}
#endif
}
@@ -225,7 +225,7 @@ void wApplicationDeactivate(WApplication *wapp)
#ifdef NEWAPPICON
if (wapp->app_icon) {
wIconSetHighlited(wapp->app_icon->icon, False);
wAppIconPaint(wapp->app_icon);
wAppIconPaint(wapp->app_icon, False);
}
#endif
}

View File

@@ -478,7 +478,9 @@ void wClientCheckProperty(WWindow * wwin, XPropertyEvent * event)
wapp = wApplicationOf(wwin->main_window);
if (wapp && wapp->app_icon) {
wIconUpdate(wapp->app_icon->icon);
wAppIconPaint(wapp->app_icon);
/* The icon was updated in wIconUpdate, so we don't
* need update it again here */
wAppIconPaint(wapp->app_icon, False);
}
}

View File

@@ -1118,7 +1118,7 @@ void wReadDefaults(WScreen * scr, WMPropList * new_dict)
}
}
void wDefaultUpdateIcons(WScreen * scr)
void wDefaultUpdateIcons(WScreen *scr)
{
WAppIcon *aicon = scr->app_icon_list;
WWindow *wwin = scr->focused_window;
@@ -1130,7 +1130,9 @@ void wDefaultUpdateIcons(WScreen * scr)
if ((file && aicon->icon->file && strcmp(file, aicon->icon->file) != 0)
|| (file && !aicon->icon->file)) {
wIconChangeImageFile(aicon->icon, file);
wAppIconPaint(aicon);
/* The image was updated previously at wIconChangeImageFile,
* so we don't need update it here again */
wAppIconPaint(aicon, False);
}
aicon = aicon->next;
}
@@ -1143,10 +1145,9 @@ void wDefaultUpdateIcons(WScreen * scr)
/* Get the application icon, default included */
file = wDefaultGetIconFile(wwin->wm_instance, wwin->wm_class, True);
if ((file && wwin->icon->file && strcmp(file, wwin->icon->file) != 0)
|| (file && !wwin->icon->file)) {
|| (file && !wwin->icon->file))
wIconChangeImageFile(wwin->icon, file);
}
}
wwin = wwin->prev;
}
}

View File

@@ -538,8 +538,7 @@ static void keepIconsCallback(WMenu *menu, WMenuEntry *entry)
aicon->attracted = 0;
if (aicon->icon->shadowed) {
aicon->icon->shadowed = 0;
aicon->icon->force_paint = 1;
wAppIconPaint(aicon);
wAppIconPaint(aicon, True);
}
}
save_appicon(aicon, True);
@@ -1149,7 +1148,7 @@ static void dockIconPaint(WAppIcon *btn)
if (btn == btn->icon->core->screen_ptr->clip_icon) {
wClipIconPaint(btn);
} else {
wAppIconPaint(btn);
wAppIconPaint(btn, False);
save_appicon(btn, True);
}
}
@@ -1849,13 +1848,14 @@ int wDockReceiveDNDDrop(WScreen *scr, XEvent *event)
Bool wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, int y, Bool update_icon)
{
WWindow *wwin;
Bool lupdate_icon = False;
int index;
wwin = icon->icon->owner;
icon->editing = 0;
if (update_icon)
icon->icon->force_paint = 1;
lupdate_icon = True;
if (icon->command == NULL) {
char *command;
@@ -1886,7 +1886,7 @@ Bool wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, int y, Bool update_icon
icon->attracted = 1;
if (!icon->icon->shadowed) {
icon->icon->shadowed = 1;
icon->icon->force_paint = 1;
lupdate_icon = True;
}
} else {
return False;
@@ -1929,7 +1929,7 @@ Bool wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, int y, Bool update_icon
MoveInStackListUnder(dock->icon_array[index - 1]->icon->core, icon->icon->core);
wAppIconMove(icon, icon->x_pos, icon->y_pos);
wAppIconPaint(icon);
wAppIconPaint(icon, lupdate_icon);
save_appicon(icon, True);
if (wPreferences.auto_arrange_icons)
@@ -1974,6 +1974,7 @@ static Bool moveIconBetweenDocks(WDock *src, WDock *dest, WAppIcon *icon, int x,
WWindow *wwin;
char *command;
int index;
Bool update_icon = False;
if (src == dest)
return True; /* No move needed, we're already there */
@@ -2054,7 +2055,7 @@ static Bool moveIconBetweenDocks(WDock *src, WDock *dest, WAppIcon *icon, int x,
icon->attracted = 0;
if (icon->icon->shadowed) {
icon->icon->shadowed = 0;
icon->icon->force_paint = 1;
update_icon = True;
}
save_appicon(icon, True);
}
@@ -2071,7 +2072,7 @@ static Bool moveIconBetweenDocks(WDock *src, WDock *dest, WAppIcon *icon, int x,
dest->icon_count++;
MoveInStackListUnder(dest->icon_array[index - 1]->icon->core, icon->icon->core);
wAppIconPaint(icon);
wAppIconPaint(icon, update_icon);
return True;
}
@@ -2079,6 +2080,7 @@ static Bool moveIconBetweenDocks(WDock *src, WDock *dest, WAppIcon *icon, int x,
void wDockDetach(WDock *dock, WAppIcon *icon)
{
int index;
Bool update_icon = False;
/* make the settings panel be closed */
if (icon->panel)
@@ -2095,7 +2097,7 @@ void wDockDetach(WDock *dock, WAppIcon *icon)
icon->auto_launch = 0;
if (icon->icon->shadowed) {
icon->icon->shadowed = 0;
icon->icon->force_paint = 1;
update_icon = True;
}
/* deselect the icon */
@@ -2142,7 +2144,7 @@ void wDockDetach(WDock *dock, WAppIcon *icon)
ChangeStackingLevel(icon->icon->core, NORMAL_ICON_LEVEL);
wAppIconPaint(icon);
wAppIconPaint(icon, update_icon);
if (wPreferences.auto_arrange_icons)
wArrangeIcons(dock->screen_ptr, True);
}
@@ -2888,7 +2890,7 @@ void wDockTrackWindowLaunch(WDock *dock, Window window)
wLowerFrame(aicon->icon->core);
XMapWindow(dpy, aicon->icon->core->window);
aicon->launching = 1;
wAppIconPaint(aicon);
wAppIconPaint(aicon, False);
SlideWindow(aicon->icon->core->window, x0, y0, icon->x_pos, icon->y_pos);
XUnmapWindow(dpy, aicon->icon->core->window);
wAppIconDestroy(aicon);
@@ -3964,7 +3966,7 @@ int wClipMakeIconOmnipresent(WAppIcon *aicon, int omnipresent)
}
}
wAppIconPaint(aicon);
wAppIconPaint(aicon, False);
return status;
}

View File

@@ -151,15 +151,15 @@ static void panelBtnCallback(WMWidget * self, void *data)
WMButton *btn = self;
AppSettingsPanel *panel = (AppSettingsPanel *) data;
char *text;
int done;
int done = 1;
done = 1;
if (panel->okBtn == btn) {
text = WMGetTextFieldText(panel->iconField);
if (text[0] == 0) {
wfree(text);
text = NULL;
}
if (!wIconChangeImageFile(panel->editedIcon->icon, text)) {
char *buf;
int len = strlen(text) + 64;
@@ -177,10 +177,12 @@ static void panelBtnCallback(WMWidget * self, void *data)
} else {
WAppIcon *aicon = panel->editedIcon;
/* The image was updated in wIconChangeImageFile,
* so we don't need udpate it at wAppIconPaint */
if (aicon == aicon->icon->core->screen_ptr->clip_icon)
wClipIconPaint(aicon);
else
wAppIconPaint(aicon);
wAppIconPaint(aicon, False);
wDefaultChangeIcon(panel->wwin->screen_ptr, aicon->wm_instance, aicon->wm_class, text);
}

View File

@@ -785,10 +785,14 @@ static void applySettings(WMButton *button, InspectorPanel *panel)
wfree(file);
file = NULL;
}
wIconChangeImageFile(wapp->app_icon->icon, file);
if (file)
wfree(file);
wAppIconPaint(wapp->app_icon);
/* The image was updated in wIconChangeImageFile,
* so we don't need udpate it at wAppIconPaint */
wAppIconPaint(wapp->app_icon, False);
}
}

View File

@@ -474,7 +474,8 @@ static void updateIconImage(WWindow *wwin)
WApplication *app = wApplicationOf(wwin->main_window);
if (app && app->app_icon) {
wIconUpdate(app->app_icon->icon);
wAppIconPaint(app->app_icon);
/* Icon was updated in wIconUpdate, so we don't need update it again */
wAppIconPaint(app->app_icon, False);
}
}

View File

@@ -594,7 +594,7 @@ void wWorkspaceForceChange(WScreen * scr, int workspace)
wArrangeIcons(scr, False);
if (scr->dock)
wAppIconPaint(scr->dock->icon_array[0]);
wAppIconPaint(scr->dock->icon_array[0], False);
if (scr->clip_icon) {
if (scr->workspaces[workspace]->clip->auto_collapse ||