Update improvement
This commit is contained in:
parent
1d5792b278
commit
374abb0e26
@ -692,7 +692,6 @@ client_manage(Window w, XWindowAttributes *wa, Bool ar)
|
||||
|
||||
c->layer = (sel && sel->layer > 0) ? sel->layer : 1;
|
||||
|
||||
|
||||
at.event_mask = PropertyChangeMask;
|
||||
|
||||
frame_create(c);
|
||||
@ -831,10 +830,10 @@ client_moveresize(Client *c, XRectangle geo, Bool r)
|
||||
|
||||
frame_moveresize(c, c->geo);
|
||||
|
||||
XMoveResizeWindow(dpy, c->win, BORDH, TBARH, c->geo.width, c->geo.height);
|
||||
XMoveResizeWindow(dpy, c->win, BORDH, TBARH, geo.width, geo.height);
|
||||
|
||||
client_configure(c);
|
||||
client_update_attributes(c);
|
||||
client_configure(c);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
26
src/event.c
26
src/event.c
@ -77,6 +77,7 @@ buttonpress(XButtonEvent *ev)
|
||||
if(ev->button == conf.client.mouse[i].button)
|
||||
if(conf.client.mouse[i].func)
|
||||
conf.client.mouse[i].func(conf.client.mouse[i].cmd);
|
||||
|
||||
/* Root */
|
||||
if(ev->window == ROOT)
|
||||
for(i = 0; i < conf.root.nmouse; ++i)
|
||||
@ -371,8 +372,9 @@ enternotify(XCrossingEvent *ev)
|
||||
&& ev->window != ROOT)
|
||||
return;
|
||||
|
||||
if((s = systray_find(ev->window)))
|
||||
XSetInputFocus(dpy, s->win, RevertToNone, CurrentTime);
|
||||
/* Don't handle EnterNotify event if it's about systray */
|
||||
if((s = systray_find(ev->window)) || ev->window == traywin)
|
||||
return;
|
||||
|
||||
if(conf.focus_fmouse)
|
||||
{
|
||||
@ -518,11 +520,17 @@ maprequest(XMapRequestEvent *ev)
|
||||
{
|
||||
XWindowAttributes at;
|
||||
Client *c;
|
||||
Systray *s;
|
||||
|
||||
CHECK(XGetWindowAttributes(dpy, ev->window, &at));
|
||||
CHECK(!at.override_redirect);
|
||||
|
||||
if(!(c = client_gb_win(ev->window)))
|
||||
if((s = systray_find(ev->window)))
|
||||
{
|
||||
ewmh_send_message(s->win, s->win, "_XEMBED", CurrentTime, XEMBED_WINDOW_ACTIVATE, 0, 0, 0);
|
||||
systray_update();
|
||||
}
|
||||
else if(!(c = client_gb_win(ev->window)))
|
||||
client_manage(ev->window, &at, True);
|
||||
|
||||
return;
|
||||
@ -544,16 +552,8 @@ propertynotify(XPropertyEvent *ev)
|
||||
|
||||
if((s = systray_find(ev->window)))
|
||||
{
|
||||
if(ev->atom == XA_WM_NORMAL_HINTS)
|
||||
{
|
||||
systray_configure(s);
|
||||
systray_update();
|
||||
}
|
||||
else if(ev->atom == net_atom[xembedinfo])
|
||||
{
|
||||
systray_state(s);
|
||||
systray_update();
|
||||
}
|
||||
systray_state(s);
|
||||
systray_update();
|
||||
}
|
||||
|
||||
if((c = client_gb_win(ev->window)))
|
||||
|
||||
21
src/ewmh.c
21
src/ewmh.c
@ -82,6 +82,7 @@ ewmh_init_hints(void)
|
||||
net_atom[net_system_tray_s] = ATOM("_NET_SYSTEM_TRAY_S");
|
||||
net_atom[xembed] = ATOM("_XEMBED");
|
||||
net_atom[xembedinfo] = ATOM("_XEMBED_INFO");
|
||||
net_atom[manager] = ATOM("MANAGER");
|
||||
net_atom[utf8_string] = ATOM("UTF8_STRING");
|
||||
|
||||
/* WMFS hints */
|
||||
@ -161,27 +162,23 @@ ewmh_send_message(Window d, Window w, char *atom, long d0, long d1, long d2, lon
|
||||
long
|
||||
ewmh_get_xembed_state(Window win)
|
||||
{
|
||||
xembed_info *xi = NULL;
|
||||
Atom rf;
|
||||
int f;
|
||||
ulong n, il;
|
||||
long flags;
|
||||
long ret = 0;
|
||||
uchar *data = NULL;
|
||||
|
||||
if(XGetWindowProperty(dpy, win, net_atom[xembedinfo], 0L, 0x7FFFFFFFL,
|
||||
False, net_atom[xembedinfo], &rf, &f, &n, &il, &data) == Success && n)
|
||||
xi = (xembed_info*)data;
|
||||
else
|
||||
{
|
||||
XFree(data);
|
||||
if(XGetWindowProperty(dpy, win, net_atom[xembedinfo], 0L, 2, False,
|
||||
net_atom[xembedinfo], &rf, &f, &n, &il, &data) != Success)
|
||||
return 0;
|
||||
}
|
||||
|
||||
flags = xi->flags;
|
||||
if(rf == net_atom[xembedinfo] && n == 2)
|
||||
ret = (long)data[1];
|
||||
|
||||
XFree(xi);
|
||||
if(n && data)
|
||||
XFree(data);
|
||||
|
||||
return flags;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/** Get the number of desktop (tag)
|
||||
|
||||
@ -71,10 +71,10 @@ init(void)
|
||||
init_root();
|
||||
screen_init_geo();
|
||||
infobar_init();
|
||||
systray_init();
|
||||
init_status();
|
||||
ewmh_update_current_tag_prop();
|
||||
grabkeys();
|
||||
systray_init();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -131,6 +131,7 @@ enum
|
||||
net_system_tray_s,
|
||||
xembed,
|
||||
xembedinfo,
|
||||
manager,
|
||||
utf8_string,
|
||||
/* WMFS HINTS */
|
||||
wmfs_running,
|
||||
@ -523,6 +524,7 @@ typedef struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int version;
|
||||
int flags;
|
||||
} xembed_info;
|
||||
|
||||
|
||||
@ -64,8 +64,9 @@ systray_init(void)
|
||||
return;
|
||||
|
||||
/* Init traywin window */
|
||||
wattr.event_mask = ButtonPressMask|ExposureMask;
|
||||
wattr.event_mask = ButtonPressMask | ExposureMask;
|
||||
wattr.override_redirect = True;
|
||||
wattr.background_pixmap = ParentRelative;
|
||||
wattr.background_pixel = conf.colors.bar;
|
||||
|
||||
traywin = XCreateSimpleWindow(dpy, infobar[conf.systray.screen].bar->win, 0, 0, 1, 1, 0, 0, conf.colors.bar);
|
||||
@ -82,18 +83,6 @@ systray_init(void)
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
systray_kill(void)
|
||||
{
|
||||
if(!conf.systray.active)
|
||||
return;
|
||||
|
||||
XSetSelectionOwner(dpy, trayatom, None, CurrentTime);
|
||||
XUnmapWindow(dpy, traywin);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
systray_add(Window win)
|
||||
{
|
||||
@ -140,27 +129,6 @@ systray_del(Systray *s)
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
systray_configure(Systray *s)
|
||||
{
|
||||
long d = 0;
|
||||
XSizeHints *sh = NULL;
|
||||
|
||||
if(!(sh = XAllocSizeHints()) || !conf.systray.active)
|
||||
return;
|
||||
|
||||
XGetWMNormalHints(dpy, s->win, sh, &d);
|
||||
|
||||
/* TODO: Improve this.. */
|
||||
if(d > 0)
|
||||
if(sh->flags & (USSize|PSize))
|
||||
s->geo.width = sh->width;
|
||||
|
||||
XFree(sh);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
systray_state(Systray *s)
|
||||
{
|
||||
@ -191,19 +159,22 @@ systray_state(Systray *s)
|
||||
void
|
||||
systray_freeicons(void)
|
||||
{
|
||||
Systray *i, *next;
|
||||
Systray *i;
|
||||
|
||||
if(!conf.systray.active)
|
||||
return;
|
||||
|
||||
for(i = trayicons; i; i = next)
|
||||
for(i = trayicons; i; i = i->next)
|
||||
{
|
||||
next = i->next;
|
||||
XUnmapWindow(dpy, i->win);
|
||||
XReparentWindow(dpy, i->win, ROOT, 0, 0);
|
||||
IFREE(i);
|
||||
}
|
||||
|
||||
XSync(dpy, 0);
|
||||
XSetSelectionOwner(dpy, trayatom, None, CurrentTime);
|
||||
XDestroyWindow(dpy, traywin);
|
||||
|
||||
XSync(dpy, 0);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -242,7 +213,6 @@ void
|
||||
systray_update(void)
|
||||
{
|
||||
Systray *i;
|
||||
XWindowAttributes xa;
|
||||
int x = 1;
|
||||
|
||||
if(!conf.systray.active)
|
||||
@ -256,17 +226,8 @@ systray_update(void)
|
||||
|
||||
for(i = trayicons; i; i = i->next)
|
||||
{
|
||||
memset(&xa, 0, sizeof(xa));
|
||||
XGetWindowAttributes(dpy, i->win, &xa);
|
||||
|
||||
XMapWindow(dpy, i->win);
|
||||
|
||||
if(xa.width < (i->geo.width = TRAY_DWIDTH))
|
||||
i->geo.width = xa.width;
|
||||
|
||||
if(xa.height < (i->geo.height = infobar[conf.systray.screen].bar->geo.height))
|
||||
i->geo.height = xa.height;
|
||||
|
||||
XMoveResizeWindow(dpy, i->win, (i->geo.x = x), 0, i->geo.width, i->geo.height);
|
||||
|
||||
x += i->geo.width + conf.systray.spacing;
|
||||
|
||||
19
src/wmfs.c
19
src/wmfs.c
@ -92,14 +92,14 @@ quit(void)
|
||||
IFREE(tags);
|
||||
IFREE(seltag);
|
||||
|
||||
systray_freeicons();
|
||||
|
||||
XftFontClose(dpy, font);
|
||||
for(i = 0; i < CurLast; ++i)
|
||||
XFreeCursor(dpy, cursor[i]);
|
||||
XFreeGC(dpy, gc_stipple);
|
||||
infobar_destroy();
|
||||
|
||||
systray_freeicons();
|
||||
|
||||
IFREE(sgeo);
|
||||
IFREE(spgeo);
|
||||
IFREE(infobar);
|
||||
@ -219,28 +219,31 @@ scan(void)
|
||||
{
|
||||
XGetWindowAttributes(dpy, w[i], &wa);
|
||||
|
||||
if(!wa.override_redirect
|
||||
&& wa.map_state == IsViewable)
|
||||
if(!wa.override_redirect && wa.map_state == IsViewable)
|
||||
{
|
||||
|
||||
if(ewmh_get_xembed_state(w[i]))
|
||||
systray_add(w[i]);
|
||||
{
|
||||
systray_add(w[i]);
|
||||
systray_update();
|
||||
}
|
||||
|
||||
if(XGetWindowProperty(dpy, w[i], ATOM("_WMFS_TAG"), 0, 32,
|
||||
False, XA_CARDINAL, &rt, &rf, &ir, &il, &ret) == Success && ret)
|
||||
False, XA_CARDINAL, &rt, &rf, &ir, &il, &ret) == Success && ret)
|
||||
{
|
||||
tag = *ret;
|
||||
XFree(ret);
|
||||
}
|
||||
|
||||
if(XGetWindowProperty(dpy, w[i], ATOM("_WMFS_SCREEN"), 0, 32,
|
||||
False, XA_CARDINAL, &rt, &rf, &ir, &il, &ret) == Success && ret)
|
||||
False, XA_CARDINAL, &rt, &rf, &ir, &il, &ret) == Success && ret)
|
||||
{
|
||||
screen = *ret;
|
||||
XFree(ret);
|
||||
}
|
||||
|
||||
if(XGetWindowProperty(dpy, w[i], ATOM("_WMFS_ISFREE"), 0, 32,
|
||||
False, XA_CARDINAL, &rt, &rf, &ir, &il, &ret) == Success && ret)
|
||||
False, XA_CARDINAL, &rt, &rf, &ir, &il, &ret) == Success && ret)
|
||||
{
|
||||
free = *ret;
|
||||
XFree(ret);
|
||||
|
||||
@ -348,10 +348,8 @@ void statustext_handle(int sc, char *str);
|
||||
/* systray.c */
|
||||
Bool systray_acquire(void);
|
||||
void systray_init(void);
|
||||
void systray_kill(void);
|
||||
void systray_add(Window win);
|
||||
void systray_del(Systray *s);
|
||||
void systray_configure(Systray *s);
|
||||
void systray_state(Systray *s);
|
||||
void systray_freeicons(void);
|
||||
Systray* systray_find(Window win);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user