Clean up setting internal window name/class hints.
SVN revision: 10320
This commit is contained in:
parent
7b5aad2708
commit
a917263310
8
src/E.h
8
src/E.h
|
@ -2068,8 +2068,9 @@ void EWMH_SetDesktopViewport(void);
|
|||
void EWMH_SetWorkArea(void);
|
||||
void EWMH_SetClientList(void);
|
||||
void EWMH_SetClientStacking(void);
|
||||
void EWMH_SetActiveWindow(const EWin * ewin);
|
||||
void EWMH_SetActiveWindow(Window win);
|
||||
void EWMH_SetShowingDesktop(int on);
|
||||
void EWMH_SetWindowName(Window win, const char *name);
|
||||
void EWMH_SetWindowDesktop(const EWin * ewin);
|
||||
void EWMH_SetWindowState(const EWin * ewin);
|
||||
void EWMH_GetWindowName(EWin * ewin);
|
||||
|
@ -2247,7 +2248,10 @@ void HintsSetCurrentDesktop(void);
|
|||
void HintsSetDesktopViewport(void);
|
||||
void HintsSetClientList(void);
|
||||
void HintsSetClientStacking(void);
|
||||
void HintsSetActiveWindow(EWin * ewin);
|
||||
void HintsSetActiveWindow(Window win);
|
||||
void HintsSetWindowName(Window win, const char *name);
|
||||
void HintsSetWindowClass(Window win, const char *name,
|
||||
const char *clss);
|
||||
void HintsSetWindowDesktop(EWin * ewin);
|
||||
void HintsSetWindowArea(EWin * ewin);
|
||||
void HintsSetWindowState(EWin * ewin);
|
||||
|
|
14
src/dialog.c
14
src/dialog.c
|
@ -607,22 +607,12 @@ ShowDialog(Dialog * d)
|
|||
char pq;
|
||||
int i, w, h, mw, mh;
|
||||
EWin *ewin;
|
||||
XTextProperty xtp;
|
||||
XClassHint *xch;
|
||||
Snapshot *sn;
|
||||
|
||||
if (d->title)
|
||||
{
|
||||
xtp.encoding = XA_STRING;
|
||||
xtp.format = 8;
|
||||
xtp.value = (unsigned char *)(d->title);
|
||||
xtp.nitems = strlen((char *)(xtp.value));
|
||||
XSetWMName(disp, d->win, &xtp);
|
||||
xch = XAllocClassHint();
|
||||
xch->res_name = d->name;
|
||||
xch->res_class = (char *)"Enlightenment_Dialog";
|
||||
XSetClassHint(disp, d->win, xch);
|
||||
XFree(xch);
|
||||
HintsSetWindowName(d->win, d->title);
|
||||
HintsSetWindowClass(d->win, d->name, "Enlightenment_Dialog");
|
||||
}
|
||||
|
||||
ewin = FindEwinByDialog(d);
|
||||
|
|
10
src/ewmh.c
10
src/ewmh.c
|
@ -417,13 +417,11 @@ EWMH_SetClientStacking(void)
|
|||
}
|
||||
|
||||
void
|
||||
EWMH_SetActiveWindow(const EWin * ewin)
|
||||
EWMH_SetActiveWindow(Window win)
|
||||
{
|
||||
static Window win_last_set;
|
||||
Window win;
|
||||
|
||||
EDBUG(6, "EWMH_SetActiveWindow");
|
||||
win = (ewin) ? ewin->client.win : None;
|
||||
if (win != win_last_set)
|
||||
{
|
||||
_ATOM_SET_WINDOW(_NET_ACTIVE_WINDOW, VRoot.win, &win, 1);
|
||||
|
@ -447,6 +445,12 @@ EWMH_SetShowingDesktop(int on)
|
|||
* Functions that set X11-properties from E-window internals
|
||||
*/
|
||||
|
||||
void
|
||||
EWMH_SetWindowName(Window win, const char *name)
|
||||
{
|
||||
_ATOM_SET_UTF8_STRING(_NET_WM_NAME, win, name);
|
||||
}
|
||||
|
||||
void
|
||||
EWMH_SetWindowDesktop(const EWin * ewin)
|
||||
{
|
||||
|
|
39
src/hints.c
39
src/hints.c
|
@ -134,15 +134,50 @@ HintsSetDesktopViewport(void)
|
|||
}
|
||||
|
||||
void
|
||||
HintsSetActiveWindow(EWin * ewin)
|
||||
HintsSetActiveWindow(Window win)
|
||||
{
|
||||
EDBUG(6, "HintsSetActiveWindow");
|
||||
#if ENABLE_EWMH
|
||||
EWMH_SetActiveWindow(ewin);
|
||||
EWMH_SetActiveWindow(win);
|
||||
#endif
|
||||
EDBUG_RETURN_;
|
||||
}
|
||||
|
||||
void
|
||||
HintsSetWindowName(Window win, const char *name)
|
||||
{
|
||||
XTextProperty xtp;
|
||||
|
||||
EDBUG(6, "HintsSetWindowName");
|
||||
|
||||
xtp.encoding = XA_STRING;
|
||||
xtp.format = 8;
|
||||
xtp.value = (unsigned char *)name;
|
||||
xtp.nitems = strlen(name);
|
||||
XSetWMName(disp, win, &xtp);
|
||||
|
||||
#if ENABLE_EWMH
|
||||
EWMH_SetWindowName(win, name);
|
||||
#endif
|
||||
EDBUG_RETURN_;
|
||||
}
|
||||
|
||||
void
|
||||
HintsSetWindowClass(Window win, const char *name, const char *clss)
|
||||
{
|
||||
XClassHint *xch;
|
||||
|
||||
EDBUG(6, "HintsSetWindowClass");
|
||||
|
||||
xch = XAllocClassHint();
|
||||
xch->res_name = (char *)name;
|
||||
xch->res_class = (char *)clss;
|
||||
XSetClassHint(disp, win, xch);
|
||||
XFree(xch);
|
||||
|
||||
EDBUG_RETURN_;
|
||||
}
|
||||
|
||||
void
|
||||
HintsSetWindowDesktop(EWin * ewin)
|
||||
{
|
||||
|
|
|
@ -487,7 +487,7 @@ ICCCM_Focus(EWin * ewin)
|
|||
if (!ewin)
|
||||
{
|
||||
XSetInputFocus(disp, VRoot.win, RevertToPointerRoot, CurrentTime);
|
||||
HintsSetActiveWindow(ewin);
|
||||
HintsSetActiveWindow(None);
|
||||
EDBUG_RETURN_;
|
||||
}
|
||||
|
||||
|
@ -511,7 +511,7 @@ ICCCM_Focus(EWin * ewin)
|
|||
}
|
||||
/* else */
|
||||
XSetInputFocus(disp, ewin->client.win, RevertToPointerRoot, CurrentTime);
|
||||
HintsSetActiveWindow(ewin);
|
||||
HintsSetActiveWindow(ewin->client.win);
|
||||
|
||||
EDBUG_RETURN_;
|
||||
}
|
||||
|
|
|
@ -585,23 +585,16 @@ void
|
|||
IconboxShow(Iconbox * ib)
|
||||
{
|
||||
EWin *ewin = NULL;
|
||||
XClassHint *xch;
|
||||
XTextProperty xtp;
|
||||
char pq;
|
||||
|
||||
pq = Mode.queue_up;
|
||||
Mode.queue_up = 0;
|
||||
xtp.encoding = XA_STRING;
|
||||
xtp.format = 8;
|
||||
xtp.value = (unsigned char *)("Iconbox");
|
||||
xtp.nitems = strlen((char *)(xtp.value));
|
||||
XSetWMName(disp, ib->win, &xtp);
|
||||
xch = XAllocClassHint();
|
||||
xch->res_name = ib->name;
|
||||
xch->res_class = (char *)"Enlightenment_IconBox";
|
||||
XSetClassHint(disp, ib->win, xch);
|
||||
XFree(xch);
|
||||
|
||||
HintsSetWindowName(ib->win, "Iconbox");
|
||||
HintsSetWindowClass(ib->win, ib->name, "Enlightenment_IconBox");
|
||||
|
||||
MatchToSnapInfoIconbox(ib);
|
||||
|
||||
ewin = AddInternalToFamily(ib->win, "ICONBOX", EWIN_TYPE_ICONBOX, ib,
|
||||
IconboxEwinInit);
|
||||
if (ewin)
|
||||
|
|
12
src/menus.c
12
src/menus.c
|
@ -638,12 +638,11 @@ MenuAddStyle(Menu * menu, const char *style)
|
|||
void
|
||||
MenuRealize(Menu * m)
|
||||
{
|
||||
int i, maxh = 0, maxw =
|
||||
0, maxx1, maxx2, w, h, x, y, r, mmw, mmh;
|
||||
int i, maxh = 0, maxw = 0;
|
||||
int maxx1, maxx2, w, h, x, y, r, mmw, mmh;
|
||||
unsigned int iw, ih;
|
||||
Imlib_Image *im;
|
||||
XSetWindowAttributes att;
|
||||
XTextProperty xtp;
|
||||
char pq, has_i, has_s;
|
||||
|
||||
EDBUG(5, "MenuRealize");
|
||||
|
@ -655,12 +654,9 @@ MenuRealize(Menu * m)
|
|||
|
||||
if (m->title)
|
||||
{
|
||||
xtp.encoding = XA_STRING;
|
||||
xtp.format = 8;
|
||||
xtp.value = (unsigned char *)(m->title);
|
||||
xtp.nitems = strlen((char *)(xtp.value));
|
||||
XSetWMName(disp, m->win, &xtp);
|
||||
HintsSetWindowName(m->win, m->title);
|
||||
}
|
||||
|
||||
maxh = 0;
|
||||
maxx1 = 0;
|
||||
maxx2 = 0;
|
||||
|
|
27
src/pager.c
27
src/pager.c
|
@ -312,7 +312,6 @@ void
|
|||
PagerShow(Pager * p)
|
||||
{
|
||||
EWin *ewin = NULL;
|
||||
XClassHint *xch;
|
||||
char s[4096];
|
||||
char pq;
|
||||
|
||||
|
@ -326,14 +325,13 @@ PagerShow(Pager * p)
|
|||
}
|
||||
|
||||
Esnprintf(s, sizeof(s), "%i", p->desktop);
|
||||
xch = XAllocClassHint();
|
||||
xch->res_name = s;
|
||||
xch->res_class = (char *)"Enlightenment_Pager";
|
||||
XSetClassHint(disp, p->win, xch);
|
||||
XFree(xch);
|
||||
HintsSetWindowClass(p->win, s, "Enlightenment_Pager");
|
||||
|
||||
pq = Mode.queue_up;
|
||||
Mode.queue_up = 0;
|
||||
|
||||
MatchToSnapInfoPager(p);
|
||||
|
||||
ewin = AddInternalToFamily(p->win, (p->border_name) ? p->border_name :
|
||||
"PAGER", EWIN_TYPE_PAGER, p, PagerEwinInit);
|
||||
if (ewin)
|
||||
|
@ -1023,21 +1021,6 @@ PagerHide(Pager * p)
|
|||
HideEwin(p->ewin);
|
||||
}
|
||||
|
||||
static void
|
||||
PagerTitle(Pager * p, char *title)
|
||||
{
|
||||
XTextProperty xtp;
|
||||
|
||||
if (!Conf.pagers.enable)
|
||||
return;
|
||||
|
||||
xtp.encoding = XA_STRING;
|
||||
xtp.format = 8;
|
||||
xtp.value = (unsigned char *)(title);
|
||||
xtp.nitems = strlen((char *)(xtp.value));
|
||||
XSetWMName(disp, p->win, &xtp);
|
||||
}
|
||||
|
||||
void
|
||||
UpdatePagerSel(void)
|
||||
{
|
||||
|
@ -1427,7 +1410,7 @@ NewPagerForDesktop(int desk)
|
|||
{
|
||||
p->desktop = desk;
|
||||
Esnprintf(s, sizeof(s), "%i", desk);
|
||||
PagerTitle(p, s);
|
||||
HintsSetWindowName(p->win, s);
|
||||
PagerShow(p);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue