first multihead support
This commit is contained in:
parent
94824d2314
commit
3ab80f68b8
42
awesome.c
42
awesome.c
|
@ -53,17 +53,24 @@ static Bool readin = True, running = True;
|
||||||
static void
|
static void
|
||||||
cleanup(Display *disp, DC *drawcontext, awesome_config *awesomeconf)
|
cleanup(Display *disp, DC *drawcontext, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
|
int screen;
|
||||||
|
|
||||||
close(STDIN_FILENO);
|
close(STDIN_FILENO);
|
||||||
|
|
||||||
while(stack)
|
while(stack)
|
||||||
{
|
{
|
||||||
unban(stack);
|
unban(stack);
|
||||||
unmanage(stack, drawcontext, NormalState, awesomeconf);
|
unmanage(stack, drawcontext, NormalState, awesomeconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(drawcontext->font.set)
|
if(drawcontext->font.set)
|
||||||
XFreeFontSet(disp, drawcontext->font.set);
|
XFreeFontSet(disp, drawcontext->font.set);
|
||||||
else
|
else
|
||||||
XFreeFont(disp, drawcontext->font.xfont);
|
XFreeFont(disp, drawcontext->font.xfont);
|
||||||
XUngrabKey(disp, AnyKey, AnyModifier, DefaultRootWindow(disp));
|
|
||||||
|
for(screen = 0; screen < ScreenCount(disp); screen++);
|
||||||
|
XUngrabKey(disp, AnyKey, AnyModifier, RootWindow(disp, screen));
|
||||||
|
|
||||||
XFreePixmap(disp, awesomeconf->statusbar.drawable);
|
XFreePixmap(disp, awesomeconf->statusbar.drawable);
|
||||||
XFreeGC(disp, drawcontext->gc);
|
XFreeGC(disp, drawcontext->gc);
|
||||||
XDestroyWindow(disp, awesomeconf->statusbar.window);
|
XDestroyWindow(disp, awesomeconf->statusbar.window);
|
||||||
|
@ -97,11 +104,15 @@ static void
|
||||||
scan(Display *disp, DC *drawcontext, awesome_config *awesomeconf)
|
scan(Display *disp, DC *drawcontext, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
unsigned int i, num;
|
unsigned int i, num;
|
||||||
|
int screen;
|
||||||
Window *wins, d1, d2;
|
Window *wins, d1, d2;
|
||||||
XWindowAttributes wa;
|
XWindowAttributes wa;
|
||||||
|
|
||||||
wins = NULL;
|
wins = NULL;
|
||||||
if(XQueryTree(disp, DefaultRootWindow(disp), &d1, &d2, &wins, &num))
|
for(screen = 0; screen < ScreenCount(disp); screen++)
|
||||||
|
{
|
||||||
|
if(XQueryTree(disp, RootWindow(disp, screen), &d1, &d2, &wins, &num))
|
||||||
|
{
|
||||||
for(i = 0; i < num; i++)
|
for(i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
if(!XGetWindowAttributes(disp, wins[i], &wa)
|
if(!XGetWindowAttributes(disp, wins[i], &wa)
|
||||||
|
@ -109,7 +120,7 @@ scan(Display *disp, DC *drawcontext, awesome_config *awesomeconf)
|
||||||
|| XGetTransientForHint(disp, wins[i], &d1))
|
|| XGetTransientForHint(disp, wins[i], &d1))
|
||||||
continue;
|
continue;
|
||||||
if(wa.map_state == IsViewable || getstate(disp, wins[i]) == IconicState)
|
if(wa.map_state == IsViewable || getstate(disp, wins[i]) == IconicState)
|
||||||
manage(disp, DefaultScreen(disp), drawcontext, wins[i], &wa, awesomeconf);
|
manage(disp, screen, drawcontext, wins[i], &wa, awesomeconf);
|
||||||
}
|
}
|
||||||
/* now the transients */
|
/* now the transients */
|
||||||
for(i = 0; i < num; i++)
|
for(i = 0; i < num; i++)
|
||||||
|
@ -118,7 +129,9 @@ scan(Display *disp, DC *drawcontext, awesome_config *awesomeconf)
|
||||||
continue;
|
continue;
|
||||||
if(XGetTransientForHint(disp, wins[i], &d1)
|
if(XGetTransientForHint(disp, wins[i], &d1)
|
||||||
&& (wa.map_state == IsViewable || getstate(disp, wins[i]) == IconicState))
|
&& (wa.map_state == IsViewable || getstate(disp, wins[i]) == IconicState))
|
||||||
manage(disp, DefaultScreen(disp), drawcontext, wins[i], &wa, awesomeconf);
|
manage(disp, screen, drawcontext, wins[i], &wa, awesomeconf);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(wins)
|
if(wins)
|
||||||
XFree(wins);
|
XFree(wins);
|
||||||
|
@ -137,10 +150,12 @@ static void
|
||||||
setup(Display *disp, DC *drawcontext, awesome_config *awesomeconf)
|
setup(Display *disp, DC *drawcontext, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
XSetWindowAttributes wa;
|
XSetWindowAttributes wa;
|
||||||
|
int screen;
|
||||||
|
|
||||||
netatom[NetSupported] = XInternAtom(disp, "_NET_SUPPORTED", False);
|
netatom[NetSupported] = XInternAtom(disp, "_NET_SUPPORTED", False);
|
||||||
netatom[NetWMName] = XInternAtom(disp, "_NET_WM_NAME", False);
|
netatom[NetWMName] = XInternAtom(disp, "_NET_WM_NAME", False);
|
||||||
XChangeProperty(disp, DefaultRootWindow(disp), netatom[NetSupported],
|
for(screen = 0; screen < ScreenCount(disp); screen++)
|
||||||
|
XChangeProperty(disp, RootWindow(disp, screen), netatom[NetSupported],
|
||||||
XA_ATOM, 32, PropModeReplace, (unsigned char *) netatom, NetLast);
|
XA_ATOM, 32, PropModeReplace, (unsigned char *) netatom, NetLast);
|
||||||
/* init cursors */
|
/* init cursors */
|
||||||
drawcontext->cursor[CurNormal] = XCreateFontCursor(disp, XC_left_ptr);
|
drawcontext->cursor[CurNormal] = XCreateFontCursor(disp, XC_left_ptr);
|
||||||
|
@ -150,9 +165,12 @@ setup(Display *disp, DC *drawcontext, awesome_config *awesomeconf)
|
||||||
wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask
|
wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask
|
||||||
| EnterWindowMask | LeaveWindowMask | StructureNotifyMask;
|
| EnterWindowMask | LeaveWindowMask | StructureNotifyMask;
|
||||||
wa.cursor = drawcontext->cursor[CurNormal];
|
wa.cursor = drawcontext->cursor[CurNormal];
|
||||||
XChangeWindowAttributes(disp, DefaultRootWindow(disp), CWEventMask | CWCursor, &wa);
|
for(screen = 0; screen < ScreenCount(disp); screen++)
|
||||||
XSelectInput(disp, DefaultRootWindow(disp), wa.event_mask);
|
{
|
||||||
grabkeys(disp, DefaultScreen(disp), awesomeconf);
|
XChangeWindowAttributes(disp, RootWindow(disp, screen), CWEventMask | CWCursor, &wa);
|
||||||
|
XSelectInput(disp, RootWindow(disp, screen), wa.event_mask);
|
||||||
|
grabkeys(disp, screen, awesomeconf);
|
||||||
|
}
|
||||||
compileregs(awesomeconf->rules, awesomeconf->nrules);
|
compileregs(awesomeconf->rules, awesomeconf->nrules);
|
||||||
/* bar */
|
/* bar */
|
||||||
drawcontext->h = awesomeconf->statusbar.height = drawcontext->font.height + 2;
|
drawcontext->h = awesomeconf->statusbar.height = drawcontext->font.height + 2;
|
||||||
|
@ -161,7 +179,8 @@ setup(Display *disp, DC *drawcontext, awesome_config *awesomeconf)
|
||||||
XSetLineAttributes(disp, drawcontext->gc, 1, LineSolid, CapButt, JoinMiter);
|
XSetLineAttributes(disp, drawcontext->gc, 1, LineSolid, CapButt, JoinMiter);
|
||||||
if(!drawcontext->font.set)
|
if(!drawcontext->font.set)
|
||||||
XSetFont(disp, drawcontext->gc, drawcontext->font.xfont->fid);
|
XSetFont(disp, drawcontext->gc, drawcontext->font.xfont->fid);
|
||||||
loadawesomeprops(disp, DefaultScreen(disp), awesomeconf);
|
for(screen = 0; screen < ScreenCount(disp); screen++)
|
||||||
|
loadawesomeprops(disp, screen, awesomeconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -250,6 +269,7 @@ main(int argc, char *argv[])
|
||||||
Display * dpy;
|
Display * dpy;
|
||||||
awesome_config awesomeconf;
|
awesome_config awesomeconf;
|
||||||
int shape_event, randr_event_base;
|
int shape_event, randr_event_base;
|
||||||
|
int screen;
|
||||||
|
|
||||||
if(argc == 2 && !strcmp("-v", argv[1]))
|
if(argc == 2 && !strcmp("-v", argv[1]))
|
||||||
eprint("awesome-" VERSION " © 2007 Julien Danjou\n");
|
eprint("awesome-" VERSION " © 2007 Julien Danjou\n");
|
||||||
|
@ -264,8 +284,8 @@ main(int argc, char *argv[])
|
||||||
XSetErrorHandler(xerrorstart);
|
XSetErrorHandler(xerrorstart);
|
||||||
|
|
||||||
/* this causes an error if some other window manager is running */
|
/* this causes an error if some other window manager is running */
|
||||||
XSelectInput(dpy, RootWindow(dpy, DefaultScreen(dpy)), SubstructureRedirectMask);
|
for(screen = 0; screen < ScreenCount(dpy); screen++)
|
||||||
XSync(dpy, False);
|
XSelectInput(dpy, RootWindow(dpy, screen), SubstructureRedirectMask);
|
||||||
|
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
XSetErrorHandler(NULL);
|
XSetErrorHandler(NULL);
|
||||||
|
|
|
@ -96,12 +96,12 @@ _tile(Display *disp, int screen, awesome_config *awesomeconf, const Bool right)
|
||||||
screens_info = get_screen_info(disp, screen, awesomeconf->statusbar, &screen_numbers);
|
screens_info = get_screen_info(disp, screen, awesomeconf->statusbar, &screen_numbers);
|
||||||
|
|
||||||
for(n = 0, c = clients; c; c = c->next)
|
for(n = 0, c = clients; c; c = c->next)
|
||||||
if(IS_TILED(c, awesomeconf->selected_tags, awesomeconf->ntags))
|
if(IS_TILED(c, awesomeconf->selected_tags, awesomeconf->ntags) && c->screen == screen)
|
||||||
n++;
|
n++;
|
||||||
|
|
||||||
for(i = 0, c = clients; c; c = c->next)
|
for(i = 0, c = clients; c; c = c->next)
|
||||||
{
|
{
|
||||||
if(!IS_TILED(c, awesomeconf->selected_tags, awesomeconf->ntags))
|
if(!IS_TILED(c, awesomeconf->selected_tags, awesomeconf->ntags) || c->screen != screen)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(use_screen == -1
|
if(use_screen == -1
|
||||||
|
@ -194,11 +194,17 @@ _tile(Display *disp, int screen, awesome_config *awesomeconf, const Bool right)
|
||||||
void
|
void
|
||||||
tile(Display *disp, awesome_config *awesomeconf)
|
tile(Display *disp, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
_tile(disp, DefaultScreen(disp), awesomeconf, True);
|
int screen;
|
||||||
|
|
||||||
|
for(screen = 0; screen < ScreenCount(disp); screen++)
|
||||||
|
_tile(disp, screen, awesomeconf, True);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tileleft(Display *disp, awesome_config *awesomeconf)
|
tileleft(Display *disp, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
_tile(disp, DefaultScreen(disp), awesomeconf, False);
|
int screen;
|
||||||
|
|
||||||
|
for(screen = 0; screen < ScreenCount(disp); screen++)
|
||||||
|
_tile(disp, screen, awesomeconf, False);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue