Read the WM_COMMAND property for all group members + shuffle some code around.

SVN revision: 10678
This commit is contained in:
Kim Woelders 2004-07-04 08:47:28 +00:00
parent db4f69d892
commit 7a0880253e
5 changed files with 72 additions and 69 deletions

View File

@ -2350,6 +2350,7 @@ void ICCCM_GetInfo(EWin * ewin, Atom atom_change);
void ICCCM_GetHints(EWin * ewin, Atom atom_change);
void ICCCM_GetShapeInfo(EWin * ewin);
void ICCCM_SetIconSizes(void);
void ICCCM_ProcessPropertyChange(EWin * ewin, Atom atom_change);
void ICCCM_SetEInfo(EWin * ewin);
int ICCCM_GetEInfo(EWin * ewin);
void ICCCM_SetMainEInfo(void);

View File

@ -968,11 +968,6 @@ HandleProperty(XEvent * ev)
EwinChangesStart(ewin);
HintsProcessPropertyChange(ewin, ev->xproperty.atom);
ICCCM_GetTitle(ewin, ev->xproperty.atom);
ICCCM_GetHints(ewin, ev->xproperty.atom);
ICCCM_GetInfo(ewin, ev->xproperty.atom);
ICCCM_Cmap(ewin);
ICCCM_GetGeoms(ewin, ev->xproperty.atom);
SessionGetInfo(ewin, ev->xproperty.atom);
SyncBorderToEwin(ewin);

View File

@ -295,13 +295,25 @@ HintsDelWindowHints(EWin * ewin)
void
HintsProcessPropertyChange(EWin * ewin, Atom atom_change)
{
char *name;
EDBUG(6, "HintsHandlePropertyChange");
#if 0 /* No! - ENABLE_GNOME */
GNOME_GetHints(ewin, atom_change);
#endif
name = XGetAtomName(disp, atom_change);
if (name == NULL)
EDBUG_RETURN_;
if (!memcmp(name, "WM_", 3))
ICCCM_ProcessPropertyChange(ewin, atom_change);
#if ENABLE_EWMH
EWMH_ProcessPropertyChange(ewin, atom_change);
else if (!memcmp(name, "_NET_", 5))
EWMH_ProcessPropertyChange(ewin, atom_change);
#endif
#if 0 /* No! - ENABLE_GNOME */
else if (!memcmp(name, "_WIN_", 5))
GNOME_GetHints(ewin, atom_change);
#endif
XFree(name);
EDBUG_RETURN_;
}

View File

