Re: [dev] Re: DWM - Multiple screen not recognized in Virtualbox
Rémy Lefevre <lefevreremy <at> gmail.com> writes:
>
> Bryan Bennett <bbenne10 <at> gmail.com> writes:
>
> >
> > I apologize. I misread your initial mail. I remember having a similar
> problem with virtual box but seem to remember that it was the result of a
> mismatch between the guest additions and the virtualbox version rather than
> being related to the wm. Are you sure your versions match?
>
> I finally found my problem. It is located in the function "configurerequest"
> in dwm.c. It's written "c->x = m->mx + ev->x;" and "c->y = m->my + ev->y;"
> which means that the new coordinates are interpreted relatively to the
> position of the monitor. Which is not the intended behavior. So I replace
> those lines by "c->x = ev->x;" and "c->y = ev->y;" respectively. And it
> works when I want to move a window to a monitor on the left. But, when I
> want to move a window to a monitor on the right, it didn't work. I found few
> lines below in dwm.c:
>
> if((c->x + c->w) > m->mx + m->mw && c->isfloating)
> c->x = m->mx + (m->mw / 2 - WIDTH(c) / 2); /* center in x direction */
> if((c->y + c->h) > m->my + m->mh && c->isfloating)
> c->y = m->my + (m->mh / 2 - HEIGHT(c) / 2); /* center in y direction */
>
> which mean that when the window tries to go out of the screen on the right,
> center it back. It's one more time not the intended behavior, so I comment
> those lines. And it's know working like a charm. I suggest the maintainer to
> update the code in dwm repository in order to fix this problem for the next
> releases.
>
>
Here is my patch:
diff -u dwm.c dwm.c
--- dwm.c 2013-06-13 13:20:35.794942637 +0200
+++ dwm.c 2013-06-13 15:27:06.503336161 +0200
_AT_@ -604,11 +604,11 @@
m = c->mon;
if(ev->value_mask & CWX) {
c->oldx = c->x;
- c->x = m->mx + ev->x;
+ c->x = ev->x;
}
if(ev->value_mask & CWY) {
c->oldy = c->y;
- c->y = m->my + ev->y;
+ c->y = ev->y;
}
if(ev->value_mask & CWWidth) {
c->oldw = c->w;
_AT_@ -618,14 +618,13 @@
c->oldh = c->h;
c->h = ev->height;
}
- if((c->x + c->w) > m->mx + m->mw && c->isfloating)
- c->x = m->mx + (m->mw / 2 - WIDTH(c) / 2); /* center in x direction */
- if((c->y + c->h) > m->my + m->mh && c->isfloating)
- c->y = m->my + (m->mh / 2 - HEIGHT(c) / 2); /* center in y direction */
if((ev->value_mask & (CWX|CWY)) && !(ev->value_mask & (CWWidth|CWHeight)))
configure(c);
if(ISVISIBLE(c))
XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
+ if ((m = recttomon(c->x, c->y, c->w, c->h)) != c->mon)
+ sendmon(c, m);
+
}
else
configure(c);
_AT_@ -1132,11 +1131,6 @@
c->h = c->oldh = wa->height;
c->oldbw = wa->border_width;
- if(c->x + WIDTH(c) > c->mon->mx + c->mon->mw)
- c->x = c->mon->mx + c->mon->mw - WIDTH(c);
- if(c->y + HEIGHT(c) > c->mon->my + c->mon->mh)
- c->y = c->mon->my + c->mon->mh - HEIGHT(c);
- c->x = MAX(c->x, c->mon->mx);
/* only fix client y-offset, if the client center might cover the bar */
c->y = MAX(c->y, ((c->mon->by == c->mon->my) && (c->x + (c->w / 2) >=
c->mon->wx)
&& (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh :
c->mon->my);
Received on Thu Jun 13 2013 - 15:34:14 CEST
This archive was generated by hypermail 2.3.0
: Thu Jun 13 2013 - 15:36:05 CEST