mirror of
https://github.com/0intro/wmii
synced 2024-11-25 07:09:38 +03:00
Cache property change values to cut down on noise.
This commit is contained in:
parent
5a6c5c1b4d
commit
ec18eb22e9
@ -631,7 +631,6 @@ fullscreen(Client *c, int fullscreen, long screen) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
event("Fullscreen %#C %s\n", c, (fullscreen ? "on" : "off"));
|
event("Fullscreen %#C %s\n", c, (fullscreen ? "on" : "off"));
|
||||||
ewmh_updatestate(c);
|
|
||||||
|
|
||||||
c->fullscreen = -1;
|
c->fullscreen = -1;
|
||||||
if(!fullscreen)
|
if(!fullscreen)
|
||||||
@ -666,6 +665,7 @@ fullscreen(Client *c, int fullscreen, long screen) {
|
|||||||
if((f = c->sel))
|
if((f = c->sel))
|
||||||
view_update(f->view);
|
view_update(f->view);
|
||||||
}
|
}
|
||||||
|
ewmh_updatestate(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -50,6 +50,14 @@ enum IncMode {
|
|||||||
ISqueeze,
|
ISqueeze,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
PDesktop,
|
||||||
|
PExtents,
|
||||||
|
PMonitors = PExtents + 4,
|
||||||
|
PState = PMonitors + 4,
|
||||||
|
PLast = PState + 3
|
||||||
|
};
|
||||||
|
|
||||||
enum ClientPermission {
|
enum ClientPermission {
|
||||||
PermActivate = 1<<0,
|
PermActivate = 1<<0,
|
||||||
};
|
};
|
||||||
@ -177,6 +185,8 @@ struct Client {
|
|||||||
char name[256];
|
char name[256];
|
||||||
char props[512];
|
char props[512];
|
||||||
char tags[256];
|
char tags[256];
|
||||||
|
char proplen[PLast];
|
||||||
|
long propcache[PLast];
|
||||||
long permission;
|
long permission;
|
||||||
long proto;
|
long proto;
|
||||||
int border;
|
int border;
|
||||||
|
@ -14,6 +14,20 @@ static void tick(long, void*);
|
|||||||
static Handlers client_handlers;
|
static Handlers client_handlers;
|
||||||
static Handlers root_handlers;
|
static Handlers root_handlers;
|
||||||
|
|
||||||
|
static void
|
||||||
|
clientprop_long(Client *c, int cache, char *prop, char *type, long *data, int l) {
|
||||||
|
if(l != c->proplen[cache] || memcmp(&c->propcache[cache], data, l * sizeof *data)) {
|
||||||
|
c->proplen[cache] = l;
|
||||||
|
memcpy(&c->propcache[cache], data, l * sizeof *data);
|
||||||
|
changeprop_long(&c->w, prop, type, data, l);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void
|
||||||
|
clientprop_del(Client *c, int cache, char *prop) {
|
||||||
|
c->proplen[cache] = 0;
|
||||||
|
delproperty(&c->w, prop);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ewmh_init(void) {
|
ewmh_init(void) {
|
||||||
char myname[] = "wmii";
|
char myname[] = "wmii";
|
||||||
@ -500,7 +514,7 @@ ewmh_framesize(Client *c) {
|
|||||||
r.min.x, r.max.x,
|
r.min.x, r.max.x,
|
||||||
r.min.y, r.max.y,
|
r.min.y, r.max.y,
|
||||||
};
|
};
|
||||||
changeprop_long(&c->w, Net("FRAME_EXTENTS"), "CARDINAL",
|
clientprop_long(c, PExtents, Net("FRAME_EXTENTS"), "CARDINAL",
|
||||||
extents, nelem(extents));
|
extents, nelem(extents));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -523,17 +537,17 @@ ewmh_updatestate(Client *c) {
|
|||||||
state[i++] = STATE("DEMANDS_ATTENTION");
|
state[i++] = STATE("DEMANDS_ATTENTION");
|
||||||
|
|
||||||
if(i > 0)
|
if(i > 0)
|
||||||
changeprop_long(&c->w, Net("WM_STATE"), "ATOM", state, i);
|
clientprop_long(c, PState, Net("WM_STATE"), "ATOM", state, i);
|
||||||
else
|
else
|
||||||
delproperty(&c->w, Net("WM_STATE"));
|
clientprop_del(c, PState, Net("WM_STATE"));
|
||||||
|
|
||||||
if(c->fullscreen >= 0)
|
if(c->fullscreen >= 0)
|
||||||
changeprop_long(&c->w, Net("WM_FULLSCREEN_MONITORS"), "CARDINAL",
|
clientprop_long(c, PMonitors, Net("WM_FULLSCREEN_MONITORS"), "CARDINAL",
|
||||||
(long[]) { c->fullscreen, c->fullscreen,
|
(long[]) { c->fullscreen, c->fullscreen,
|
||||||
c->fullscreen, c->fullscreen },
|
c->fullscreen, c->fullscreen },
|
||||||
4);
|
4);
|
||||||
else
|
else
|
||||||
delproperty(&c->w, Net("WM_FULLSCREEN_MONITORS"));
|
clientprop_del(c, PMonitors, Net("WM_FULLSCREEN_MONITORS"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Views */
|
/* Views */
|
||||||
@ -587,7 +601,7 @@ ewmh_updateclient(Client *c) {
|
|||||||
i = -1;
|
i = -1;
|
||||||
if(c->sel)
|
if(c->sel)
|
||||||
i = viewidx(c->sel->view);
|
i = viewidx(c->sel->view);
|
||||||
changeprop_long(&c->w, Net("WM_DESKTOP"), "CARDINAL", &i, 1);
|
clientprop_long(c, PDesktop, Net("WM_DESKTOP"), "CARDINAL", &i, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user