use real_screen for X functions, not logical screen

This commit is contained in:
Julien Danjou 2007-09-27 17:12:51 +02:00
parent bdd408cd6c
commit ecf79693a2
3 changed files with 28 additions and 11 deletions

View file

@ -177,6 +177,12 @@ static void
setup(Display *disp, int screen, DC *drawcontext, awesome_config *awesomeconf)
{
XSetWindowAttributes wa;
int real_screen;
if(XineramaIsActive(disp))
real_screen = DefaultScreen(disp);
else
real_screen = screen;
/* init cursors */
drawcontext->cursor[CurNormal] = XCreateFontCursor(disp, XC_left_ptr);
@ -188,18 +194,18 @@ setup(Display *disp, int screen, DC *drawcontext, awesome_config *awesomeconf)
| EnterWindowMask | LeaveWindowMask | StructureNotifyMask;
wa.cursor = drawcontext->cursor[CurNormal];
XChangeWindowAttributes(disp, RootWindow(disp, screen), CWEventMask | CWCursor, &wa);
XChangeWindowAttributes(disp, RootWindow(disp, real_screen), CWEventMask | CWCursor, &wa);
XSelectInput(disp, RootWindow(disp, screen), wa.event_mask);
XSelectInput(disp, RootWindow(disp, real_screen), wa.event_mask);
grabkeys(disp, screen, awesomeconf);
grabkeys(disp, real_screen, awesomeconf);
compileregs(awesomeconf->rules, awesomeconf->nrules);
/* bar */
drawcontext->h = awesomeconf->statusbar.height = drawcontext->font.height + 2;
initstatusbar(disp, screen, drawcontext, &awesomeconf->statusbar);
drawcontext->gc = XCreateGC(disp, RootWindow(disp, screen), 0, 0);
drawcontext->gc = XCreateGC(disp, RootWindow(disp, real_screen), 0, 0);
XSetLineAttributes(disp, drawcontext->gc, 1, LineSolid, CapButt, JoinMiter);
if(!drawcontext->font.set)

View file

@ -496,7 +496,12 @@ get_numlockmask(Display *disp)
static unsigned long
initcolor(Display *disp, int scr, const char *colstr)
{
Colormap cmap = DefaultColormap(disp, scr);
Colormap cmap;
/* bypass screen if scr is a Xinerama screen number */
if(XineramaIsActive(disp))
cmap = DefaultColormap(disp, DefaultScreen(disp));
else
cmap = DefaultColormap(disp, scr);
XColor color;
if(!XAllocNamedColor(disp, cmap, colstr, &color, &color))
die("awesome: error, cannot allocate color '%s'\n", colstr);

View file

@ -107,26 +107,32 @@ void
initstatusbar(Display *disp, int screen, DC *drawcontext, Statusbar *statusbar)
{
XSetWindowAttributes wa;
int real_screen;
statusbar->screen = screen;
if(XineramaIsActive(disp))
real_screen = DefaultScreen(disp);
else
real_screen = screen;
wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask
| EnterWindowMask | LeaveWindowMask | StructureNotifyMask;
wa.cursor = drawcontext->cursor[CurNormal];
wa.override_redirect = 1;
wa.background_pixmap = ParentRelative;
wa.event_mask = ButtonPressMask | ExposureMask;
statusbar->window = XCreateWindow(disp, RootWindow(disp, screen), 0, 0, DisplayWidth(disp, screen),
statusbar->height, 0, DefaultDepth(disp, screen), CopyFromParent,
DefaultVisual(disp, screen), CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
statusbar->window = XCreateWindow(disp, RootWindow(disp, screen), 0, 0, DisplayWidth(disp, real_screen),
statusbar->height, 0, DefaultDepth(disp, real_screen), CopyFromParent,
DefaultVisual(disp, real_screen), CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
XDefineCursor(disp, statusbar->window, drawcontext->cursor[CurNormal]);
updatebarpos(disp, *statusbar);
XMapRaised(disp, statusbar->window);
statusbar->drawable = XCreatePixmap(disp,
RootWindow(disp, screen),
DisplayWidth(disp, screen),
RootWindow(disp, real_screen),
DisplayWidth(disp, real_screen),
statusbar->height,
DefaultDepth(disp, screen));
DefaultDepth(disp, real_screen));
}
void