bugfix: don't do stuff RootWindow() with non existent screen (Xinerama)

This commit is contained in:
Julien Danjou 2007-10-03 20:46:03 +02:00
parent 97a2085705
commit 99ef84e621
4 changed files with 18 additions and 14 deletions

View File

@ -69,7 +69,7 @@ cleanup(DC *drawcontext, awesome_config *awesomeconf)
{
XftFontClose(awesomeconf->display, drawcontext->font);
XUngrabKey(awesomeconf->display, AnyKey, AnyModifier, RootWindow(awesomeconf->display, screen));
XUngrabKey(awesomeconf->display, AnyKey, AnyModifier, RootWindow(awesomeconf->display, awesomeconf[screen].phys_screen));
XFreePixmap(awesomeconf->display, awesomeconf[screen].statusbar.drawable);
XFreeGC(awesomeconf->display, drawcontext[screen].gc);
@ -207,8 +207,6 @@ setup(DC *drawcontext, awesome_config *awesomeconf)
initstatusbar(awesomeconf->display, awesomeconf->screen, drawcontext, &awesomeconf->statusbar);
drawcontext->gc = XCreateGC(awesomeconf->display, RootWindow(awesomeconf->display, awesomeconf->phys_screen), 0, 0);
XSetLineAttributes(awesomeconf->display, drawcontext->gc, 1, LineSolid, CapButt, JoinMiter);
loadawesomeprops(awesomeconf->display, awesomeconf);
}
/** Startup Error handler to check if another window manager
@ -321,9 +319,6 @@ main(int argc, char *argv[])
xerrorxlib = XSetErrorHandler(xerror);
XSync(dpy, False);
netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
/* allocate stuff */
dc = p_new(DC, get_screen_count(dpy));
awesomeconf = p_new(awesome_config, get_screen_count(dpy));
@ -332,9 +327,18 @@ main(int argc, char *argv[])
{
parse_config(dpy, screen, &dc[screen], confpath, &awesomeconf[screen]);
setup(&dc[screen], &awesomeconf[screen]);
drawstatusbar(dpy, &dc[screen], &awesomeconf[screen]);
}
netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
/* do this only for real screen */
for(screen = 0; screen < ScreenCount(dpy); screen++)
{
loadawesomeprops(dpy, &awesomeconf[screen]);
XChangeProperty(dpy, RootWindow(dpy, screen), netatom[NetSupported],
XA_ATOM, 32, PropModeReplace, (unsigned char *) netatom, NetLast);
drawstatusbar(dpy, &dc[screen], &awesomeconf[screen]);
}
handler = p_new(event_handler *, LASTEvent);

View File

@ -324,7 +324,7 @@ focus(Display *disp, DC *drawcontext, Client * c, Bool selscreen, awesome_config
setclienttrans(sel, -1);
}
else
XSetInputFocus(disp, RootWindow(disp, awesomeconf->screen), RevertToPointerRoot, CurrentTime);
XSetInputFocus(disp, RootWindow(disp, awesomeconf->phys_screen), RevertToPointerRoot, CurrentTime);
}
@ -372,7 +372,7 @@ manage(Display *disp, DC *drawcontext, Window w, XWindowAttributes *wa, awesome_
Window trans;
Status rettrans;
XWindowChanges wc;
ScreenInfo *si = get_display_info(disp, awesomeconf->screen, &awesomeconf->statusbar);
ScreenInfo *si = get_display_info(disp, awesomeconf->phys_screen, &awesomeconf->statusbar);
ScreenInfo *screen_info;
c = p_new(Client, 1);
@ -643,7 +643,7 @@ set_shape(Client *c)
/* Logic to decide if we have a shaped window cribbed from fvwm-2.5.10. */
if (XShapeQueryExtents(c->display, c->win, &bounding_shaped, &i, &i,
&u, &u, &b, &i, &i, &u, &u) && bounding_shaped)
XShapeCombineShape(c->display, RootWindow(c->display, c->screen), ShapeBounding, 0, 0, c->win, ShapeBounding, ShapeSet);
XShapeCombineShape(c->display, RootWindow(c->display, c->phys_screen), ShapeBounding, 0, 0, c->win, ShapeBounding, ShapeSet);
}
/** Set selected client transparency
@ -784,7 +784,7 @@ uicb_moveresize(Display *disp __attribute__ ((unused)),
ow = sel->w;
oh = sel->h;
Bool xqp = XQueryPointer(sel->display, RootWindow(sel->display, sel->screen), &dummy, &dummy, &mx, &my, &dx, &dy, &dui);
Bool xqp = XQueryPointer(sel->display, RootWindow(sel->display, sel->phys_screen), &dummy, &dummy, &mx, &my, &dx, &dy, &dui);
resize(sel, nx, ny, nw, nh, awesomeconf, True);
if (xqp && ox <= mx && (ox + ow) >= mx && oy <= my && (oy + oh) >= my)
{

View File

@ -452,7 +452,7 @@ handle_event_unmapnotify(XEvent * e, awesome_config *awesomeconf)
XUnmapEvent *ev = &e->xunmap;
if((c = getclient(ev->window))
&& ev->event == RootWindow(e->xany.display, c->screen) && (ev->send_event || !c->unmapped))
&& ev->event == RootWindow(e->xany.display, c->phys_screen) && (ev->send_event || !c->unmapped))
unmanage(c, &dc[c->screen], WithdrawnState, &awesomeconf[c->screen]);
}

View File

@ -106,7 +106,7 @@ loadawesomeprops(Display *disp, awesome_config * awesomeconf)
prop = p_new(char, awesomeconf->ntags + 1);
if(xgettextprop(disp, RootWindow(disp, awesomeconf->screen), AWESOMEPROPS_ATOM(disp), prop, awesomeconf->ntags + 1))
if(xgettextprop(disp, RootWindow(disp, awesomeconf->phys_screen), AWESOMEPROPS_ATOM(disp), prop, awesomeconf->ntags + 1))
for(i = 0; i < awesomeconf->ntags && prop[i]; i++)
awesomeconf->tags[i].selected = prop[i] == '1';
@ -156,7 +156,7 @@ saveawesomeprops(Display *disp, awesome_config *awesomeconf)
for(i = 0; i < awesomeconf->ntags; i++)
prop[i] = awesomeconf->tags[i].selected ? '1' : '0';
prop[i] = '\0';
XChangeProperty(disp, RootWindow(disp, awesomeconf->screen),
XChangeProperty(disp, RootWindow(disp, awesomeconf->phys_screen),
AWESOMEPROPS_ATOM(disp), XA_STRING, 8,
PropModeReplace, (unsigned char *) prop, i);
p_delete(&prop);