1 module theme.layout;
2 
3 import kernel;
4 import cboxapp;
5 import old;
6 import types;
7 import utils;
8 import theme.manager;
9 import window;
10 import monitor;
11 
12 import std.c.stdlib;
13 import x11.X;
14 import x11.Xlib;
15 import x11.keysymdef;
16 import x11.Xutil;
17 import x11.Xatom;
18 import std.stdio;
19 import std..string;
20 import std.algorithm;
21 
22 
23 struct Layout 
24 {
25     const string symbol;
26     void function(Monitor* m) arrange;
27 }
28 
29 struct Clr 
30 {
31     ulong rgb;
32 
33     this(Drw* drw, in string clrname) 
34     {
35         if(drw is null) {
36            // lout(__FUNCTION__~"\n\t--> NULL Drw* parm");
37             exit(EXIT_FAILURE);
38         }
39 
40         Colormap cmap;
41         XColor color;
42 
43         cmap = DefaultColormap(drw.dpy, drw.screen);
44         if(!XAllocNamedColor(drw.dpy, cmap, cast(char*)clrname.toStringz, &color, &color)) {
45            // lout("error, cannot allocate color '%s'", clrname);
46             exit(EXIT_FAILURE);
47         }
48         this.rgb = color.pixel;
49     }
50 
51     static void free(Clr *clr) 
52     {
53         if(clr) {
54             DGC.free(clr);
55         }
56     }
57 }