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.
This commit is contained in:
Rodolfo García Peñas (kix) authored and Carlos R. Mafra committed 2012-06-01 22:01:02 +01:00
1 parent 01ea1fa8b4
commit cab8bbc495
3 files changed
+69 -66

No files matched your search

+66
View File
@@ -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;
+3
View File
@@ -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
-66
View File
@@ -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;