Change to the linux kernel coding style
[wmaker-crm.git] / src / wsmap.c
Commit [+]AuthorDateLineData
53db5fc4 kojima2005-03-11 21:51:49 +00001
2#include "WindowMaker.h"
3#include "window.h"
4
53db5fc4 kojima2005-03-11 21:51:49 +00005typedef struct {
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +02006 WWindow *wwin;
7 WMLabel *mini;
53db5fc4 kojima2005-03-11 21:51:49 +00008} WSMWindow;
9
53db5fc4 kojima2005-03-11 21:51:49 +000010typedef struct {
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020011 WScreen *scr;
53db5fc4 kojima2005-03-11 21:51:49 +000012
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020013 WMWindow *win;
53db5fc4 kojima2005-03-11 21:51:49 +000014
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020015 WSMWindow *windows;
16 int windowCount;
53db5fc4 kojima2005-03-11 21:51:49 +000017
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020018 int xcount, ycount;
19 int wswidth, wsheight;
53db5fc4 kojima2005-03-11 21:51:49 +000020} WWorkspaceMap;
21
53db5fc4 kojima2005-03-11 21:51:49 +000022#define WSMAP_DEFAULT_WIDTH 150
23
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020024static WWorkspaceMap *createWorkspaceMap(WMScreen * scr, int xcount, int ycount)
53db5fc4 kojima2005-03-11 21:51:49 +000025{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020026 WWorkspaceMap *wsm = wnew0(WWorkspaceMap, 1);
27 WMRect rect;
28 //
29 rect.width = 1024;
30 rect.height = 768;
53db5fc4 kojima2005-03-11 21:51:49 +000031
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020032 wsm->win = WMCreateWindow(scr, "wsmap");
53db5fc4 kojima2005-03-11 21:51:49 +000033
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020034 /* find out the ideal size of the mini-workspaces */
53db5fc4 kojima2005-03-11 21:51:49 +000035
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020036 wsm->wswidth = WSMAP_DEFAULT_WIDTH;
37 wsm->wsheight = (wsm->wswidth * rect.height) / rect.width;
53db5fc4 kojima2005-03-11 21:51:49 +000038
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020039 // check if it fits screen
53db5fc4 kojima2005-03-11 21:51:49 +000040
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020041 wsm->xcount = xcount;
42 wsm->ycount = ycount;
53db5fc4 kojima2005-03-11 21:51:49 +000043
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020044 return wsm;
53db5fc4 kojima2005-03-11 21:51:49 +000045}
46
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020047static void handleEvent(WWorkspaceMap * map, XEvent * event)
53db5fc4 kojima2005-03-11 21:51:49 +000048{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020049 switch (event->type) {
50 }
53db5fc4 kojima2005-03-11 21:51:49 +000051}
52
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020053void wShowWorkspaceMap(WScreen * scr)
54{
53db5fc4 kojima2005-03-11 21:51:49 +000055
688a56e8 Carlos R. Mafra2009-08-20 00:59:40 +020056}
53db5fc4 kojima2005-03-11 21:51:49 +000057
58Display *dpy;
59
60int main(int argc, char **argv)
61{
688a56e8
CM
Carlos R. Mafra2009-08-20 00:59:40 +020062 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;
53db5fc4 kojima2005-03-11 21:51:49 +000083}