@ -41,7 +41,6 @@ static Atom E_XA_WM_WINDOW_ROLE = 0;
static Atom E_XA_WM_HINTS = 0;
static Atom E_XA_WM_CLIENT_LEADER = 0;
static Atom E_XA_WM_TRANSIENT_FOR = 0;
static Atom E_XA_WM_ICON_SIZE = 0;
void
ICCCM_Init(void)
@ -63,7 +62,6 @@ ICCCM_Init(void)
E_XA_WM_HINTS = XInternAtom(disp, "WM_HINTS", False);
E_XA_WM_CLIENT_LEADER = XInternAtom(disp, "WM_CLIENT_LEADER", False);
E_XA_WM_TRANSIENT_FOR = XInternAtom(disp, "WM_TRANSIENT_FOR", False);
E_XA_WM_ICON_SIZE = XInternAtom(disp, "WM_ICON_SIZE", False);
if (Mode.wm.window)
{
@ -708,13 +706,41 @@ ICCCM_GetGeoms(EWin * ewin, Atom atom_change)
EDBUG_RETURN_;
}
static char *
WinGetWMCommand(Window win)
{
int cargc, i, size;
char **cargv, *s;
s = NULL;
if (!XGetCommand(disp, win, &cargv, &cargc))
return NULL;
if (cargc <= 0)
return NULL;
size = strlen(cargv[0]) + 1;
s = Emalloc(size);
strcpy(s, cargv[0]);
for (i = 1; i < cargc; i++)
{
size += strlen(cargv[i]) + 1;
s = Erealloc(s, size);
strcat(s, " ");
strcat(s, cargv[i]);
}
XFreeStringList(cargv);
return s;
}
void
ICCCM_GetInfo(EWin * ewin, Atom atom_change)
{
XClassHint hint;
XTextProperty xtp;
int cargc, i, size;
char **cargv, *s;
int size;
char *s;
EDBUG(6, "ICCCM_GetInfo");
@ -737,59 +763,10 @@ ICCCM_GetInfo(EWin * ewin, Atom atom_change)
{
FREE_AND_CLEAR(ewin->icccm.wm_command);
if (XGetCommand(disp, ewin->client.win, &cargv, &cargc))
{
if (cargc > 0)
{
size = strlen(cargv[0]) + 1;
s = Emalloc(size);
strcpy(s, cargv[0]);
for (i = 1; i < cargc; i++)
{
size += strlen(cargv[i]) + 1;
s = Erealloc(s, size);
strcat(s, " ");
strcat(s, cargv[i]);
}
XFreeStringList(cargv);
ewin->icccm.wm_command = s;
}
}
else if (XGetCommand(disp, ewin->client.group, &cargv, &cargc))
{
EWin *const *lst;
int lnum, ok = 1;
ewin->icccm.wm_command = WinGetWMCommand(ewin->client.win);
lst = EwinListGetAll(&lnum);
for (i = 0; i < lnum; i++)
{
if ((lst[i] != ewin)
&& (lst[i]->client.group == ewin->client.group))
{
ok = 0;
i = lnum;
}
}
if (cargc > 0)
{
if (ok)
{
size = strlen(cargv[0]) + 1;
s = Emalloc(size);
strcpy(s, cargv[0]);
for (i = 1; i < cargc; i++)
{
size += strlen(cargv[i]) + 1;
s = Erealloc(s, size);
strcat(s, " ");
strcat(s, cargv[i]);
}
ewin->icccm.wm_command = s;
}
XFreeStringList(cargv);
}
}
if (!ewin->icccm.wm_command && ewin->client.win != ewin->client.group)
ewin->icccm.wm_command = WinGetWMCommand(ewin->client.group);
}
if (atom_change == 0 || atom_change == E_XA_WM_CLIENT_MACHINE)
@ -1075,6 +1052,23 @@ ICCCM_SetIconSizes()
EDBUG_RETURN_;
}
/*
* Process received window property change
*/
void
ICCCM_ProcessPropertyChange(EWin * ewin, Atom atom_change)
{
EDBUG(6, "ICCCM_ProcessPropertyChange");
ICCCM_GetTitle(ewin, atom_change);
ICCCM_GetHints(ewin, atom_change);
ICCCM_GetInfo(ewin, atom_change);
ICCCM_Cmap(ewin);
ICCCM_GetGeoms(ewin, atom_change);
EDBUG_RETURN_;
}
void
ICCCM_SetEInfo(EWin * ewin)
{

View File

@ -5746,9 +5746,9 @@ EwinShowInfo2(const EWin * ewin)
"Container window %#10lx\n"
"Border %s lrtb %i,%i,%i,%i\n"
"Icon window, pixmap, mask %#10lx, %#10lx, %#10lx\n"
"Is client group leader %i Client group leader %#10lx\n"
"Has transients %i Transient type %i Transient for %#10lx\n"
"No resize H/V %i/%i Shaped %i\n"
"Is group leader %i Window group leader %#lx Client leader %#10lx\n"
"Has transients %i Transient type %i Transient for %#10lx\n"
"No resize H/V %i/%i Shaped %i\n"
"Base, min, max, inc w/h %ix%i, %ix%i, %ix%i %ix%i\n"
"Aspect min, max %5.5f, %5.5f\n"
"MWM border %i resizeh %i title %i menu %i minimize %i maximize %i\n"
@ -5772,7 +5772,8 @@ EwinShowInfo2(const EWin * ewin)
border->border.top, border->border.bottom,
ewin->client.icon_win,
ewin->client.icon_pmap, ewin->client.icon_mask,
ewin->client.is_group_leader, ewin->client.group,
ewin->client.is_group_leader,
ewin->client.group, ewin->client.client_leader,
ewin->has_transients,
ewin->client.transient, ewin->client.transient_for,
ewin->client.no_resize_h, ewin->client.no_resize_v,