|
@@ -13,14 +13,16 @@
|
|
|
#include "util.h"
|
|
|
|
|
|
static Scr33n*
|
|
|
-screen_new(Geo *g)
|
|
|
+screen_new(Geo *g, int id)
|
|
|
{
|
|
|
Scr33n *s = xcalloc(1, sizeof(Scr33n));
|
|
|
|
|
|
s->geo = *g;
|
|
|
s->seltag = NULL;
|
|
|
+ s->id = id;
|
|
|
|
|
|
SLIST_INIT(&s->tags);
|
|
|
+ SLIST_INIT(&s->infobars);
|
|
|
|
|
|
SLIST_INSERT_HEAD(&W->h.screen, s, next);
|
|
|
|
|
@@ -40,26 +42,22 @@ screen_init(void)
|
|
|
|
|
|
#ifdef HAVE_XINERAMA
|
|
|
XineramaScreenInfo *xsi;
|
|
|
- int i = 0, n;
|
|
|
+ int i, n = 0;
|
|
|
|
|
|
if(XineramaIsActive(W->dpy))
|
|
|
{
|
|
|
xsi = XineramaQueryScreens(W->dpy, &n);
|
|
|
|
|
|
- for(; i < n; ++i)
|
|
|
+ for(i = 0; i < n; ++i)
|
|
|
{
|
|
|
- s = NULL;
|
|
|
g.x = xsi[i].x_org;
|
|
|
g.y = xsi[i].y_org;
|
|
|
g.w = xsi[i].width;
|
|
|
g.h = xsi[i].height;
|
|
|
|
|
|
- s = screen_new(&g);
|
|
|
+ s = screen_new(&g, i);
|
|
|
tag_screen(s, tag_new(s, "tag")); /* tmp */
|
|
|
-
|
|
|
- SLIST_INSERT_HEAD(&W->h.screen, s, next);
|
|
|
-
|
|
|
- printf("%d: %d %d %d %d\n", i, s->geo.x, s->geo.y, s->geo.w, s->geo.h);
|
|
|
+ s = NULL;
|
|
|
}
|
|
|
|
|
|
XFree(xsi);
|
|
@@ -67,21 +65,30 @@ screen_init(void)
|
|
|
else
|
|
|
#endif /* HAVE_XINERAMA */
|
|
|
{
|
|
|
+
|
|
|
g.x = g.y = 0;
|
|
|
g.w = DisplayWidth(W->dpy, W->xscreen);
|
|
|
g.h = DisplayHeight(W->dpy, W->xscreen);
|
|
|
|
|
|
- s = screen_new(&g);
|
|
|
+ s = screen_new(&g, 0);
|
|
|
tag_screen(s, tag_new(s, "tag"));
|
|
|
-
|
|
|
- SLIST_INSERT_HEAD(&W->h.screen, s, next);
|
|
|
- printf("%d: %d %d %d %d\n", i, s->geo.x, s->geo.y, s->geo.w, s->geo.h);
|
|
|
}
|
|
|
|
|
|
+ SLIST_FOREACH(s, &W->h.screen, next)
|
|
|
+ printf("%d: %d %d %d %d\n", s->id, s->geo.x, s->geo.y, s->geo.w, s->geo.h);
|
|
|
}
|
|
|
|
|
|
void
|
|
|
screen_free(void)
|
|
|
{
|
|
|
- FREE_LIST(Scr33n, W->h.screen);
|
|
|
+ Scr33n *s;
|
|
|
+
|
|
|
+ while(!SLIST_EMPTY(&W->h.screen))
|
|
|
+ {
|
|
|
+ s = SLIST_FIRST(&W->h.screen);
|
|
|
+ SLIST_REMOVE_HEAD(&W->h.screen, next);
|
|
|
+ infobar_free(s);
|
|
|
+ /*tag_free(s);*/
|
|
|
+ free(s);
|
|
|
+ }
|
|
|
}
|