Change to the linux kernel coding style
[wmaker-crm.git] / src / wsmap.c
1
2 #include "WindowMaker.h"
3 #include "window.h"
4
5 typedef struct {
6 WWindow *wwin;
7 WMLabel *mini;
8 } WSMWindow;
9
10 typedef struct {
11 WScreen *scr;
12
13 WMWindow *win;
14
15 WSMWindow *windows;
16 int windowCount;
17
18 int xcount, ycount;
19 int wswidth, wsheight;
20 } WWorkspaceMap;
21
22 #define WSMAP_DEFAULT_WIDTH 150
23
24 static WWorkspaceMap *createWorkspaceMap(WMScreen * scr, int xcount, int ycount)
25 {
26 WWorkspaceMap *wsm = wnew0(WWorkspaceMap, 1);
27 WMRect rect;
28 //
29 rect.width = 1024;
30 rect.height = 768;
31
32 wsm->win = WMCreateWindow(scr, "wsmap");
33
34 /* find out the ideal size of the mini-workspaces */
35
36 wsm->wswidth = WSMAP_DEFAULT_WIDTH;
37 wsm->wsheight = (wsm->wswidth * rect.height) / rect.width;
38
39 // check if it fits screen
40
41 wsm->xcount = xcount;
42 wsm->ycount = ycount;
43
44 return wsm;
45 }
46
47 static void handleEvent(WWorkspaceMap * map, XEvent * event)
48 {
49 switch (event->type) {
50 }
51 }
52
53 void wShowWorkspaceMap(WScreen * scr)
54 {
55
56 }
57
58 Display *dpy;
59
60 int main(int argc, char **argv)
61 {
62 WWorkspaceMap *wsmap;
63 WMScreen *scr;
64
65 WMInitializeApplication("WSMap", &argc, argv);
66
67 dpy = XOpenDisplay("");
68 if (!dpy) {
69 wfatal("cant open display");
70 exit(0);
71 }
72
73 scr = WMCreateSimpleApplicationScreen(dpy);
74
75 wsmap = createWorkspaceMap(scr);
76
77 WMRealizeWidget(wsmap->win);
78 WMMapWidget(wsmap->win);
79
80 WMScreenMainLoop(scr);
81
82 return 0;
83 }