changeset: 2791:7921fa9d5f7c
tag: tip
user: Kris Maglione <kris_AT_suckless.org>
date: Wed Sep 14 18:21:18 2011 -0400
files: cmd/wmii/client.c cmd/wmii/dat.h cmd/wmii/fns.h cmd/wmii/message.c cmd/wmii/view.c
description:
More robust view urgency tracking. Closes issue #241.
diff -r 95951abe29c5 -r 7921fa9d5f7c cmd/wmii/client.c
--- a/cmd/wmii/client.c Wed Sep 14 17:45:29 2011 -0400
+++ b/cmd/wmii/client.c Wed Sep 14 18:21:18 2011 -0400
@@ -714,18 +714,11 @@
event("%sUrgent %#C %s\n", cnot, c, cfrom);
c->urgent = urgent;
ewmh_updatestate(c);
- if(c->sel) {
+ if(c->sel)
frame_draw(c->sel);
- for(f=c->frame; f; f=f->cnext) {
- SET(ff);
- if(!urgent)
- foreach_frame(f->view, s, a, ff)
- if(ff->client->urgent) break;
- if(urgent || ff == nil)
- event("%sUrgentTag %s %s\n",
- cnot, cfrom, f->view->name);
- }
- }
+
+ for(f=c->frame; f; f=f->cnext)
+ view_update_urgency(f->view, cfrom);
}
if(from == UrgManager) {
diff -r 95951abe29c5 -r 7921fa9d5f7c cmd/wmii/dat.h
--- a/cmd/wmii/dat.h Wed Sep 14 17:45:29 2011 -0400
+++ b/cmd/wmii/dat.h Wed Sep 14 18:21:18 2011 -0400
@@ -295,6 +295,7 @@
int selcol;
int selscreen;
bool dead;
+ bool urgent;
Rectangle *r;
Rectangle *pad;
};
diff -r 95951abe29c5 -r 7921fa9d5f7c cmd/wmii/fns.h
--- a/cmd/wmii/fns.h Wed Sep 14 17:45:29 2011 -0400
+++ b/cmd/wmii/fns.h Wed Sep 14 18:21:18 2011 -0400
@@ -279,6 +279,7 @@
void view_update(View*);
void view_update_all(void);
void view_update_rect(View*);
+void view_update_urgency(View*, char*);
Rectangle* view_rects(View*, uint *num, Frame *ignore);
/* utf.c */
diff -r 95951abe29c5 -r 7921fa9d5f7c cmd/wmii/message.c
--- a/cmd/wmii/message.c Wed Sep 14 17:45:29 2011 -0400
+++ b/cmd/wmii/message.c Wed Sep 14 18:21:18 2011 -0400
@@ -794,6 +794,8 @@
bufclear();
bufprint("%s\n", v->name);
+ bufprint("urgent %s\n", TOGGLE(v->urgent));
+
/* select <area>[ <frame>] */
bufprint("select %a", v->sel);
if(v->sel->sel)
diff -r 95951abe29c5 -r 7921fa9d5f7c cmd/wmii/view.c
--- a/cmd/wmii/view.c Wed Sep 14 17:45:29 2011 -0400
+++ b/cmd/wmii/view.c Wed Sep 14 18:21:18 2011 -0400
@@ -287,47 +287,67 @@
Area *a;
int s;
- if(v != selview)
- return;
- if(starting)
- return;
+ if(v == selview && !starting) {
+ frames_update_sel(v);
- frames_update_sel(v);
+ foreach_frame(v, s, a, f)
+ if(f->client->fullscreen >= 0) {
+ f->collapsed = false;
+ if(!f->area->floating) {
+ f->oldarea = area_idx(f->area);
+ f->oldscreen = f->area->screen;
+ area_moveto(v->floating, f);
+ area_setsel(v->floating, f);
+ }else if(f->oldarea == -1)
+ f->oldarea = 0;
+ }
- foreach_frame(v, s, a, f)
- if(f->client->fullscreen >= 0) {
- f->collapsed = false;
- if(!f->area->floating) {
- f->oldarea = area_idx(f->area);
- f->oldscreen = f->area->screen;
- area_moveto(v->floating, f);
- area_setsel(v->floating, f);
- }else if(f->oldarea == -1)
- f->oldarea = 0;
+ view_arrange(v);
+
+ for(c=client; c; c=c->next) {
+ f = c->sel;
+ if((f && f->view == v)
+ && (f->area == v->sel || !(f->area && f->area->max && f->area->floating))) {
+ if(f->area)
+ client_resize(c, f->r);
+ }else {
+ client_unmapframe(c);
+ client_unmap(c, IconicState);
+ }
+ ewmh_updatestate(c);
+ ewmh_updateclient(c);
}
- view_arrange(v);
+ view_restack(v);
+ if(!v->sel->floating && view_fullscreen_p(v, v->sel->screen))
+ area_focus(v->floating);
+ else
+ area_focus(v->sel);
+ frame_draw_all();
+ }
+ view_update_urgency(v, nil);
+}
- for(c=client; c; c=c->next) {
- f = c->sel;
- if((f && f->view == v)
- && (f->area == v->sel || !(f->area && f->area->max && f->area->floating))) {
- if(f->area)
- client_resize(c, f->r);
- }else {
- client_unmapframe(c);
- client_unmap(c, IconicState);
+void
+view_update_urgency(View *v, char *from) {
+ Area *a;
+ Frame *f;
+ int s, urgent;
+
+ urgent = 0;
+ foreach_frame(v, s, a, f)
+ if (f->client->urgent) {
+ urgent++;
+ break;
}
- ewmh_updatestate(c);
- ewmh_updateclient(c);
- }
- view_restack(v);
- if(!v->sel->floating && view_fullscreen_p(v, v->sel->screen))
- area_focus(v->floating);
- else
- area_focus(v->sel);
- frame_draw_all();
+ if (urgent != v->urgent)
+ event("%sUrgentTag %s %s\n",
+ urgent ? "" : "Not",
+ from ? from : "Unknown",
+ v->name);
+
+ v->urgent = urgent;
}
void
@@ -432,9 +452,8 @@
c->sel = f->cnext;
event("ViewDetach %s %#C\n", v->name, c);
- if(v == selview)
- view_update(v);
- else if(empty_p(v))
+ view_update(v);
+ if(view != selview && empty_p(v))
view_destroy(v);
}
Received on Thu Sep 15 2011 - 00:21:26 CEST
This archive was generated by hypermail 2.2.0 : Thu Sep 15 2011 - 00:24:05 CEST