[python] Reload program list in backgound thread at startup.

This commit is contained in:
Kris Maglione 2010-06-02 12:05:45 -04:00
parent 625246858d
commit fc90189133
5 changed files with 16 additions and 10 deletions

View File

@ -293,7 +293,7 @@ addresize('', 'Grow', 'grow')
addresize('Control-', 'Shrink', 'grow', '-1')
addresize('Shift-', 'Nudge', 'nudge')
Actions.rehash()
Thread(target=lambda: Actions.rehash()).start()
if not os.environ.get('WMII_NOPLUGINS', ''):
dirs = filter(curry(os.access, _, os.R_OK),

View File

@ -23,14 +23,12 @@ bar_init(WMScreen *s) {
s->brect.min.y = s->brect.max.y - labelh(def.font);
wa.override_redirect = 1;
wa.background_pixmap = ParentRelative;
wa.event_mask = ExposureMask
| ButtonPressMask
| ButtonReleaseMask
| FocusChangeMask;
s->barwin = createwindow(&scr.root, s->brect, scr.depth, InputOutput,
&wa, CWOverrideRedirect
| CWBackPixmap
| CWEventMask);
s->barwin->aux = s;
xdnd_initwindow(s->barwin);

View File

@ -644,8 +644,10 @@ client_kill(Client *c, bool nice) {
XKillClient(display, c->w.xid);
}
else if(c->proto & ProtoDelete)
else if(c->proto & ProtoDelete) {
client_message(c, "WM_DELETE_WINDOW", 0);
ewmh_checkresponsive(c);
}
else
XKillClient(display, c->w.xid);
}

View File

@ -76,6 +76,15 @@ ewmh_init(void) {
changeprop_long(&scr.root, Net("SUPPORTED"), "ATOM", supported, nelem(supported));
}
void
ewmh_checkresponsive(Client *c) {
if(nsec() / 1000000 - c->w.ewmh.ping > PingTime) {
event("Unresponsive %#C\n", c);
c->dead++;
}
}
static void
tick(long id, void *v) {
static int count;
@ -88,10 +97,8 @@ tick(long id, void *v) {
mod = count % PingPartition;
for(i=0, c=client; c; c=c->next, i++)
if(c->proto & ProtoPing) {
if(c->dead == 1 && time - c->w.ewmh.ping > PingTime) {
event("Unresponsive %#C\n", c);
c->dead++;
}
if(c->dead == 1)
ewmh_checkresponsive(c);
if(i % PingPartition == mod)
sendmessage(&c->w, "WM_PROTOCOLS", NET("WM_PING"), time, c->w.xid, 0, 0);
if(i % PingPartition == mod)

View File

@ -136,14 +136,13 @@ void debug_event(XEvent*);
void print_focus(const char*, Client*, const char*);
/* ewmh.c */
int ewmh_clientmessage(XClientMessageEvent*);
void ewmh_checkresponsive(Client*);
void ewmh_destroyclient(Client*);
void ewmh_framesize(Client*);
void ewmh_getstrut(Client*);
void ewmh_getwintype(Client*);
void ewmh_init(void);
void ewmh_initclient(Client*);
void ewmh_pingclient(Client*);
bool ewmh_prop(Client*, Atom);
long ewmh_protocols(Window*);
void ewmh_updateclient(Client*);