add xinerama support
This commit is contained in:
parent
8d3f4beb55
commit
a0f82a1135
@ -4,4 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "wmfs.h"
|
#include "wmfs.h"
|
||||||
|
#include "infobar.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,16 @@
|
|||||||
|
|
||||||
#include "wmfs.h"
|
#include "wmfs.h"
|
||||||
|
|
||||||
|
enum { ElemTag = 0, ElemLayout, ElemSelbar, ElemStatus, ElemCustom };
|
||||||
|
/*
|
||||||
|
const struct elem_funcs { char c; void (*func_init)(Infobar *i); void (*func_update)(Element *e); } elem_funcs[] =
|
||||||
|
{
|
||||||
|
{ 't', infobar_elem_tag_init, infobar_elem_tag_update },
|
||||||
|
{ 'l', infobar_elem_layout_init, infobar_elem_layout_update },
|
||||||
|
{ 's', infobar_elem_selbar_init, infobar_elem_selbar_update },
|
||||||
|
{ 'S', infobar_elem_status_init, infobar_elem_status_update },
|
||||||
|
{ '\0', NULL, NULL }
|
||||||
|
};*/
|
||||||
|
|
||||||
|
|
||||||
#endif /* INFOBAR_H */
|
#endif /* INFOBAR_H */
|
||||||
|
|||||||
@ -3,6 +3,12 @@
|
|||||||
* For license, see COPYING.
|
* For license, see COPYING.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define HAVE_XINERAMA
|
||||||
|
|
||||||
|
#ifdef HAVE_XINERAMA
|
||||||
|
#include <X11/extensions/Xinerama.h>
|
||||||
|
#endif /* HAVE_XINERAMA */
|
||||||
|
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
@ -30,15 +36,48 @@ screen_init(void)
|
|||||||
Scr33n *s;
|
Scr33n *s;
|
||||||
Geo g;
|
Geo g;
|
||||||
|
|
||||||
g.x = 0;
|
SLIST_INIT(&W->h.screen);
|
||||||
g.y = 0;
|
|
||||||
|
#ifdef HAVE_XINERAMA
|
||||||
|
XineramaScreenInfo *xsi;
|
||||||
|
int i = 0, n;
|
||||||
|
|
||||||
|
if(XineramaIsActive(W->dpy))
|
||||||
|
{
|
||||||
|
xsi = XineramaQueryScreens(W->dpy, &n);
|
||||||
|
|
||||||
|
for(; 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);
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
XFree(xsi);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif /* HAVE_XINERAMA */
|
||||||
|
{
|
||||||
|
g.x = g.y = 0;
|
||||||
g.w = DisplayWidth(W->dpy, W->xscreen);
|
g.w = DisplayWidth(W->dpy, W->xscreen);
|
||||||
g.h = DisplayHeight(W->dpy, W->xscreen);
|
g.h = DisplayHeight(W->dpy, W->xscreen);
|
||||||
|
|
||||||
SLIST_INIT(&W->h.screen);
|
|
||||||
|
|
||||||
s = screen_new(&g);
|
s = screen_new(&g);
|
||||||
tag_screen(s, tag_new(s, "tag"));
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@ -114,6 +114,7 @@ wmfs_xinit(void)
|
|||||||
W->numlockmask = (1 << i);
|
W->numlockmask = (1 << i);
|
||||||
XFreeModifiermap(mm);
|
XFreeModifiermap(mm);
|
||||||
|
|
||||||
|
W->running = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -194,8 +195,6 @@ wmfs_scan(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
XFree(w);
|
XFree(w);
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -204,11 +203,9 @@ wmfs_loop(void)
|
|||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
|
||||||
while(XPending(W->dpy))
|
while(XPending(W->dpy))
|
||||||
{
|
while(W->running && !XNextEvent(W->dpy, &ev))
|
||||||
XNextEvent(W->dpy, &ev);
|
|
||||||
HANDLE_EVENT(&ev);
|
HANDLE_EVENT(&ev);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
wmfs_init(void)
|
wmfs_init(void)
|
||||||
@ -240,6 +237,8 @@ wmfs_quit(void)
|
|||||||
|
|
||||||
free(W->net_atom);
|
free(W->net_atom);
|
||||||
free(W);
|
free(W);
|
||||||
|
|
||||||
|
W->running = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -35,6 +35,8 @@ typedef const char* Uicb;
|
|||||||
* Structures
|
* Structures
|
||||||
*/
|
*/
|
||||||
typedef struct Geo Geo;
|
typedef struct Geo Geo;
|
||||||
|
typedef struct Element Element;
|
||||||
|
typedef struct Infobar Infobar;
|
||||||
typedef struct Barwin Barwin;
|
typedef struct Barwin Barwin;
|
||||||
typedef struct Scr33n Scr33n;
|
typedef struct Scr33n Scr33n;
|
||||||
typedef struct Tag Tag;
|
typedef struct Tag Tag;
|
||||||
@ -55,13 +57,29 @@ struct Barwin
|
|||||||
Color fg, bg;
|
Color fg, bg;
|
||||||
Geo geo;
|
Geo geo;
|
||||||
Flags flags;
|
Flags flags;
|
||||||
|
SLIST_HEAD(, MouseBind) mousebinds;
|
||||||
SLIST_ENTRY(Barwin) next;
|
SLIST_ENTRY(Barwin) next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Infobar's element */
|
||||||
|
struct Element
|
||||||
|
{
|
||||||
|
SLIST_ENTRY(Barwin) bars;
|
||||||
|
Geo geo;
|
||||||
|
int type;
|
||||||
|
void (*func_init)(Infobar *i);
|
||||||
|
void (*func_update)(Element *e);
|
||||||
|
STAILQ_ENTRY(Element) next;
|
||||||
|
};
|
||||||
|
|
||||||
/* Infobar */
|
/* Infobar */
|
||||||
struct Infobar
|
struct Infobar
|
||||||
{
|
{
|
||||||
Barwin *bar;
|
Barwin *bar;
|
||||||
|
Geo geo;
|
||||||
|
Scr33n *screen;
|
||||||
|
STAILQ_HEAD(, Element) elements;
|
||||||
|
SLIST_ENTRY(Infobar) next;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Screen */
|
/* Screen */
|
||||||
@ -137,6 +155,7 @@ struct Wmfs
|
|||||||
Flags numlockmask;
|
Flags numlockmask;
|
||||||
GC gc;
|
GC gc;
|
||||||
Atom *net_atom;
|
Atom *net_atom;
|
||||||
|
bool running;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
@ -149,6 +168,7 @@ struct Wmfs
|
|||||||
{
|
{
|
||||||
SLIST_HEAD(, Scr33n) screen;
|
SLIST_HEAD(, Scr33n) screen;
|
||||||
SLIST_HEAD(, Client) client;
|
SLIST_HEAD(, Client) client;
|
||||||
|
SLIST_HEAD(, Infobar) infobar;
|
||||||
SLIST_HEAD(, Keybind) keybind;
|
SLIST_HEAD(, Keybind) keybind;
|
||||||
SLIST_HEAD(, Barwin) barwin;
|
SLIST_HEAD(, Barwin) barwin;
|
||||||
} h;
|
} h;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user