Xinqi Bao's Git
projects
/
dwm.git
/ commitdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
patch
|
inline
| side by side (from parent 1:
d99ec61
)
removed initags -- we autoselect the first tag in each view instead
author
anselm@anselm1 <unknown>
Thu, 28 Feb 2008 20:02:57 +0000
(20:02 +0000)
committer
anselm@anselm1 <unknown>
Thu, 28 Feb 2008 20:02:57 +0000
(20:02 +0000)
config.def.h
patch
|
blob
|
history
dwm.c
patch
|
blob
|
history
diff --git
a/config.def.h
b/config.def.h
index
9ecdac5
..
92f1cdc
100644
(file)
--- a/
config.def.h
+++ b/
config.def.h
@@
-14,7
+14,6
@@
/* old */
const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "nil", "6", "7", "8", "www" };
unsigned int vtags[LENGTH(tags)] = { 0 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , 1 };
/* old */
const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "nil", "6", "7", "8", "www" };
unsigned int vtags[LENGTH(tags)] = { 0 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , 1 };
-Bool initags[LENGTH(tags)] = { [0] = True, [5] = True };
Rule rules[] = {
/* class:instance:title substr tags ref isfloating */
Rule rules[] = {
/* class:instance:title substr tags ref isfloating */
diff --git
a/dwm.c
b/dwm.c
index
60d6ea6
..
11a9fba
100644
(file)
--- a/
dwm.c
+++ b/
dwm.c
@@
-227,7
+227,6
@@
void (*handler[LASTEvent]) (XEvent *) = {
[UnmapNotify] = unmapnotify
};
Atom wmatom[WMLast], netatom[NetLast];
[UnmapNotify] = unmapnotify
};
Atom wmatom[WMLast], netatom[NetLast];
-Bool isxinerama = False;
Bool domwfact = True;
Bool dozoom = True;
Bool otherwm, readin;
Bool domwfact = True;
Bool dozoom = True;
Bool otherwm, readin;
@@
-246,6
+245,7
@@
Window root;
/* configuration, allows nested code to access above variables */
#include "config.h"
/* configuration, allows nested code to access above variables */
#include "config.h"
+#define TAGSZ (LENGTH(tags) * sizeof(Bool))
/* function implementations */
void
/* function implementations */
void
@@
-286,7
+286,7
@@
applyrules(Client *c) {
if(ch.res_name)
XFree(ch.res_name);
if(!matched) {
if(ch.res_name)
XFree(ch.res_name);
if(!matched) {
- memcpy(c->tags, seltags,
sizeof initags
);
+ memcpy(c->tags, seltags,
TAGSZ
);
c->view = selview;
}
}
c->view = selview;
}
}
@@
-654,10
+654,8
@@
enternotify(XEvent *e) {
Client *c;
XCrossingEvent *ev = &e->xcrossing;
Client *c;
XCrossingEvent *ev = &e->xcrossing;
- if(ev->mode != NotifyNormal || ev->detail == NotifyInferior) {
- if(!isxinerama || ev->window != root)
- return;
- }
+ if((ev->mode != NotifyNormal || ev->detail == NotifyInferior) && ev->window != root)
+ return;
if((c = getclient(ev->window)))
focus(c);
else
if((c = getclient(ev->window)))
focus(c);
else
@@
-1042,7
+1040,7
@@
manage(Window w, XWindowAttributes *wa) {
XWindowChanges wc;
c = emallocz(sizeof(Client));
XWindowChanges wc;
c = emallocz(sizeof(Client));
- c->tags = emallocz(
sizeof initags
);
+ c->tags = emallocz(
TAGSZ
);
c->win = w;
applyrules(c);
c->win = w;
applyrules(c);
@@
-1082,7
+1080,7
@@
manage(Window w, XWindowAttributes *wa) {
if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success))
for(t = clients; t && t->win != trans; t = t->next);
if(t)
if((rettrans = XGetTransientForHint(dpy, w, &trans) == Success))
for(t = clients; t && t->win != trans; t = t->next);
if(t)
- memcpy(c->tags, t->tags,
sizeof initags
);
+ memcpy(c->tags, t->tags,
TAGSZ
);
if(!c->isfloating)
c->isfloating = (rettrans == Success) || c->isfixed;
attach(c);
if(!c->isfloating)
c->isfloating = (rettrans == Success) || c->isfixed;
attach(c);
@@
-1501,7
+1499,7
@@
setmwfact(const char *arg) {
void
setup(void) {
void
setup(void) {
- unsigned int i;
+ unsigned int i
, j
;
View *v;
XSetWindowAttributes wa;
XineramaScreenInfo *info = NULL;
View *v;
XSetWindowAttributes wa;
XineramaScreenInfo *info = NULL;
@@
-1519,10
+1517,10
@@
setup(void) {
cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing);
cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur);
cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing);
cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur);
- if(
(isxinerama = XineramaIsActive(dpy)
))
+ if(
XineramaIsActive(dpy
))
info = XineramaQueryScreens(dpy, &nviews);
info = XineramaQueryScreens(dpy, &nviews);
+
#if defined(AIM_XINERAMA)
#if defined(AIM_XINERAMA)
-isxinerama = True;
nviews = 2; /* aim Xinerama */
#endif
views = emallocz(nviews * sizeof(View));
nviews = 2; /* aim Xinerama */
#endif
views = emallocz(nviews * sizeof(View));
@@
-1551,16
+1549,27
@@
nviews = 2; /* aim Xinerama */
blw = i;
}
blw = i;
}
- seltags = emallocz(sizeof initags);
- prevtags = emallocz(sizeof initags);
- memcpy(seltags, initags, sizeof initags);
- memcpy(prevtags, initags, sizeof initags);
+ seltags = emallocz(TAGSZ);
+ prevtags = emallocz(TAGSZ);
+
+ /* check, if vtags need assistance, because there is only 1 view */
+ if(nviews == 1)
+ for(i = 0; i < LENGTH(tags); i++)
+ vtags[i] = 0;
for(i = 0; i < nviews; i++) {
/* init geometry */
v = &views[i];
for(i = 0; i < nviews; i++) {
/* init geometry */
v = &views[i];
- if(nviews != 1 && isxinerama) {
+ /* select first tag in each view */
+ for(j = 0; j < LENGTH(tags); j++)
+ if(vtags[j] == i) {
+ seltags[j] = prevtags[j] = True;
+ break;
+ }
+
+
+ if(info) {
#if defined(AIM_XINERAMA)
v->w = DisplayWidth(dpy, screen) / 2;
#if defined(AIM_XINERAMA)
v->w = DisplayWidth(dpy, screen) / 2;
@@
-1693,8
+1702,6
@@
tile(View *v) {
for(i = 0, c = mc = nexttiled(clients, v); c; c = nexttiled(c->next, v)) {
if(i == 0) { /* master */
for(i = 0, c = mc = nexttiled(clients, v); c; c = nexttiled(c->next, v)) {
if(i == 0) { /* master */
- nx = v->wax;
- ny = v->way;
nw = mw - 2 * c->border;
nh = v->wah - 2 * c->border;
}
nw = mw - 2 * c->border;
nh = v->wah - 2 * c->border;
}
@@
-1908,9
+1915,9
@@
view(const char *arg) {
tmp[i] = (NULL == arg);
tmp[idxoftag(arg)] = True;
tmp[i] = (NULL == arg);
tmp[idxoftag(arg)] = True;
- if(memcmp(seltags, tmp,
sizeof initags
) != 0) {
- memcpy(prevtags, seltags,
sizeof initags
);
- memcpy(seltags, tmp,
sizeof initags
);
+ if(memcmp(seltags, tmp,
TAGSZ
) != 0) {
+ memcpy(prevtags, seltags,
TAGSZ
);
+ memcpy(seltags, tmp,
TAGSZ
);
arrange();
}
}
arrange();
}
}
@@
-1934,9
+1941,9
@@
void
viewprevtag(const char *arg) {
static Bool tmp[LENGTH(tags)];
viewprevtag(const char *arg) {
static Bool tmp[LENGTH(tags)];
- memcpy(tmp, seltags,
sizeof initags
);
- memcpy(seltags, prevtags,
sizeof initags
);
- memcpy(prevtags, tmp,
sizeof initags
);
+ memcpy(tmp, seltags,
TAGSZ
);
+ memcpy(seltags, prevtags,
TAGSZ
);
+ memcpy(prevtags, tmp,
TAGSZ
);
arrange();
}
arrange();
}