wip
This commit is contained in:
@@ -14,9 +14,6 @@
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/Xutil.h>
|
||||
#ifdef XINERAMA
|
||||
#include <X11/extensions/Xinerama.h>
|
||||
#endif /* XINERAMA */
|
||||
#include <X11/Xft/Xft.h>
|
||||
|
||||
#include "drw.h"
|
||||
@@ -128,7 +125,6 @@ static void arrangemon(Monitor *m);
|
||||
static void attach(Client *c);
|
||||
static void attachstack(Client *c);
|
||||
static void buttonpress(XEvent *e);
|
||||
static void checkotherwm(void);
|
||||
static void cleanup(void);
|
||||
static void cleanupmon(Monitor *mon);
|
||||
static void clientmessage(XEvent *e);
|
||||
@@ -206,7 +202,6 @@ static Client *wintoclient(Window w);
|
||||
static Monitor *wintomon(Window w);
|
||||
static int xerror(Display *dpy, XErrorEvent *ee);
|
||||
static int xerrordummy(Display *dpy, XErrorEvent *ee);
|
||||
static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
||||
static void zoom(const Arg *arg);
|
||||
|
||||
/* variables */
|
||||
@@ -432,17 +427,6 @@ buttonpress(XEvent *e)
|
||||
buttons[i].func(click == ClkTagBar && buttons[i].arg.i == 0 ? &arg : &buttons[i].arg);
|
||||
}
|
||||
|
||||
void
|
||||
checkotherwm(void)
|
||||
{
|
||||
xerrorxlib = XSetErrorHandler(xerrorstart);
|
||||
/* this causes an error if some other window manager is running */
|
||||
XSelectInput(dpy, DefaultRootWindow(dpy), SubstructureRedirectMask);
|
||||
XSync(dpy, False);
|
||||
XSetErrorHandler(xerror);
|
||||
XSync(dpy, False);
|
||||
}
|
||||
|
||||
void
|
||||
cleanup(void)
|
||||
{
|
||||
@@ -992,18 +976,6 @@ incnmaster(const Arg *arg)
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
#ifdef XINERAMA
|
||||
static int
|
||||
isuniquegeom(XineramaScreenInfo *unique, size_t n, XineramaScreenInfo *info)
|
||||
{
|
||||
while (n--)
|
||||
if (unique[n].x_org == info->x_org && unique[n].y_org == info->y_org
|
||||
&& unique[n].width == info->width && unique[n].height == info->height)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
#endif /* XINERAMA */
|
||||
|
||||
void
|
||||
keypress(XEvent *e)
|
||||
{
|
||||
@@ -1855,62 +1827,6 @@ updategeom(void)
|
||||
{
|
||||
int dirty = 0;
|
||||
|
||||
#ifdef XINERAMA
|
||||
if (XineramaIsActive(dpy)) {
|
||||
int i, j, n, nn;
|
||||
Client *c;
|
||||
Monitor *m;
|
||||
XineramaScreenInfo *info = XineramaQueryScreens(dpy, &nn);
|
||||
XineramaScreenInfo *unique = NULL;
|
||||
|
||||
for (n = 0, m = mons; m; m = m->next, n++);
|
||||
/* only consider unique geometries as separate screens */
|
||||
unique = ecalloc(nn, sizeof(XineramaScreenInfo));
|
||||
for (i = 0, j = 0; i < nn; i++)
|
||||
if (isuniquegeom(unique, j, &info[i]))
|
||||
memcpy(&unique[j++], &info[i], sizeof(XineramaScreenInfo));
|
||||
XFree(info);
|
||||
nn = j;
|
||||
|
||||
/* new monitors if nn > n */
|
||||
for (i = n; i < nn; i++) {
|
||||
for (m = mons; m && m->next; m = m->next);
|
||||
if (m)
|
||||
m->next = createmon();
|
||||
else
|
||||
mons = createmon();
|
||||
}
|
||||
for (i = 0, m = mons; i < nn && m; m = m->next, i++)
|
||||
if (i >= n
|
||||
|| unique[i].x_org != m->mx || unique[i].y_org != m->my
|
||||
|| unique[i].width != m->mw || unique[i].height != m->mh)
|
||||
{
|
||||
dirty = 1;
|
||||
m->num = i;
|
||||
m->mx = m->wx = unique[i].x_org;
|
||||
m->my = m->wy = unique[i].y_org;
|
||||
m->mw = m->ww = unique[i].width;
|
||||
m->mh = m->wh = unique[i].height;
|
||||
updatebarpos(m);
|
||||
}
|
||||
/* removed monitors if n > nn */
|
||||
for (i = nn; i < n; i++) {
|
||||
for (m = mons; m && m->next; m = m->next);
|
||||
while ((c = m->clients)) {
|
||||
dirty = 1;
|
||||
m->clients = c->next;
|
||||
detachstack(c);
|
||||
c->mon = mons;
|
||||
attach(c);
|
||||
attachstack(c);
|
||||
}
|
||||
if (m == selmon)
|
||||
selmon = mons;
|
||||
cleanupmon(m);
|
||||
}
|
||||
free(unique);
|
||||
} else
|
||||
#endif /* XINERAMA */
|
||||
{ /* default monitor setup */
|
||||
if (!mons)
|
||||
mons = createmon();
|
||||
@@ -2105,15 +2021,6 @@ xerrordummy(Display *dpy, XErrorEvent *ee)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Startup Error handler to check if another window manager
|
||||
* is already running. */
|
||||
int
|
||||
xerrorstart(Display *dpy, XErrorEvent *ee)
|
||||
{
|
||||
die("dwm: another window manager is already running");
|
||||
return -1;
|
||||
}
|
||||
|
||||
void
|
||||
zoom(const Arg *arg)
|
||||
{
|
||||
@@ -2129,15 +2036,8 @@ zoom(const Arg *arg)
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
if (argc == 2 && !strcmp("-v", argv[1]))
|
||||
die("dwm-"VERSION);
|
||||
if (argc != 1)
|
||||
die("usage: dwm [-v]");
|
||||
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
|
||||
fputs("warning: no locale support\n", stderr);
|
||||
if (!(dpy = XOpenDisplay(NULL)))
|
||||
die("dwm: cannot open display");
|
||||
checkotherwm();
|
||||
setup();
|
||||
scan();
|
||||
run();
|
||||
|
||||
Reference in New Issue
Block a user