wc.y = (HEIGHT(r) - win->g.h) / 2;
}
+ /* adjust for region */
+ wc.x += r->g.x;
+ wc.y += r->g.y;
+
DNPRINTF(SWM_D_STACK, "stack_floater: win %lu x %d y %d w %d h %d\n",
win->id, wc.x, wc.y, wc.width, wc.height);
{
XWindowChanges wc;
struct swm_geometry gg = *g;
- struct ws_win *win, *winfocus;
+ struct ws_win *win;
unsigned int mask;
int winno;
if (winno == 0 && count_win(ws, 1) == 0)
return;
- if (ws->focus == NULL)
- ws->focus = TAILQ_FIRST(&ws->winlist);
- winfocus = ws->focus;
-
TAILQ_FOREACH(win, &ws->winlist, entry) {
if (win->transient != 0 || win->floating != 0) {
if (win == ws->focus) {
- /* XXX maximize? */
stack_floater(win, ws->r);
XMapRaised(display, win->id);
- } else {
- /* XXX this sucks */
- XUnmapWindow(display, win->id);
+ focus_win(win); /* override */
}
} else {
bzero(&wc, sizeof wc);
win->g.h = wc.height = gg.h;
mask = CWX | CWY | CWWidth | CWHeight | CWBorderWidth;
XConfigureWindow(display, win->id, mask, &wc);
-
- if (win == ws->focus) {
- XMapRaised(display, win->id);
- } else
- XUnmapWindow(display, win->id);
}
}
-
- if (winfocus)
- focus_win(winfocus); /* has to be done outside of the loop */
}
void
Window trans;
struct workspace *ws;
struct ws_win *win, *ww;
- int format, i, ws_idx, n;
+ int format, i, ws_idx, n, border_me = 0;
unsigned long nitems, bytes;
Atom ws_idx_atom = 0, type;
Atom *prot = NULL, *pp;
ws = r->ws;
/* this should launch transients in the same ws as parent */
/* XXX doesn't work for intel xrandr */
- if (id && trans) {
- if ((ww = find_window(trans)) != NULL) {
- ws = ww->ws;
- r = ws->r;
- }
- }
+ if (id && trans)
+ if ((ww = find_window(trans)) != NULL)
+ if (ws->r) {
+ ws = ww->ws;
+ r = ww->ws->r;
+ border_me = 1;
+ }
}
+ /* shouldn't happen but does... */
+ if (ws->r == NULL)
+ ws->r = r; /* use found r since it isn't filled in */
+
/* set up the window layout */
win->id = id;
win->ws = ws;
win->g.x = wc.x = WIDTH(win->ws->r) - win->g.w - 2;
mask |= CWX;
}
- wc.border_width = 1;
- mask |= CWBorderWidth;
- XConfigureWindow(display, win->id, mask, &wc);
+ border_me = 1;
}
/* Reset font sizes (the bruteforce way; no default keybinding). */
fake_keypress(win, XK_KP_Add, ShiftMask);
}
+ /* border me */
+ if (border_me) {
+ bzero(&wc, sizeof wc);
+ wc.border_width = 1;
+ mask = CWBorderWidth;
+ XConfigureWindow(display, win->id, mask, &wc);
+ }
+
XSelectInput(display, id, EnterWindowMask | FocusChangeMask |
PropertyChangeMask | StructureNotifyMask);
set_win_state(win, NormalState);
/* floaters need to be mapped if they are in the current workspace */
- if (win->floating && (ws->idx == r->ws->idx))
+ if ((win->floating || win->transient) && (ws->idx == r->ws->idx))
XMapRaised(display, win->id);
return (win);
/* make new win focused */
win = find_window(ev->window);
r = root_to_region(win->wa.root);
- if (win->ws == r->ws) /* XXX this probably breaks multi screen */
+ if (win->ws == r->ws)
focus_win(win);
}