Xinqi Bao's Git
projects
/
dwm.git
/ diff
summary
|
log
|
commit
|
diff
|
tree
raw
|
patch
|
inline
| side by side (parent:
029655b
)
applied a collection of Christof Musik patches, and fixed an issue reported by waistc...
author
Anselm R Garbe <
[email protected]
>
Tue, 30 Jun 2009 14:51:09 +0000
(15:51 +0100)
committer
Anselm R Garbe <
[email protected]
>
Tue, 30 Jun 2009 14:51:09 +0000
(15:51 +0100)
dwm.c
diff
|
blob
|
history
diff --git
a/dwm.c
b/dwm.c
index
04fcc90
..
c7fd99b
100644
(file)
--- a/
dwm.c
+++ b/
dwm.c
@@
-125,7
+125,7
@@
struct Monitor {
int screen_number;
float mfact;
int by, btx; /* bar geometry */
int screen_number;
float mfact;
int by, btx; /* bar geometry */
- int m
y, mh; /* vertical screen size
*/
+ int m
x, my, mw, mh; /* screen size
*/
int wx, wy, ww, wh; /* window area */
unsigned int seltags;
unsigned int sellt;
int wx, wy, ww, wh; /* window area */
unsigned int seltags;
unsigned int sellt;
@@
-542,6
+542,7
@@
configurenotify(XEvent *e) {
void
configurerequest(XEvent *e) {
Client *c;
void
configurerequest(XEvent *e) {
Client *c;
+ Monitor *m;
XConfigureRequestEvent *ev = &e->xconfigurerequest;
XWindowChanges wc;
XConfigureRequestEvent *ev = &e->xconfigurerequest;
XWindowChanges wc;
@@
-549,18
+550,19
@@
configurerequest(XEvent *e) {
if(ev->value_mask & CWBorderWidth)
c->bw = ev->border_width;
else if(c->isfloating || !lt[selmon->sellt]->arrange) {
if(ev->value_mask & CWBorderWidth)
c->bw = ev->border_width;
else if(c->isfloating || !lt[selmon->sellt]->arrange) {
+ m = c->mon;
if(ev->value_mask & CWX)
if(ev->value_mask & CWX)
- c->x =
s
x + ev->x;
+ c->x =
m->m
x + ev->x;
if(ev->value_mask & CWY)
if(ev->value_mask & CWY)
- c->y =
s
y + ev->y;
+ c->y =
m->m
y + ev->y;
if(ev->value_mask & CWWidth)
c->w = ev->width;
if(ev->value_mask & CWHeight)
c->h = ev->height;
if(ev->value_mask & CWWidth)
c->w = ev->width;
if(ev->value_mask & CWHeight)
c->h = ev->height;
- if((c->x -
sx + c->w) > s
w && c->isfloating)
- c->x =
sx + (s
w / 2 - c->w / 2); /* center in x direction */
- if((c->y -
sy + c->h) > s
h && c->isfloating)
- c->y =
sy + (s
h / 2 - c->h / 2); /* center in y direction */
+ if((c->x -
m->mx + c->w) > m->m
w && c->isfloating)
+ c->x =
m->mx + (m->m
w / 2 - c->w / 2); /* center in x direction */
+ if((c->y -
m->my + c->h) > m->m
h && c->isfloating)
+ c->y =
m->my + (m->m
h / 2 - c->h / 2); /* center in y direction */
if((ev->value_mask & (CWX|CWY)) && !(ev->value_mask & (CWWidth|CWHeight)))
configure(c);
if(ISVISIBLE(c))
if((ev->value_mask & (CWX|CWY)) && !(ev->value_mask & (CWWidth|CWHeight)))
configure(c);
if(ISVISIBLE(c))
@@
-872,7
+874,7
@@
getmon(Window w) {
return m;
if((c = getclient(w)))
return c->mon;
return m;
if((c = getclient(w)))
return c->mon;
- return
NULL
;
+ return
selmon
;
}
Monitor *
}
Monitor *
@@
-891,7
+893,7
@@
getmonxy(int x, int y) {
for(m = mons; m; m = m->next)
if(INRECT(x, y, m->wx, m->wy, m->ww, m->wh))
return m;
for(m = mons; m; m = m->next)
if(INRECT(x, y, m->wx, m->wy, m->ww, m->wh))
return m;
- return
NULL
;
+ return
selmon
;
}
Bool
}
Bool
@@
-1083,25
+1085,25
@@
manage(Window w, XWindowAttributes *wa) {
c->mon = selmon;
/* geometry */
c->mon = selmon;
/* geometry */
- c->x = wa->x;
- c->y = wa->y;
+ c->x = wa->x
+ selmon->wx
;
+ c->y = wa->y
+ selmon->wy
;
c->w = wa->width;
c->h = wa->height;
c->oldbw = wa->border_width;
c->w = wa->width;
c->h = wa->height;
c->oldbw = wa->border_width;
- if(c->w == s
w && c->h == s
h) {
- c->x = sx;
- c->y = sy;
+ if(c->w == s
elmon->mw && c->h == selmon->m
h) {
+ c->x = s
elmon->m
x;
+ c->y = s
elmon->m
y;
c->bw = 0;
}
else {
c->bw = 0;
}
else {
- if(c->x + WIDTH(c) > s
x + s
w)
- c->x = s
x + s
w - WIDTH(c);
- if(c->y + HEIGHT(c) > s
y + s
h)
- c->y = s
y + s
h - HEIGHT(c);
- c->x = MAX(c->x, sx);
+ if(c->x + WIDTH(c) > s
elmon->mx + selmon->m
w)
+ c->x = s
elmon->mx + selmon->m
w - WIDTH(c);
+ if(c->y + HEIGHT(c) > s
elmon->my + selmon->m
h)
+ c->y = s
elmon->my + selmon->m
h - HEIGHT(c);
+ c->x = MAX(c->x, s
elmon->m
x);
/* only fix client y-offset, if the client center might cover the bar */
c->y = MAX(c->y, ((c->mon->by == 0) && (c->x + (c->w / 2) >= c->mon->wx)
/* only fix client y-offset, if the client center might cover the bar */
c->y = MAX(c->y, ((c->mon->by == 0) && (c->x + (c->w / 2) >= c->mon->wx)
- && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : sy);
+ && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : s
elmon->m
y);
c->bw = borderpx;
}
c->bw = borderpx;
}
@@
-1210,8
+1212,11
@@
movemouse(const Arg *arg) {
}
while(ev.type != ButtonRelease);
XUngrabPointer(dpy, CurrentTime);
}
while(ev.type != ButtonRelease);
XUngrabPointer(dpy, CurrentTime);
- if((m = getmonxy(c->x + c->w / 2, c->y + c->h / 2)) != selmon)
+ if((m = getmonxy(c->x + c->w / 2, c->y + c->h / 2)) != selmon)
{
sendmon(c, m);
sendmon(c, m);
+ selmon = m;
+ focus(NULL);
+ }
}
Client *
}
Client *
@@
-1319,8
+1324,11
@@
resizemouse(const Arg *arg) {
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
XUngrabPointer(dpy, CurrentTime);
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
XUngrabPointer(dpy, CurrentTime);
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
- if((m = getmonxy(c->x + c->w / 2, c->y + c->h / 2)) != selmon)
+ if((m = getmonxy(c->x + c->w / 2, c->y + c->h / 2)) != selmon)
{
sendmon(c, m);
sendmon(c, m);
+ selmon = m;
+ focus(NULL);
+ }
}
void
}
void
@@
-1761,9
+1769,9
@@
updategeom(void) {
if(XineramaIsActive(dpy)) {
for(i = 0, m = newmons; m; m = m->next, i++) {
m->screen_number = info[i].screen_number;
if(XineramaIsActive(dpy)) {
for(i = 0, m = newmons; m; m = m->next, i++) {
m->screen_number = info[i].screen_number;
- m->wx = info[i].x_org;
+ m->
mx = m->
wx = info[i].x_org;
m->my = m->wy = info[i].y_org;
m->my = m->wy = info[i].y_org;
- m->ww = info[i].width;
+ m->
mw = m->
ww = info[i].width;
m->mh = m->wh = info[i].height;
}
XFree(info);
m->mh = m->wh = info[i].height;
}
XFree(info);