mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-23 22:52:34 +01:00
new appicon grouping stuff
This commit is contained in:
103
src/actions.c
103
src/actions.c
@@ -1269,19 +1269,11 @@ wHideOtherApplications(WWindow *awin)
|
|||||||
{
|
{
|
||||||
WWindow *wwin;
|
WWindow *wwin;
|
||||||
WApplication *tapp;
|
WApplication *tapp;
|
||||||
#ifdef REDUCE_APPICONS
|
|
||||||
char *tinstance, *tclass;
|
|
||||||
unsigned int brokenwin = 0, match = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!awin)
|
if (!awin)
|
||||||
return;
|
return;
|
||||||
wwin = awin->screen_ptr->focused_window;
|
wwin = awin->screen_ptr->focused_window;
|
||||||
|
|
||||||
#ifdef REDUCE_APPICONS
|
|
||||||
if (awin->wm_instance == NULL || awin->wm_class == NULL)
|
|
||||||
brokenwin++;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
while (wwin) {
|
while (wwin) {
|
||||||
if (wwin!=awin
|
if (wwin!=awin
|
||||||
@@ -1291,30 +1283,13 @@ wHideOtherApplications(WWindow *awin)
|
|||||||
&& wGetWindowOfInspectorForWindow(wwin) != awin
|
&& wGetWindowOfInspectorForWindow(wwin) != awin
|
||||||
&& !WFLAGP(wwin, no_hide_others)) {
|
&& !WFLAGP(wwin, no_hide_others)) {
|
||||||
|
|
||||||
#ifdef REDUCE_APPICONS
|
|
||||||
match = 0;
|
|
||||||
if (!brokenwin) {
|
|
||||||
if ((tinstance = wwin->wm_instance) == NULL)
|
|
||||||
tinstance = "";
|
|
||||||
if ((tclass = wwin->wm_class) == NULL)
|
|
||||||
tclass = "";
|
|
||||||
if ((strcmp(awin->wm_instance, tinstance) == 0) &&
|
|
||||||
(strcmp(awin->wm_class, tclass) == 0) )
|
|
||||||
match++;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (wwin->main_window==None || WFLAGP(wwin, no_appicon)) {
|
if (wwin->main_window==None || WFLAGP(wwin, no_appicon)) {
|
||||||
if (!WFLAGP(wwin, no_miniaturizable)) {
|
if (!WFLAGP(wwin, no_miniaturizable)) {
|
||||||
wwin->flags.skip_next_animation = 1;
|
wwin->flags.skip_next_animation = 1;
|
||||||
wIconifyWindow(wwin);
|
wIconifyWindow(wwin);
|
||||||
}
|
}
|
||||||
} else if (wwin->main_window!=None
|
} else if (wwin->main_window!=None
|
||||||
#ifndef REDUCE_APPICONS
|
|
||||||
&& awin->main_window != wwin->main_window) {
|
&& awin->main_window != wwin->main_window) {
|
||||||
#else
|
|
||||||
&& (awin->main_window != wwin->main_window && !match)) {
|
|
||||||
#endif
|
|
||||||
tapp = wApplicationOf(wwin->main_window);
|
tapp = wApplicationOf(wwin->main_window);
|
||||||
if (tapp) {
|
if (tapp) {
|
||||||
tapp->flags.skip_next_animation = 1;
|
tapp->flags.skip_next_animation = 1;
|
||||||
@@ -1339,11 +1314,6 @@ wHideOtherApplications(WWindow *awin)
|
|||||||
void
|
void
|
||||||
wHideApplication(WApplication *wapp)
|
wHideApplication(WApplication *wapp)
|
||||||
{
|
{
|
||||||
#ifdef REDUCE_APPICONS
|
|
||||||
WApplication *tapp;
|
|
||||||
char *tinstance, *tclass;
|
|
||||||
unsigned int nowmhints = 0, matchwmhints = 0, matchworkspace = 0;
|
|
||||||
#endif
|
|
||||||
WScreen *scr;
|
WScreen *scr;
|
||||||
WWindow *wlist;
|
WWindow *wlist;
|
||||||
int hadfocus;
|
int hadfocus;
|
||||||
@@ -1356,11 +1326,6 @@ wHideApplication(WApplication *wapp)
|
|||||||
wwarning("group leader not found for window group");
|
wwarning("group leader not found for window group");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifdef REDUCE_APPICONS
|
|
||||||
if ((wapp->main_window_desc->wm_instance == NULL) ||
|
|
||||||
(wapp->main_window_desc->wm_class == NULL))
|
|
||||||
nowmhints++;
|
|
||||||
#endif
|
|
||||||
scr = wapp->main_window_desc->screen_ptr;
|
scr = wapp->main_window_desc->screen_ptr;
|
||||||
hadfocus = 0;
|
hadfocus = 0;
|
||||||
wlist = scr->focused_window;
|
wlist = scr->focused_window;
|
||||||
@@ -1372,38 +1337,7 @@ wHideApplication(WApplication *wapp)
|
|||||||
else
|
else
|
||||||
wapp->last_focused = NULL;
|
wapp->last_focused = NULL;
|
||||||
while (wlist) {
|
while (wlist) {
|
||||||
#ifdef REDUCE_APPICONS
|
|
||||||
matchwmhints = matchworkspace = 0;
|
|
||||||
if (!nowmhints) {
|
|
||||||
tapp = wApplicationOf(wlist->main_window);
|
|
||||||
tinstance = tclass = NULL;
|
|
||||||
if (tapp) {
|
|
||||||
if (tapp->main_window_desc) {
|
|
||||||
tinstance = tapp->main_window_desc->wm_instance;
|
|
||||||
tclass = tapp->main_window_desc->wm_class;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (tapp == NULL || tinstance == NULL || tclass == NULL) {
|
|
||||||
/* Should never reach here */
|
|
||||||
tinstance = "";
|
|
||||||
tclass = "";
|
|
||||||
}
|
|
||||||
if ((strcmp(tinstance, wapp->main_window_desc->wm_instance) == 0) &&
|
|
||||||
(strcmp(tclass, wapp->main_window_desc->wm_class) == 0) )
|
|
||||||
matchwmhints++;
|
|
||||||
}
|
|
||||||
if (wlist->frame) {
|
|
||||||
if (wlist->frame->workspace == wapp->main_window_desc->screen_ptr->current_workspace)
|
|
||||||
matchworkspace++;
|
|
||||||
}
|
|
||||||
if ((wlist->main_window == wapp->main_window || matchwmhints) &&
|
|
||||||
matchworkspace) {
|
|
||||||
#ifdef I_HATE_THIS
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
if (wlist->main_window == wapp->main_window) {
|
if (wlist->main_window == wapp->main_window) {
|
||||||
#endif
|
|
||||||
if (wlist->flags.focused) {
|
if (wlist->flags.focused) {
|
||||||
hadfocus = 1;
|
hadfocus = 1;
|
||||||
}
|
}
|
||||||
@@ -1493,21 +1427,10 @@ wUnhideApplication(WApplication *wapp, Bool miniwindows, Bool bringToCurrentWS)
|
|||||||
WScreen *scr;
|
WScreen *scr;
|
||||||
WWindow *wlist, *next;
|
WWindow *wlist, *next;
|
||||||
WWindow *focused=NULL;
|
WWindow *focused=NULL;
|
||||||
#ifdef REDUCE_APPICONS
|
|
||||||
char *tinstance, *tclass;
|
|
||||||
unsigned int nowmhints = 0, matchwmhints = 0, matchworkspace = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!wapp) {
|
if (!wapp) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef REDUCE_APPICONS
|
|
||||||
if ((wapp->main_window_desc->wm_class == NULL) ||
|
|
||||||
(wapp->main_window_desc->wm_instance == NULL))
|
|
||||||
nowmhints++;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
scr = wapp->main_window_desc->screen_ptr;
|
scr = wapp->main_window_desc->screen_ptr;
|
||||||
wlist = scr->focused_window;
|
wlist = scr->focused_window;
|
||||||
if (!wlist) return;
|
if (!wlist) return;
|
||||||
@@ -1518,27 +1441,7 @@ wUnhideApplication(WApplication *wapp, Bool miniwindows, Bool bringToCurrentWS)
|
|||||||
while (wlist) {
|
while (wlist) {
|
||||||
next = wlist->next;
|
next = wlist->next;
|
||||||
|
|
||||||
#ifndef REDUCE_APPICONS
|
|
||||||
if (wlist->main_window == wapp->main_window) {
|
if (wlist->main_window == wapp->main_window) {
|
||||||
#else
|
|
||||||
matchwmhints = matchworkspace = 0;
|
|
||||||
if (!nowmhints) {
|
|
||||||
if ((tinstance = wlist->wm_instance) == NULL)
|
|
||||||
tinstance = "";
|
|
||||||
if ((tclass = wlist->wm_class) == NULL)
|
|
||||||
tclass = "";
|
|
||||||
if ((strcmp(tinstance, wapp->main_window_desc->wm_instance) == 0)
|
|
||||||
&& (strcmp(tclass, wapp->main_window_desc->wm_class) == 0) )
|
|
||||||
matchwmhints++;
|
|
||||||
}
|
|
||||||
if (wlist->frame) {
|
|
||||||
if (wlist->frame->workspace == wapp->main_window_desc->screen_ptr->current_workspace)
|
|
||||||
matchworkspace++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((wlist->main_window == wapp->main_window || matchwmhints) &&
|
|
||||||
matchworkspace) {
|
|
||||||
#endif
|
|
||||||
if (wlist->flags.focused)
|
if (wlist->flags.focused)
|
||||||
focused = wlist;
|
focused = wlist;
|
||||||
else if (!focused || !focused->flags.focused)
|
else if (!focused || !focused->flags.focused)
|
||||||
@@ -1717,8 +1620,8 @@ wArrangeIcons(WScreen *scr, Bool arrangeAll)
|
|||||||
|
|
||||||
pi = 0;
|
pi = 0;
|
||||||
si = 0;
|
si = 0;
|
||||||
while (aicon) {
|
while (aicon) {
|
||||||
if (!aicon->docked) {
|
if (!aicon->docked && wAppIconIndexOfInstance(aicon) == 0) {
|
||||||
if (aicon->x_pos != X || aicon->y_pos != Y) {
|
if (aicon->x_pos != X || aicon->y_pos != Y) {
|
||||||
#ifdef ANIMATIONS
|
#ifdef ANIMATIONS
|
||||||
if (!wPreferences.no_animations) {
|
if (!wPreferences.no_animations) {
|
||||||
@@ -1726,7 +1629,7 @@ wArrangeIcons(WScreen *scr, Bool arrangeAll)
|
|||||||
X, Y);
|
X, Y);
|
||||||
}
|
}
|
||||||
#endif /* ANIMATIONS */
|
#endif /* ANIMATIONS */
|
||||||
}
|
}
|
||||||
wAppIconMove(aicon, X, Y);
|
wAppIconMove(aicon, X, Y);
|
||||||
pi++;
|
pi++;
|
||||||
}
|
}
|
||||||
|
|||||||
287
src/appicon.c
287
src/appicon.c
@@ -112,9 +112,7 @@ wAppIconCreateForDock(WScreen *scr, char *command, char *wm_instance,
|
|||||||
#ifdef XDND
|
#ifdef XDND
|
||||||
wXDNDMakeAwareness(dicon->icon->core->window);
|
wXDNDMakeAwareness(dicon->icon->core->window);
|
||||||
#endif
|
#endif
|
||||||
#ifdef REDUCE_APPICONS
|
|
||||||
dicon->num_apps = 0;
|
|
||||||
#endif
|
|
||||||
#ifdef DEMATERIALIZE_ICON
|
#ifdef DEMATERIALIZE_ICON
|
||||||
{
|
{
|
||||||
XSetWindowAttributes attribs;
|
XSetWindowAttributes attribs;
|
||||||
@@ -140,30 +138,11 @@ WAppIcon*
|
|||||||
wAppIconCreate(WWindow *leader_win)
|
wAppIconCreate(WWindow *leader_win)
|
||||||
{
|
{
|
||||||
WAppIcon *aicon;
|
WAppIcon *aicon;
|
||||||
#ifdef REDUCE_APPICONS
|
|
||||||
WAppIcon *atmp;
|
|
||||||
WAppIconAppList *applist;
|
|
||||||
char *tinstance, *tclass;
|
|
||||||
#endif
|
|
||||||
WScreen *scr = leader_win->screen_ptr;
|
WScreen *scr = leader_win->screen_ptr;
|
||||||
|
|
||||||
aicon = wmalloc(sizeof(WAppIcon));
|
aicon = wmalloc(sizeof(WAppIcon));
|
||||||
wretain(aicon);
|
wretain(aicon);
|
||||||
memset(aicon, 0, sizeof(WAppIcon));
|
memset(aicon, 0, sizeof(WAppIcon));
|
||||||
#ifdef REDUCE_APPICONS
|
|
||||||
applist = wmalloc(sizeof(WAppIconAppList));
|
|
||||||
memset(applist, 0, sizeof(WAppIconAppList));
|
|
||||||
applist->wapp = wApplicationOf(leader_win->main_window);
|
|
||||||
aicon->applist = applist;
|
|
||||||
if (applist->wapp == NULL) {
|
|
||||||
/* Something's wrong. wApplicationOf() should always return a
|
|
||||||
* valid structure. Rather than violate assumptions, bail. -cls
|
|
||||||
*/
|
|
||||||
wfree(applist);
|
|
||||||
wrelease(aicon);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
aicon->yindex = -1;
|
aicon->yindex = -1;
|
||||||
aicon->xindex = -1;
|
aicon->xindex = -1;
|
||||||
@@ -171,43 +150,7 @@ wAppIconCreate(WWindow *leader_win)
|
|||||||
aicon->prev = NULL;
|
aicon->prev = NULL;
|
||||||
aicon->next = scr->app_icon_list;
|
aicon->next = scr->app_icon_list;
|
||||||
if (scr->app_icon_list) {
|
if (scr->app_icon_list) {
|
||||||
#ifndef REDUCE_APPICONS
|
|
||||||
scr->app_icon_list->prev = aicon;
|
scr->app_icon_list->prev = aicon;
|
||||||
#else
|
|
||||||
/* If we aren't going to have a match, jump straight to new appicon */
|
|
||||||
if (leader_win->wm_class == NULL || leader_win->wm_class == NULL)
|
|
||||||
atmp = NULL;
|
|
||||||
else
|
|
||||||
atmp = scr->app_icon_list;
|
|
||||||
|
|
||||||
while (atmp != NULL) {
|
|
||||||
if ((tinstance = atmp->wm_instance) == NULL)
|
|
||||||
tinstance = "";
|
|
||||||
if ((tclass = atmp->wm_class) == NULL)
|
|
||||||
tclass = "";
|
|
||||||
if ((strcmp(leader_win->wm_class, tclass) == 0) &&
|
|
||||||
(strcmp(leader_win->wm_instance, tinstance) == 0))
|
|
||||||
{
|
|
||||||
/* We have a winner */
|
|
||||||
wrelease(aicon);
|
|
||||||
atmp->num_apps++;
|
|
||||||
applist->next = atmp->applist;
|
|
||||||
if (atmp->applist)
|
|
||||||
atmp->applist->prev = applist;
|
|
||||||
atmp->applist = applist;
|
|
||||||
|
|
||||||
if (atmp->docked) {
|
|
||||||
wDockSimulateLaunch(atmp->dock, atmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
return atmp;
|
|
||||||
}
|
|
||||||
atmp = atmp->next;
|
|
||||||
}
|
|
||||||
if (atmp == NULL) {
|
|
||||||
scr->app_icon_list->prev = aicon;
|
|
||||||
}
|
|
||||||
#endif /* REDUCE_APPICONS */
|
|
||||||
}
|
}
|
||||||
scr->app_icon_list = aicon;
|
scr->app_icon_list = aicon;
|
||||||
|
|
||||||
@@ -215,9 +158,6 @@ wAppIconCreate(WWindow *leader_win)
|
|||||||
aicon->wm_class = wstrdup(leader_win->wm_class);
|
aicon->wm_class = wstrdup(leader_win->wm_class);
|
||||||
if (leader_win->wm_instance)
|
if (leader_win->wm_instance)
|
||||||
aicon->wm_instance = wstrdup(leader_win->wm_instance);
|
aicon->wm_instance = wstrdup(leader_win->wm_instance);
|
||||||
#ifdef REDUCE_APPICONS
|
|
||||||
aicon->num_apps = 1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
aicon->icon = wIconCreate(leader_win);
|
aicon->icon = wIconCreate(leader_win);
|
||||||
#ifdef DEMATERIALIZE_ICON
|
#ifdef DEMATERIALIZE_ICON
|
||||||
@@ -249,9 +189,6 @@ void
|
|||||||
wAppIconDestroy(WAppIcon *aicon)
|
wAppIconDestroy(WAppIcon *aicon)
|
||||||
{
|
{
|
||||||
WScreen *scr = aicon->icon->core->screen_ptr;
|
WScreen *scr = aicon->icon->core->screen_ptr;
|
||||||
#ifdef REDUCE_APPICONS
|
|
||||||
WAppIconAppList *aptmp;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
RemoveFromStackList(aicon->icon->core);
|
RemoveFromStackList(aicon->icon->core);
|
||||||
wIconDestroy(aicon->icon);
|
wIconDestroy(aicon->icon);
|
||||||
@@ -265,17 +202,6 @@ wAppIconDestroy(WAppIcon *aicon)
|
|||||||
wfree(aicon->wm_instance);
|
wfree(aicon->wm_instance);
|
||||||
if (aicon->wm_class)
|
if (aicon->wm_class)
|
||||||
wfree(aicon->wm_class);
|
wfree(aicon->wm_class);
|
||||||
#ifdef REDUCE_APPICONS
|
|
||||||
/* There should never be a list but just in case */
|
|
||||||
if (aicon->applist != NULL) {
|
|
||||||
aptmp = aicon->applist;
|
|
||||||
while (aptmp->next) {
|
|
||||||
aptmp = aptmp->next;
|
|
||||||
wfree(aptmp->prev);
|
|
||||||
}
|
|
||||||
wfree(aptmp);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (aicon == scr->app_icon_list) {
|
if (aicon == scr->app_icon_list) {
|
||||||
if (aicon->next)
|
if (aicon->next)
|
||||||
@@ -351,9 +277,21 @@ drawCorner(WIcon *icon)
|
|||||||
void
|
void
|
||||||
wAppIconMove(WAppIcon *aicon, int x, int y)
|
wAppIconMove(WAppIcon *aicon, int x, int y)
|
||||||
{
|
{
|
||||||
XMoveWindow(dpy, aicon->icon->core->window, x, y);
|
WAppIcon *tmp;
|
||||||
aicon->x_pos = x;
|
|
||||||
aicon->y_pos = y;
|
tmp = aicon->icon->core->screen_ptr->app_icon_list;
|
||||||
|
|
||||||
|
/* move all icons of the same class/name to the same pos */
|
||||||
|
while (tmp) {
|
||||||
|
if (strcmp(tmp->wm_class, aicon->wm_class) == 0 &&
|
||||||
|
strcmp(tmp->wm_instance, aicon->wm_instance) == 0 &&
|
||||||
|
!tmp->docked) {
|
||||||
|
XMoveWindow(dpy, tmp->icon->core->window, x, y);
|
||||||
|
tmp->x_pos = x;
|
||||||
|
tmp->y_pos = y;
|
||||||
|
}
|
||||||
|
tmp = tmp->next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -394,10 +332,65 @@ updateDockNumbers(WScreen *scr)
|
|||||||
#endif /* WS_INDICATOR */
|
#endif /* WS_INDICATOR */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
WAppIcon*
|
||||||
|
wAppIconNextSibling(WAppIcon *icon)
|
||||||
|
{
|
||||||
|
WAppIcon *tmp;
|
||||||
|
|
||||||
|
tmp = icon->icon->core->screen_ptr->app_icon_list;
|
||||||
|
while (tmp) {
|
||||||
|
if (icon != tmp && strcmp(tmp->wm_class, icon->wm_class) == 0
|
||||||
|
&& strcmp(tmp->wm_instance, icon->wm_instance) == 0
|
||||||
|
&& !tmp->docked) {
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
tmp = tmp->next;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
wAppIconIndexOfInstance(WAppIcon *icon)
|
||||||
|
{
|
||||||
|
WAppIcon *list = icon->icon->core->screen_ptr->app_icon_list;
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
|
while (list) {
|
||||||
|
if (icon == list)
|
||||||
|
return index;
|
||||||
|
|
||||||
|
if (strcmp(icon->wm_instance,
|
||||||
|
list->wm_instance) == 0
|
||||||
|
&&
|
||||||
|
strcmp(icon->wm_class,
|
||||||
|
list->wm_class) == 0
|
||||||
|
&& !icon->docked)
|
||||||
|
index++;
|
||||||
|
|
||||||
|
list = list->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
puts("OH SHIT!?!?!? HOW THE FUCK DID WE GET HERE!?!?!?!?!");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
wAppIconPaint(WAppIcon *aicon)
|
wAppIconPaint(WAppIcon *aicon)
|
||||||
{
|
{
|
||||||
|
WApplication *wapp;
|
||||||
WScreen *scr = aicon->icon->core->screen_ptr;
|
WScreen *scr = aicon->icon->core->screen_ptr;
|
||||||
|
int index;
|
||||||
|
|
||||||
|
if (aicon->icon->owner)
|
||||||
|
wapp = wApplicationOf(aicon->icon->owner->main_window);
|
||||||
|
else
|
||||||
|
wapp = NULL;
|
||||||
|
|
||||||
wIconPaint(aicon->icon);
|
wIconPaint(aicon->icon);
|
||||||
|
|
||||||
@@ -414,23 +407,35 @@ wAppIconPaint(WAppIcon *aicon)
|
|||||||
XCopyArea(dpy, scr->dock_dots->image, aicon->icon->core->window,
|
XCopyArea(dpy, scr->dock_dots->image, aicon->icon->core->window,
|
||||||
scr->copy_gc, 0, 0, scr->dock_dots->width,
|
scr->copy_gc, 0, 0, scr->dock_dots->width,
|
||||||
scr->dock_dots->height, 0, 0);
|
scr->dock_dots->height, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HIDDENDOT
|
#ifdef HIDDENDOT
|
||||||
{
|
if (wapp && wapp->flags.hidden) {
|
||||||
WApplication *wapp;
|
XSetClipMask(dpy, scr->copy_gc, scr->dock_dots->mask);
|
||||||
wapp = wApplicationOf(aicon->main_window);
|
XSetClipOrigin(dpy, scr->copy_gc, 0, 0);
|
||||||
if (wapp && wapp->flags.hidden) {
|
XCopyArea(dpy, scr->dock_dots->image,
|
||||||
XSetClipMask(dpy, scr->copy_gc, scr->dock_dots->mask);
|
aicon->icon->core->window,
|
||||||
XSetClipOrigin(dpy, scr->copy_gc, 0, 0);
|
scr->copy_gc, 0, 0, 7,
|
||||||
XCopyArea(dpy, scr->dock_dots->image,
|
scr->dock_dots->height, 0, 0);
|
||||||
aicon->icon->core->window,
|
|
||||||
scr->copy_gc, 0, 0, 7,
|
|
||||||
scr->dock_dots->height, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif /* HIDDENDOT */
|
#endif /* HIDDENDOT */
|
||||||
|
|
||||||
|
if (wapp)
|
||||||
|
index = wApplicationIndexOfInstance(wapp);
|
||||||
|
else
|
||||||
|
index = 0;
|
||||||
|
|
||||||
|
if (index > 0) {
|
||||||
|
char buf[16];
|
||||||
|
|
||||||
|
sprintf(buf, "%i", index);
|
||||||
|
|
||||||
|
WMDrawString(scr->wmscreen, aicon->icon->core->window,
|
||||||
|
scr->clip_title_gc, scr->title_font,
|
||||||
|
1, 1, buf, strlen(buf));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (aicon->omnipresent)
|
if (aicon->omnipresent)
|
||||||
drawCorner(aicon->icon);
|
drawCorner(aicon->icon);
|
||||||
|
|
||||||
@@ -445,58 +450,6 @@ wAppIconPaint(WAppIcon *aicon)
|
|||||||
|
|
||||||
#define canBeDocked(wwin) ((wwin) && ((wwin)->wm_class||(wwin)->wm_instance))
|
#define canBeDocked(wwin) ((wwin) && ((wwin)->wm_class||(wwin)->wm_instance))
|
||||||
|
|
||||||
#ifdef REDUCE_APPICONS
|
|
||||||
unsigned int
|
|
||||||
wAppIconReduceAppCount(WApplication *wapp)
|
|
||||||
{
|
|
||||||
WAppIconAppList *applist;
|
|
||||||
|
|
||||||
if (wapp == NULL)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (wapp->app_icon == NULL)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* If given a main window, check the applist
|
|
||||||
* and remove the if it exists
|
|
||||||
*/
|
|
||||||
applist = wapp->app_icon->applist;
|
|
||||||
while (applist != NULL) {
|
|
||||||
if (applist->wapp == wapp) {
|
|
||||||
/* If this app owns the appicon, change the appicon's
|
|
||||||
* owner to the next app in the list or NULL
|
|
||||||
*/
|
|
||||||
if (wapp->app_icon->icon->owner
|
|
||||||
== applist->wapp->main_window_desc) {
|
|
||||||
if (applist->next) {
|
|
||||||
wapp->app_icon->icon->owner = applist->next->wapp->main_window_desc;
|
|
||||||
} else if (applist->prev) {
|
|
||||||
wapp->app_icon->icon->owner = applist->prev->wapp->main_window_desc;
|
|
||||||
} else {
|
|
||||||
wapp->app_icon->icon->owner = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (applist->prev)
|
|
||||||
applist->prev->next = applist->next;
|
|
||||||
|
|
||||||
if (applist->next)
|
|
||||||
applist->next->prev = applist->prev;
|
|
||||||
|
|
||||||
if (applist == wapp->app_icon->applist)
|
|
||||||
wapp->app_icon->applist = applist->next;
|
|
||||||
|
|
||||||
wfree(applist);
|
|
||||||
|
|
||||||
if (wapp->app_icon->applist != NULL)
|
|
||||||
wapp->app_icon->main_window = wapp->app_icon->applist->wapp->main_window;
|
|
||||||
|
|
||||||
return (--wapp->app_icon->num_apps);
|
|
||||||
}
|
|
||||||
applist = applist->next;
|
|
||||||
}
|
|
||||||
return (--wapp->app_icon->num_apps);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -664,14 +617,7 @@ iconDblClick(WObjDescriptor *desc, XEvent *event)
|
|||||||
WScreen *scr = aicon->icon->core->screen_ptr;
|
WScreen *scr = aicon->icon->core->screen_ptr;
|
||||||
int unhideHere;
|
int unhideHere;
|
||||||
|
|
||||||
#ifndef REDUCE_APPICONS
|
|
||||||
assert(aicon->icon->owner!=NULL);
|
assert(aicon->icon->owner!=NULL);
|
||||||
#else
|
|
||||||
if (aicon->icon->owner == NULL) {
|
|
||||||
fprintf(stderr, "Double-click disabled: missing main window.\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
wapp = wApplicationOf(aicon->icon->owner->main_window);
|
wapp = wApplicationOf(aicon->icon->owner->main_window);
|
||||||
#ifdef DEBUG0
|
#ifdef DEBUG0
|
||||||
@@ -680,12 +626,6 @@ iconDblClick(WObjDescriptor *desc, XEvent *event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef REDUCE_APPICONS
|
|
||||||
if (!wapp) {
|
|
||||||
fprintf(stderr, "Double-click disabled: missing wapp.\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif /* REDUCE_APPICONS */
|
|
||||||
|
|
||||||
unhideHere = (event->xbutton.state & ShiftMask);
|
unhideHere = (event->xbutton.state & ShiftMask);
|
||||||
|
|
||||||
@@ -701,6 +641,7 @@ iconDblClick(WObjDescriptor *desc, XEvent *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
appIconMouseDown(WObjDescriptor *desc, XEvent *event)
|
appIconMouseDown(WObjDescriptor *desc, XEvent *event)
|
||||||
{
|
{
|
||||||
@@ -719,6 +660,9 @@ appIconMouseDown(WObjDescriptor *desc, XEvent *event)
|
|||||||
int clickButton = event->xbutton.button;
|
int clickButton = event->xbutton.button;
|
||||||
Pixmap ghost = None;
|
Pixmap ghost = None;
|
||||||
Window wins[2];
|
Window wins[2];
|
||||||
|
Bool movingSingle = False;
|
||||||
|
int oldX = x;
|
||||||
|
int oldY = y;
|
||||||
|
|
||||||
if (aicon->editing || WCHECK_STATE(WSTATE_MODAL))
|
if (aicon->editing || WCHECK_STATE(WSTATE_MODAL))
|
||||||
return;
|
return;
|
||||||
@@ -808,7 +752,12 @@ appIconMouseDown(WObjDescriptor *desc, XEvent *event)
|
|||||||
}
|
}
|
||||||
x = ev.xmotion.x_root - dx;
|
x = ev.xmotion.x_root - dx;
|
||||||
y = ev.xmotion.y_root - dy;
|
y = ev.xmotion.y_root - dy;
|
||||||
XMoveWindow(dpy, icon->core->window, x, y);
|
|
||||||
|
if (movingSingle) {
|
||||||
|
XMoveWindow(dpy, icon->core->window, x, y);
|
||||||
|
} else {
|
||||||
|
wAppIconMove(aicon, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
if (dockable) {
|
if (dockable) {
|
||||||
if (scr->dock && wDockSnapIcon(scr->dock, aicon, x, y,
|
if (scr->dock && wDockSnapIcon(scr->dock, aicon, x, y,
|
||||||
@@ -896,17 +845,31 @@ appIconMouseDown(WObjDescriptor *desc, XEvent *event)
|
|||||||
if (!docked) {
|
if (!docked) {
|
||||||
/* If icon could not be docked, slide it back to the old
|
/* If icon could not be docked, slide it back to the old
|
||||||
* position */
|
* position */
|
||||||
SlideWindow(icon->core->window, x, y, aicon->x_pos,
|
SlideWindow(icon->core->window, x, y, oldX, oldY);
|
||||||
aicon->y_pos);
|
} else {
|
||||||
|
WAppIcon *nextIcon = wAppIconNextSibling(aicon);
|
||||||
|
|
||||||
|
if (nextIcon) {
|
||||||
|
/* move the next instance back to the old position */
|
||||||
|
SlideWindow(nextIcon->icon->core->window, x, y,
|
||||||
|
oldX, oldY);
|
||||||
|
wAppIconMove(nextIcon, oldX, oldY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WSOUND
|
#ifdef WSOUND
|
||||||
wSoundPlay(WSOUND_DOCK);
|
wSoundPlay(WSOUND_DOCK);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
XMoveWindow(dpy, icon->core->window, x, y);
|
if (movingSingle) {
|
||||||
aicon->x_pos = x;
|
/* move back to its place */
|
||||||
aicon->y_pos = y;
|
SlideWindow(icon->core->window, x, y, oldX, oldY);
|
||||||
|
wAppIconMove(aicon, oldX, oldY);
|
||||||
|
} else {
|
||||||
|
XMoveWindow(dpy, icon->core->window, x, y);
|
||||||
|
aicon->x_pos = x;
|
||||||
|
aicon->y_pos = y;
|
||||||
|
}
|
||||||
if (workspace->clip && workspace->clip->auto_raise_lower)
|
if (workspace->clip && workspace->clip->auto_raise_lower)
|
||||||
wDockLower(workspace->clip);
|
wDockLower(workspace->clip);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,13 +31,6 @@
|
|||||||
#include "icon.h"
|
#include "icon.h"
|
||||||
#include "application.h"
|
#include "application.h"
|
||||||
|
|
||||||
#ifdef REDUCE_APPICONS
|
|
||||||
typedef struct WAppIconAppList {
|
|
||||||
struct WAppIconAppList *prev;
|
|
||||||
struct WAppIconAppList *next;
|
|
||||||
WApplication *wapp;
|
|
||||||
} WAppIconAppList;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct WAppIcon {
|
typedef struct WAppIcon {
|
||||||
short xindex;
|
short xindex;
|
||||||
@@ -61,15 +54,7 @@ typedef struct WAppIcon {
|
|||||||
char *wm_instance;
|
char *wm_instance;
|
||||||
pid_t pid; /* for apps launched from the dock */
|
pid_t pid; /* for apps launched from the dock */
|
||||||
Window main_window;
|
Window main_window;
|
||||||
#ifdef REDUCE_APPICONS
|
|
||||||
/* There are a number of assumptions about structures in the code,
|
|
||||||
* but nowhere do I see them explicitly stated. I'll rip this out later.
|
|
||||||
* If applist is not NULL, applist->wapp will always point to a valid
|
|
||||||
* structure. Knowing this removes the need for useless checks....
|
|
||||||
* AS LONG AS NO ONE VIOLATES THIS ASSUMPTION. -cls
|
|
||||||
*/
|
|
||||||
WAppIconAppList *applist; /* list of apps bound to appicon */
|
|
||||||
#endif
|
|
||||||
struct WDock *dock; /* In which dock is docked. */
|
struct WDock *dock; /* In which dock is docked. */
|
||||||
|
|
||||||
struct _AppSettingsPanel *panel; /* Settings Panel */
|
struct _AppSettingsPanel *panel; /* Settings Panel */
|
||||||
@@ -94,9 +79,6 @@ typedef struct WAppIcon {
|
|||||||
|
|
||||||
unsigned int lock:1; /* do not allow to be destroyed */
|
unsigned int lock:1; /* do not allow to be destroyed */
|
||||||
|
|
||||||
#ifdef REDUCE_APPICONS
|
|
||||||
unsigned int num_apps; /* length of applist */
|
|
||||||
#endif
|
|
||||||
} WAppIcon;
|
} WAppIcon;
|
||||||
|
|
||||||
|
|
||||||
@@ -112,7 +94,7 @@ Bool wAppIconChangeImage(WAppIcon *icon, char *file);
|
|||||||
|
|
||||||
void wAppIconMove(WAppIcon *aicon, int x, int y);
|
void wAppIconMove(WAppIcon *aicon, int x, int y);
|
||||||
|
|
||||||
#ifdef REDUCE_APPICONS
|
WAppIcon *wAppIconNextSibling(WAppIcon *icon);
|
||||||
unsigned int wAppIconReduceAppCount(WApplication *wapp);
|
|
||||||
#endif
|
int wAppIconIndexOfInstance(WAppIcon *icon);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ wApplicationCreate(WScreen *scr, Window main_window)
|
|||||||
#endif
|
#endif
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
Window root;
|
Window root;
|
||||||
int foo;
|
int foo;
|
||||||
@@ -300,6 +300,25 @@ wApplicationCreate(WScreen *scr, Window main_window)
|
|||||||
#endif /* USER_MENU */
|
#endif /* USER_MENU */
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
WApplication *tmp = scr->wapp_list;
|
||||||
|
|
||||||
|
wapp->next = NULL;
|
||||||
|
wapp->prev = NULL;
|
||||||
|
|
||||||
|
/* append to app list */
|
||||||
|
if (!tmp) {
|
||||||
|
scr->wapp_list = wapp;
|
||||||
|
} else {
|
||||||
|
while (tmp->next) {
|
||||||
|
tmp = tmp->next;
|
||||||
|
}
|
||||||
|
tmp->next = wapp;
|
||||||
|
wapp->prev = tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set application wide attributes from the leader.
|
* Set application wide attributes from the leader.
|
||||||
*/
|
*/
|
||||||
@@ -341,18 +360,6 @@ wApplicationCreate(WScreen *scr, Window main_window)
|
|||||||
wAppIconPaint(wapp->app_icon);
|
wAppIconPaint(wapp->app_icon);
|
||||||
} else {
|
} else {
|
||||||
wapp->app_icon = wAppIconCreate(wapp->main_window_desc);
|
wapp->app_icon = wAppIconCreate(wapp->main_window_desc);
|
||||||
#ifdef REDUCE_APPICONS
|
|
||||||
/* This is so we get the appearance of invoking the app sitting
|
|
||||||
* on the dock. -cls */
|
|
||||||
if (wapp->app_icon) {
|
|
||||||
if (wapp->app_icon->docked && wapp->app_icon->num_apps == 1) {
|
|
||||||
wapp->app_icon->launching = 0;
|
|
||||||
wapp->app_icon->running = 1;
|
|
||||||
wapp->app_icon->icon->force_paint = 1;
|
|
||||||
wAppIconPaint(wapp->app_icon);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
wapp->app_icon = NULL;
|
wapp->app_icon = NULL;
|
||||||
@@ -362,14 +369,7 @@ wApplicationCreate(WScreen *scr, Window main_window)
|
|||||||
wapp->app_icon->main_window = main_window;
|
wapp->app_icon->main_window = main_window;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef REDUCE_APPICONS
|
|
||||||
if (wapp->app_icon && !wapp->app_icon->docked) {
|
if (wapp->app_icon && !wapp->app_icon->docked) {
|
||||||
#else
|
|
||||||
if (wapp->app_icon && !wapp->app_icon->docked && wapp->app_icon->num_apps == 1) {
|
|
||||||
#ifdef THIS_SUCKS
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
WIcon *icon = wapp->app_icon->icon;
|
WIcon *icon = wapp->app_icon->icon;
|
||||||
WDock *clip = scr->workspaces[scr->current_workspace]->clip;
|
WDock *clip = scr->workspaces[scr->current_workspace]->clip;
|
||||||
int x=0, y=0;
|
int x=0, y=0;
|
||||||
@@ -407,12 +407,6 @@ wApplicationCreate(WScreen *scr, Window main_window)
|
|||||||
extractClientIcon(wapp->app_icon);
|
extractClientIcon(wapp->app_icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
wapp->prev = NULL;
|
|
||||||
wapp->next = scr->wapp_list;
|
|
||||||
if (scr->wapp_list)
|
|
||||||
scr->wapp_list->prev = wapp;
|
|
||||||
scr->wapp_list = wapp;
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef WSOUND
|
#ifdef WSOUND
|
||||||
wSoundPlay(WSOUND_APPSTART);
|
wSoundPlay(WSOUND_APPSTART);
|
||||||
@@ -431,9 +425,6 @@ wApplicationDestroy(WApplication *wapp)
|
|||||||
Window main_window;
|
Window main_window;
|
||||||
WWindow *wwin;
|
WWindow *wwin;
|
||||||
WScreen *scr;
|
WScreen *scr;
|
||||||
#ifdef REDUCE_APPICONS
|
|
||||||
unsigned int napps;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!wapp)
|
if (!wapp)
|
||||||
return;
|
return;
|
||||||
@@ -445,9 +436,6 @@ wApplicationDestroy(WApplication *wapp)
|
|||||||
|
|
||||||
scr = wapp->main_window_desc->screen_ptr;
|
scr = wapp->main_window_desc->screen_ptr;
|
||||||
main_window = wapp->main_window;
|
main_window = wapp->main_window;
|
||||||
#ifdef REDUCE_APPICONS
|
|
||||||
napps = wAppIconReduceAppCount(wapp);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (wapp == scr->wapp_list) {
|
if (wapp == scr->wapp_list) {
|
||||||
if (wapp->next)
|
if (wapp->next)
|
||||||
@@ -464,39 +452,21 @@ wApplicationDestroy(WApplication *wapp)
|
|||||||
wAppMenuDestroy(wapp->menu);
|
wAppMenuDestroy(wapp->menu);
|
||||||
if (wapp->app_icon) {
|
if (wapp->app_icon) {
|
||||||
if (wapp->app_icon->docked && !wapp->app_icon->attracted) {
|
if (wapp->app_icon->docked && !wapp->app_icon->attracted) {
|
||||||
#ifdef REDUCE_APPICONS
|
wapp->app_icon->running = 0;
|
||||||
if (napps == 0) {
|
/* since we keep it, we don't care if it was attracted or not */
|
||||||
#endif
|
wapp->app_icon->attracted = 0;
|
||||||
wapp->app_icon->running = 0;
|
wapp->app_icon->icon->shadowed = 0;
|
||||||
/* since we keep it, we don't care if it was attracted or not */
|
wapp->app_icon->main_window = None;
|
||||||
wapp->app_icon->attracted = 0;
|
wapp->app_icon->pid = 0;
|
||||||
wapp->app_icon->icon->shadowed = 0;
|
wapp->app_icon->icon->owner = NULL;
|
||||||
wapp->app_icon->main_window = None;
|
wapp->app_icon->icon->icon_win = None;
|
||||||
wapp->app_icon->pid = 0;
|
wapp->app_icon->icon->force_paint = 1;
|
||||||
wapp->app_icon->icon->owner = NULL;
|
wAppIconPaint(wapp->app_icon);
|
||||||
wapp->app_icon->icon->icon_win = None;
|
|
||||||
wapp->app_icon->icon->force_paint = 1;
|
|
||||||
wAppIconPaint(wapp->app_icon);
|
|
||||||
#ifdef REDUCE_APPICONS
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
} else if (wapp->app_icon->docked) {
|
} else if (wapp->app_icon->docked) {
|
||||||
#ifdef REDUCE_APPICONS
|
wapp->app_icon->running = 0;
|
||||||
if (napps == 0) {
|
wDockDetach(wapp->app_icon->dock, wapp->app_icon);
|
||||||
#endif
|
|
||||||
wapp->app_icon->running = 0;
|
|
||||||
wDockDetach(wapp->app_icon->dock, wapp->app_icon);
|
|
||||||
#ifdef REDUCE_APPICONS
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
#ifdef REDUCE_APPICONS
|
wAppIconDestroy(wapp->app_icon);
|
||||||
if (napps == 0) {
|
|
||||||
#endif
|
|
||||||
wAppIconDestroy(wapp->app_icon);
|
|
||||||
#ifdef REDUCE_APPICONS
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wwin = wWindowFor(wapp->main_window_desc->client_win);
|
wwin = wWindowFor(wapp->main_window_desc->client_win);
|
||||||
@@ -523,3 +493,58 @@ wApplicationDestroy(WApplication *wapp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns index number of the app in case there are more than
|
||||||
|
* one instance of the same class/name.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
wApplicationIndexOfInstance(WApplication *app)
|
||||||
|
{
|
||||||
|
WApplication *list = app->main_window_desc->screen_ptr->wapp_list;
|
||||||
|
int index = 0;
|
||||||
|
WWindow *wwin = app->main_window_desc;
|
||||||
|
|
||||||
|
while (list) {
|
||||||
|
if (app == list)
|
||||||
|
return index;
|
||||||
|
|
||||||
|
if (strcmp(wwin->wm_instance,
|
||||||
|
list->main_window_desc->wm_instance) == 0
|
||||||
|
&&
|
||||||
|
strcmp(wwin->wm_class,
|
||||||
|
list->main_window_desc->wm_class) == 0)
|
||||||
|
index++;
|
||||||
|
|
||||||
|
list = list->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
puts("OH SHIT!?!?!? HOW THE FUCK DID WE GET HERE!?!?!?!?!");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Bool
|
||||||
|
wApplicationHasMultiInstances(WApplication *app)
|
||||||
|
{
|
||||||
|
WApplication *list = app->main_window_desc->screen_ptr->wapp_list;
|
||||||
|
int index = 0;
|
||||||
|
WWindow *wwin = app->main_window_desc;
|
||||||
|
|
||||||
|
while (list) {
|
||||||
|
if (strcmp(wwin->wm_instance,
|
||||||
|
list->main_window_desc->wm_instance) == 0
|
||||||
|
&&
|
||||||
|
strcmp(wwin->wm_class,
|
||||||
|
list->main_window_desc->wm_class) == 0)
|
||||||
|
index++;
|
||||||
|
|
||||||
|
if (index == 2)
|
||||||
|
return True;
|
||||||
|
|
||||||
|
list = list->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,9 +55,13 @@ void wApplicationDestroy(WApplication *wapp);
|
|||||||
|
|
||||||
WApplication *wApplicationOf(Window window);
|
WApplication *wApplicationOf(Window window);
|
||||||
|
|
||||||
|
Bool wApplicationHasMultiInstances(WApplication *app);
|
||||||
|
|
||||||
void wApplicationExtractDirPackIcon(WScreen *scr,char *path, char *wm_instance,
|
void wApplicationExtractDirPackIcon(WScreen *scr,char *path, char *wm_instance,
|
||||||
char *wm_class);
|
char *wm_class);
|
||||||
|
|
||||||
|
int wApplicationIndexOfInstance(WApplication *app);
|
||||||
|
|
||||||
|
|
||||||
#ifdef NEWAPPICON
|
#ifdef NEWAPPICON
|
||||||
|
|
||||||
|
|||||||
28
src/client.c
28
src/client.c
@@ -297,6 +297,8 @@ wClientKill(WWindow *wwin)
|
|||||||
XFlush(dpy);
|
XFlush(dpy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*----------------------------------------------------------------------
|
*----------------------------------------------------------------------
|
||||||
* wClientCheckProperty--
|
* wClientCheckProperty--
|
||||||
@@ -316,30 +318,18 @@ wClientCheckProperty(WWindow *wwin, XPropertyEvent *event)
|
|||||||
XWindowAttributes attribs;
|
XWindowAttributes attribs;
|
||||||
XWMHints *new_hints;
|
XWMHints *new_hints;
|
||||||
int i, g1, g2;
|
int i, g1, g2;
|
||||||
char *tmp;
|
char *tmp = NULL;
|
||||||
|
|
||||||
switch (event->atom) {
|
switch (event->atom) {
|
||||||
case XA_WM_NAME:
|
case XA_WM_NAME:
|
||||||
/* window title was changed */
|
/* window title was changed */
|
||||||
wwin->flags.wm_name_changed = 1;
|
if (!wFetchName(dpy, wwin->client_win, &tmp)) {
|
||||||
if (wwin->frame) {
|
wWindowUpdateName(wwin, NULL);
|
||||||
if (!wFetchName(dpy, wwin->client_win, &tmp)) {
|
} else {
|
||||||
/* the hint was removed */
|
wWindowUpdateName(wwin, tmp);
|
||||||
tmp = wstrdup(DEF_WINDOW_TITLE);
|
|
||||||
#ifdef KWM_HINTS
|
|
||||||
wKWMSendEventMessage(wwin, WKWMChangedClient);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
if (wFrameWindowChangeTitle(wwin->frame, tmp)) {
|
|
||||||
/* only update the menu if the title has actually changed */
|
|
||||||
UpdateSwitchMenu(wwin->screen_ptr, wwin, ACTION_CHANGE);
|
|
||||||
#ifdef KWM_HINTS
|
|
||||||
wKWMSendEventMessage(wwin, WKWMChangedClient);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
if (tmp)
|
|
||||||
wfree(tmp);
|
|
||||||
}
|
}
|
||||||
|
if (tmp)
|
||||||
|
XFree(tmp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XA_WM_ICON_NAME:
|
case XA_WM_ICON_NAME:
|
||||||
|
|||||||
73
src/dock.c
73
src/dock.c
@@ -237,13 +237,7 @@ static void
|
|||||||
killCallback(WMenu *menu, WMenuEntry *entry)
|
killCallback(WMenu *menu, WMenuEntry *entry)
|
||||||
{
|
{
|
||||||
WAppIcon *icon;
|
WAppIcon *icon;
|
||||||
#ifdef REDUCE_APPICONS
|
|
||||||
WAppIconAppList *tapplist;
|
|
||||||
|
|
||||||
extern Atom _XA_WM_DELETE_WINDOW;
|
|
||||||
#else
|
|
||||||
char *buffer;
|
char *buffer;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!WCHECK_STATE(WSTATE_NORMAL))
|
if (!WCHECK_STATE(WSTATE_NORMAL))
|
||||||
return;
|
return;
|
||||||
@@ -256,23 +250,6 @@ killCallback(WMenu *menu, WMenuEntry *entry)
|
|||||||
|
|
||||||
WCHANGE_STATE(WSTATE_MODAL);
|
WCHANGE_STATE(WSTATE_MODAL);
|
||||||
|
|
||||||
#ifdef REDUCE_APPICONS
|
|
||||||
/* Send a delete message to the main window of each application
|
|
||||||
* bound to this docked appicon. - cls
|
|
||||||
*/
|
|
||||||
tapplist = icon->applist;
|
|
||||||
while (tapplist != NULL) {
|
|
||||||
if (tapplist->wapp->main_window_desc != NULL) {
|
|
||||||
if (tapplist->wapp->main_window_desc->protocols.DELETE_WINDOW) {
|
|
||||||
wClientSendProtocol(tapplist->wapp->main_window_desc,
|
|
||||||
_XA_WM_DELETE_WINDOW, CurrentTime);
|
|
||||||
} else {
|
|
||||||
wClientKill(tapplist->wapp->main_window_desc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tapplist = tapplist->next;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
buffer = wstrconcat(icon->wm_class,
|
buffer = wstrconcat(icon->wm_class,
|
||||||
_(" will be forcibly closed.\n"
|
_(" will be forcibly closed.\n"
|
||||||
"Any unsaved changes will be lost.\n"
|
"Any unsaved changes will be lost.\n"
|
||||||
@@ -287,7 +264,6 @@ killCallback(WMenu *menu, WMenuEntry *entry)
|
|||||||
}
|
}
|
||||||
|
|
||||||
wfree(buffer);
|
wfree(buffer);
|
||||||
#endif /* !REDUCE_APPICONS */
|
|
||||||
|
|
||||||
icon->editing = 0;
|
icon->editing = 0;
|
||||||
|
|
||||||
@@ -1988,23 +1964,6 @@ wDockDoAutoLaunch(WDock *dock, int workspace)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef REDUCE_APPICONS
|
|
||||||
void
|
|
||||||
wDockSimulateLaunch(WDock *dock, WAppIcon *btn)
|
|
||||||
{
|
|
||||||
if ((btn == NULL) || (dock == NULL))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!btn->running) {
|
|
||||||
if ((btn->icon->owner == NULL) && (btn->applist))
|
|
||||||
btn->icon->owner = btn->applist->wapp->main_window_desc;
|
|
||||||
if (!btn->forced_dock)
|
|
||||||
btn->launching = 1;
|
|
||||||
dockIconPaint(btn);
|
|
||||||
wusleep(5000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef OFFIX_DND
|
#ifdef OFFIX_DND
|
||||||
static WDock*
|
static WDock*
|
||||||
@@ -2389,11 +2348,7 @@ wDockDetach(WDock *dock, WAppIcon *icon)
|
|||||||
/* if the dock is not attached to an application or
|
/* if the dock is not attached to an application or
|
||||||
* the the application did not set the approriate hints yet,
|
* the the application did not set the approriate hints yet,
|
||||||
* destroy the icon */
|
* destroy the icon */
|
||||||
#ifdef REDUCE_APPICONS
|
|
||||||
if ((icon->num_apps == 0) && (!icon->running || !wApplicationOf(icon->main_window)) )
|
|
||||||
#else
|
|
||||||
if (!icon->running || !wApplicationOf(icon->main_window))
|
if (!icon->running || !wApplicationOf(icon->main_window))
|
||||||
#endif
|
|
||||||
wAppIconDestroy(icon);
|
wAppIconDestroy(icon);
|
||||||
else {
|
else {
|
||||||
icon->icon->core->descriptor.handle_mousedown = appIconMouseDown;
|
icon->icon->core->descriptor.handle_mousedown = appIconMouseDown;
|
||||||
@@ -2407,6 +2362,14 @@ wDockDetach(WDock *dock, WAppIcon *icon)
|
|||||||
wAppIconPaint(icon);
|
wAppIconPaint(icon);
|
||||||
if (wPreferences.auto_arrange_icons) {
|
if (wPreferences.auto_arrange_icons) {
|
||||||
wArrangeIcons(dock->screen_ptr, True);
|
wArrangeIcons(dock->screen_ptr, True);
|
||||||
|
} else {
|
||||||
|
WAppIcon *bla = wAppIconNextSibling(icon);
|
||||||
|
|
||||||
|
if (bla) {
|
||||||
|
SlideWindow(icon->icon->core->window, icon->x_pos, icon->y_pos,
|
||||||
|
bla->x_pos, bla->y_pos);
|
||||||
|
wAppIconMove(icon, bla->x_pos, bla->y_pos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dock->auto_collapse || dock->auto_raise_lower)
|
if (dock->auto_collapse || dock->auto_raise_lower)
|
||||||
@@ -3118,9 +3081,6 @@ void
|
|||||||
wDockTrackWindowLaunch(WDock *dock, Window window)
|
wDockTrackWindowLaunch(WDock *dock, Window window)
|
||||||
{
|
{
|
||||||
WAppIcon *icon;
|
WAppIcon *icon;
|
||||||
#ifdef REDUCE_APPICONS
|
|
||||||
WAppIconAppList *tapplist;
|
|
||||||
#endif
|
|
||||||
char *wm_class, *wm_instance;
|
char *wm_class, *wm_instance;
|
||||||
int i;
|
int i;
|
||||||
Bool firstPass = True;
|
Bool firstPass = True;
|
||||||
@@ -3186,16 +3146,6 @@ retry:
|
|||||||
if (!icon->forced_dock)
|
if (!icon->forced_dock)
|
||||||
icon->main_window = window;
|
icon->main_window = window;
|
||||||
|
|
||||||
#ifdef REDUCE_APPICONS
|
|
||||||
tapplist = wmalloc(sizeof(WAppIconAppList));
|
|
||||||
memset(tapplist, 0, sizeof(WAppIconAppList));
|
|
||||||
tapplist->next = icon->applist;
|
|
||||||
if (icon->applist)
|
|
||||||
icon->applist->prev = tapplist;
|
|
||||||
icon->applist = tapplist;
|
|
||||||
tapplist->wapp = wApplicationOf(window);
|
|
||||||
icon->num_apps++;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
found = True;
|
found = True;
|
||||||
wDockFinishLaunch(dock, icon);
|
wDockFinishLaunch(dock, icon);
|
||||||
@@ -3528,14 +3478,7 @@ iconDblClick(WObjDescriptor *desc, XEvent *event)
|
|||||||
WApplication *wapp = NULL;
|
WApplication *wapp = NULL;
|
||||||
int unhideHere = 0;
|
int unhideHere = 0;
|
||||||
|
|
||||||
#ifdef REDUCE_APPICONS
|
|
||||||
if ((btn->icon->owner && !(event->xbutton.state & ControlMask)) ||
|
|
||||||
((btn->icon->owner == NULL) && (btn->applist != NULL))) {
|
|
||||||
if (btn->icon->owner == NULL)
|
|
||||||
btn->icon->owner = btn->applist->wapp->main_window_desc;
|
|
||||||
#else
|
|
||||||
if (btn->icon->owner && !(event->xbutton.state & ControlMask)) {
|
if (btn->icon->owner && !(event->xbutton.state & ControlMask)) {
|
||||||
#endif
|
|
||||||
wapp = wApplicationOf(btn->icon->owner->main_window);
|
wapp = wApplicationOf(btn->icon->owner->main_window);
|
||||||
|
|
||||||
assert(wapp!=NULL);
|
assert(wapp!=NULL);
|
||||||
|
|||||||
@@ -480,14 +480,9 @@ handleMapRequest(XEvent *ev)
|
|||||||
} else if (wwin->flags.hidden) {
|
} else if (wwin->flags.hidden) {
|
||||||
WApplication *wapp = wApplicationOf(wwin->main_window);
|
WApplication *wapp = wApplicationOf(wwin->main_window);
|
||||||
/* go to the last workspace that the user worked on the app */
|
/* go to the last workspace that the user worked on the app */
|
||||||
#ifndef REDUCE_APPICONS
|
|
||||||
/* This severely breaks REDUCE_APPICONS. last_workspace is a neat
|
|
||||||
* concept but it needs to be reworked to handle REDUCE_APPICONS -cls
|
|
||||||
*/
|
|
||||||
if (wapp) {
|
if (wapp) {
|
||||||
wWorkspaceChange(wwin->screen_ptr, wapp->last_workspace);
|
wWorkspaceChange(wwin->screen_ptr, wapp->last_workspace);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
wUnhideApplication(wapp, False, False);
|
wUnhideApplication(wapp, False, False);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1014,11 +1014,10 @@ wFrameWindowPaint(WFrameWindow *fwin)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (fwin->title && fwin->titlebar && !fwin->flags.repaint_only_resizebar) {
|
if (fwin->titlebar && !fwin->flags.repaint_only_resizebar) {
|
||||||
int x, w;
|
int x, w;
|
||||||
int lofs = 6, rofs = 6;
|
int lofs = 6, rofs = 6;
|
||||||
int titlelen;
|
int titlelen;
|
||||||
char *title;
|
|
||||||
int allButtons = 1;
|
int allButtons = 1;
|
||||||
|
|
||||||
|
|
||||||
@@ -1049,36 +1048,40 @@ wFrameWindowPaint(WFrameWindow *fwin)
|
|||||||
scr->b_pixmaps[WBUT_XKBGROUP1 + fwin->languagemode];
|
scr->b_pixmaps[WBUT_XKBGROUP1 + fwin->languagemode];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
title = ShrinkString(*fwin->font, fwin->title,
|
if (fwin->title) {
|
||||||
fwin->titlebar->width - lofs - rofs);
|
char *title;
|
||||||
titlelen = strlen(title);
|
|
||||||
w = WMWidthOfString(*fwin->font, title, titlelen);
|
title = ShrinkString(*fwin->font, fwin->title,
|
||||||
|
fwin->titlebar->width - lofs - rofs);
|
||||||
switch (fwin->flags.justification) {
|
titlelen = strlen(title);
|
||||||
case WTJ_LEFT:
|
w = WMWidthOfString(*fwin->font, title, titlelen);
|
||||||
x = lofs;
|
|
||||||
break;
|
switch (fwin->flags.justification) {
|
||||||
|
case WTJ_LEFT:
|
||||||
case WTJ_RIGHT:
|
x = lofs;
|
||||||
x = fwin->titlebar->width - w - rofs;
|
break;
|
||||||
break;
|
|
||||||
|
case WTJ_RIGHT:
|
||||||
default:
|
x = fwin->titlebar->width - w - rofs;
|
||||||
if (!allButtons)
|
break;
|
||||||
x = lofs + (fwin->titlebar->width - w - lofs - rofs) / 2;
|
|
||||||
else
|
default:
|
||||||
x = (fwin->titlebar->width - w) / 2;
|
if (!allButtons)
|
||||||
break;
|
x = lofs + (fwin->titlebar->width - w - lofs - rofs) / 2;
|
||||||
|
else
|
||||||
|
x = (fwin->titlebar->width - w) / 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
XSetForeground(dpy, *fwin->title_gc,
|
||||||
|
fwin->title_pixel[fwin->flags.state]);
|
||||||
|
|
||||||
|
WMDrawString(scr->wmscreen, fwin->titlebar->window,
|
||||||
|
*fwin->title_gc, *fwin->font, x, *fwin->title_clearance + TITLEBAR_EXTEND_SPACE,
|
||||||
|
title, titlelen);
|
||||||
|
|
||||||
|
wfree(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
XSetForeground(dpy, *fwin->title_gc,
|
|
||||||
fwin->title_pixel[fwin->flags.state]);
|
|
||||||
|
|
||||||
WMDrawString(scr->wmscreen, fwin->titlebar->window,
|
|
||||||
*fwin->title_gc, *fwin->font, x, *fwin->title_clearance + TITLEBAR_EXTEND_SPACE,
|
|
||||||
title, titlelen);
|
|
||||||
|
|
||||||
wfree(title);
|
|
||||||
|
|
||||||
if (fwin->left_button)
|
if (fwin->left_button)
|
||||||
handleButtonExpose(&fwin->left_button->descriptor, NULL);
|
handleButtonExpose(&fwin->left_button->descriptor, NULL);
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ wFrameWindowCreate(WScreen *scr, int wlevel, int x, int y,
|
|||||||
union WTexture **title_texture,
|
union WTexture **title_texture,
|
||||||
union WTexture **resize_texture,
|
union WTexture **resize_texture,
|
||||||
unsigned long *color,
|
unsigned long *color,
|
||||||
GC *gc, WMFont **font);
|
GC *gc, WMFont **font);
|
||||||
|
|
||||||
void wFrameWindowUpdateBorders(WFrameWindow *fwin, int flags);
|
void wFrameWindowUpdateBorders(WFrameWindow *fwin, int flags);
|
||||||
|
|
||||||
|
|||||||
57
src/window.c
57
src/window.c
@@ -518,6 +518,7 @@ wWindowObscuresWindow(WWindow *wwin, WWindow *obscured)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*----------------------------------------------------------------
|
*----------------------------------------------------------------
|
||||||
* wManageWindow--
|
* wManageWindow--
|
||||||
@@ -1020,9 +1021,6 @@ wManageWindow(WScreen *scr, Window window)
|
|||||||
wFrameWindowUpdatePushButton(wwin->frame, True);
|
wFrameWindowUpdatePushButton(wwin->frame, True);
|
||||||
#endif /* OLWM_HINTS */
|
#endif /* OLWM_HINTS */
|
||||||
|
|
||||||
wFrameWindowChangeTitle(wwin->frame, title ? title : DEF_WINDOW_TITLE);
|
|
||||||
if (title)
|
|
||||||
XFree(title);
|
|
||||||
|
|
||||||
wwin->frame->workspace = workspace;
|
wwin->frame->workspace = workspace;
|
||||||
|
|
||||||
@@ -1211,6 +1209,12 @@ wManageWindow(WScreen *scr, Window window)
|
|||||||
wwin->prev = NULL;
|
wwin->prev = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Update name must come after WApplication stuff is done */
|
||||||
|
wWindowUpdateName(wwin, title);
|
||||||
|
if (title)
|
||||||
|
XFree(title);
|
||||||
|
|
||||||
|
|
||||||
#ifdef GNOME_STUFF
|
#ifdef GNOME_STUFF
|
||||||
wGNOMEUpdateClientStateHint(wwin, True);
|
wGNOMEUpdateClientStateHint(wwin, True);
|
||||||
#endif
|
#endif
|
||||||
@@ -1755,6 +1759,53 @@ wWindowUnfocus(WWindow *wwin)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
wWindowUpdateName(WWindow *wwin, char *newTitle)
|
||||||
|
{
|
||||||
|
WApplication *app = wApplicationOf(wwin->main_window);
|
||||||
|
int instIndex = 0;
|
||||||
|
Bool res;
|
||||||
|
char prefix[32] = "";
|
||||||
|
char *tmp, *title;
|
||||||
|
|
||||||
|
if (!wwin->frame)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (app)
|
||||||
|
instIndex = wApplicationIndexOfInstance(app);
|
||||||
|
|
||||||
|
|
||||||
|
wwin->flags.wm_name_changed = 1;
|
||||||
|
|
||||||
|
if (!newTitle) {
|
||||||
|
/* the hint was removed */
|
||||||
|
title = DEF_WINDOW_TITLE;
|
||||||
|
|
||||||
|
#ifdef KWM_HINTS
|
||||||
|
wKWMSendEventMessage(wwin, WKWMChangedClient);
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
title = newTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (instIndex > 0) {
|
||||||
|
sprintf(prefix, " [%i]", instIndex);
|
||||||
|
|
||||||
|
title = wstrconcat(title, prefix);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wFrameWindowChangeTitle(wwin->frame, title)) {
|
||||||
|
/* only update the menu if the title has actually changed */
|
||||||
|
UpdateSwitchMenu(wwin->screen_ptr, wwin, ACTION_CHANGE);
|
||||||
|
#ifdef KWM_HINTS
|
||||||
|
wKWMSendEventMessage(wwin, WKWMChangedClient);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
if (instIndex > 0)
|
||||||
|
wfree(title);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*----------------------------------------------------------------------
|
*----------------------------------------------------------------------
|
||||||
|
|||||||
@@ -347,6 +347,8 @@ void wUnmanageWindow(WWindow *wwin, Bool restore, Bool destroyed);
|
|||||||
|
|
||||||
void wWindowFocus(WWindow *wwin, WWindow *owin);
|
void wWindowFocus(WWindow *wwin, WWindow *owin);
|
||||||
void wWindowUnfocus(WWindow *wwin);
|
void wWindowUnfocus(WWindow *wwin);
|
||||||
|
|
||||||
|
void wWindowUpdateName(WWindow *wwin, char *newTitle);
|
||||||
void wWindowConstrainSize(WWindow *wwin, int *nwidth, int *nheight);
|
void wWindowConstrainSize(WWindow *wwin, int *nwidth, int *nheight);
|
||||||
void wWindowConfigure(WWindow *wwin, int req_x, int req_y,
|
void wWindowConfigure(WWindow *wwin, int req_x, int req_y,
|
||||||
int req_width, int req_height);
|
int req_width, int req_height);
|
||||||
|
|||||||
Reference in New Issue
Block a user