summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranselm@anselm1 <unknown>2008-03-05 00:11:44 +0000
committeranselm@anselm1 <unknown>2008-03-05 00:11:44 +0000
commite3c2d327f6f2874a165357d1ea2a50b2baf3a6f4 (patch)
treee4b604d5858e6355aec9f4cff64e111565d103fb
parentrenamed MAXLEN into MAXTAGLEN (backward compliance) (diff)
downloaddwm-e3c2d327f6f2874a165357d1ea2a50b2baf3a6f4.tar.gz
dwm-e3c2d327f6f2874a165357d1ea2a50b2baf3a6f4.zip
next on TODO
Diffstat (limited to '')
-rw-r--r--dwm.c64
1 files changed, 54 insertions, 10 deletions
diff --git a/dwm.c b/dwm.c
index 14aa808..af13a58 100644
--- a/dwm.c
+++ b/dwm.c
@@ -40,6 +40,21 @@
40#include <X11/Xlib.h> 40#include <X11/Xlib.h>
41#include <X11/Xproto.h> 41#include <X11/Xproto.h>
42#include <X11/Xutil.h> 42#include <X11/Xutil.h>
43/*
44 * TODO: Idea:
45 * I intend to not provide real Xinerama support, but instead having a Column
46 * tilecols[] array which is used by tile(), and a Column maxcols[] arrays which is used by
47 * maximise(). Those arrays should be initialized in config.h. For simplicity
48 * reasons mwfact should be replaced with a more advanced method which
49 * implements the same, but using the boundary between tilecols[0] and
50 * tilecols[1] instead. Besides this, get rid of BARPOS and use instead the
51 * following mechanism:
52 *
53 * #define BX 0
54 * #define BY 0
55 * #define BW sw
56 * bh is calculated automatically and should be used for the
57 */
43#ifdef XINERAMA 58#ifdef XINERAMA
44#include <X11/extensions/Xinerama.h> 59#include <X11/extensions/Xinerama.h>
45#endif 60#endif
@@ -78,6 +93,10 @@ struct Client {
78 93
79typedef struct { 94typedef struct {
80 int x, y, w, h; 95 int x, y, w, h;
96} Column;
97
98typedef struct {
99 int x, y, w, h;
81 unsigned long norm[ColLast]; 100 unsigned long norm[ColLast];
82 unsigned long sel[ColLast]; 101 unsigned long sel[ColLast];
83 Drawable drawable; 102 Drawable drawable;
@@ -195,7 +214,7 @@ void selectview(const char *arg);
195/* variables */ 214/* variables */
196char stext[256], buf[256]; 215char stext[256], buf[256];
197double mwfact; 216double mwfact;
198int screen, sx, sy, sw, sh, wax, way, waw, wah, xscreens; 217int screen, sx, sy, sw, sh, wax, way, waw, wah, ncols;
199int (*xerrorxlib)(Display *, XErrorEvent *); 218int (*xerrorxlib)(Display *, XErrorEvent *);
200unsigned int bh, bpos; 219unsigned int bh, bpos;
201unsigned int blw = 0; 220unsigned int blw = 0;
@@ -224,14 +243,12 @@ Bool *seltags;
224Client *clients = NULL; 243Client *clients = NULL;
225Client *sel = NULL; 244Client *sel = NULL;
226Client *stack = NULL; 245Client *stack = NULL;
246Column *cols = NULL;
227Cursor cursor[CurLast]; 247Cursor cursor[CurLast];
228Display *dpy; 248Display *dpy;
229DC dc = {0}; 249DC dc = {0};
230Layout *lt; 250Layout *lt;
231Window root, barwin; 251Window root, barwin;
232#ifdef XINERAMA
233XineramaScreenInfo *info = NULL;
234#endif
235 252
236/* configuration, allows nested code to access above variables */ 253/* configuration, allows nested code to access above variables */
237#include "config.h" 254#include "config.h"
@@ -393,10 +410,6 @@ cleanup(void) {
393 XFreeCursor(dpy, cursor[CurResize]); 410 XFreeCursor(dpy, cursor[CurResize]);
394 XFreeCursor(dpy, cursor[CurMove]); 411 XFreeCursor(dpy, cursor[CurMove]);
395 XDestroyWindow(dpy, barwin); 412 XDestroyWindow(dpy, barwin);
396#if XINERAMA
397 if(info)
398 XFree(info);
399#endif
400 XSync(dpy, False); 413 XSync(dpy, False);
401 XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime); 414 XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
402} 415}
@@ -1458,8 +1471,12 @@ setmwfact(const char *arg) {
1458 1471
1459void 1472void
1460setup(void) { 1473setup(void) {
1474 int screens = 1;
1461 unsigned int i; 1475 unsigned int i;
1462 XSetWindowAttributes wa; 1476 XSetWindowAttributes wa;
1477#ifdef XINERAMA
1478 XineramaScreenInfo *info;
1479#endif
1463 1480
1464 /* init screen */ 1481 /* init screen */
1465 screen = DefaultScreen(dpy); 1482 screen = DefaultScreen(dpy);
@@ -1482,11 +1499,38 @@ setup(void) {
1482 cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing); 1499 cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing);
1483 cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur); 1500 cursor[CurMove] = XCreateFontCursor(dpy, XC_fleur);
1484 1501
1502 ncols = 2;
1485#ifdef XINERAMA 1503#ifdef XINERAMA
1486 if(XineramaIsActive(dpy)) 1504 if(XineramaIsActive(dpy)) {
1487 info = XineramaQueryScreens(dpy, &xscreens); 1505 if((info = XineramaQueryScreens(dpy, &screens))) {
1506 if(screens == 1) {
1507 sx = info[0].x_org;
1508 sy = info[0].y_org;
1509 sw = info[0].width;
1510 sh = info[0].height;
1511 }
1512 else {
1513 ncols = screens;
1514 cols = emallocz(ncols * sizeof(Column));
1515 for(i = 0; i < ncols; i++) {
1516 cols[i].x = info[i].x_org;
1517 cols[i].y = info[i].y_org;
1518 cols[i].w = info[i].width;
1519 cols[i].h = info[i].height;
1520 }
1521 }
1522 XFree(info);
1523 }
1524 }
1525 else
1488#endif 1526#endif
1527 {
1528 cols = emallocz(ncols * sizeof(Column));
1529 cols[0].x = sx;
1530 cols[0].y = sy;
1489 1531
1532
1533 }
1490 /* init appearance */ 1534 /* init appearance */
1491 dc.norm[ColBorder] = getcolor(NORMBORDERCOLOR); 1535 dc.norm[ColBorder] = getcolor(NORMBORDERCOLOR);
1492 dc.norm[ColBG] = getcolor(NORMBGCOLOR); 1536 dc.norm[ColBG] = getcolor(NORMBGCOLOR);