Cleanup in elf.c with .bss section clean; adm command mounts cdrom instead of floppy...
[ZeXOS.git] / apps / zde / main.c
blob08307cc96ddd104d22b95fa870bd9343d9559b41
1 /*
2 * ZeX/OS
3 * Copyright (C) 2008 Tomas 'ZeXx86' Jedrzejek (zexx86@zexos.org)
4 * Copyright (C) 2009 Tomas 'ZeXx86' Jedrzejek (zexx86@zexos.org)
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include <stdio.h>
22 #include <string.h>
23 #include <stdlib.h>
24 #include <libx/base.h>
25 #include <libx/object.h>
26 #include <libx/image.h>
27 #include <libx/cursor.h>
28 #include <libx/text.h>
30 #include "dialog.h"
31 #include "window.h"
32 #include "cursor.h"
33 #include "appsrv.h"
34 #include "icon.h"
35 #include "kbd.h"
36 #include "bg.h"
38 #define ESC 1
39 #define ARROWLEFT 75
40 #define ARROWRIGHT 77
41 #define ARROWUP 72
42 #define ARROWDOWN 80
44 int lock;
46 int zde_drawlock ()
48 lock = 1;
50 return 0;
53 int zde_drawunlock ()
55 lock = 0;
57 return 0;
60 int error_print (char *err)
62 printf ("ERROR - ZDE -> init of %s failed !\n", err);
64 return 0;
67 int init_zde ()
69 if (init_background ())
70 return error_print ("background");
71 if (init_cursor ())
72 return error_print ("cursor");
73 if (init_icon ())
74 return error_print ("icon");
75 if (init_button ())
76 return error_print ("button");
77 if (init_dialog ())
78 return error_print ("dialog");
79 if (init_window ())
80 return error_print ("window");
81 if (init_appsrv ())
82 return error_print ("appsrv");
83 if (init_kbd ())
84 return error_print ("kbd");
86 return 1;
89 int draw_zde ()
91 draw_background ();
92 draw_icon_desktop ();
93 draw_window ();
94 draw_cursor ();
96 return 0;
99 int main (int argc, char **argv)
101 /* Switch to VGA graphics mode */
102 xinit ();
104 /* Clean screen */
105 xcls (0);
107 if (!init_zde ())
108 return -1;
110 zde_drawunlock ();
112 for (;;) {
113 kbd_update ();
114 draw_zde ();
116 if (!lock)
117 xfbswap ();
120 /* Go back to textual mode */
121 xexit ();
123 /* Exit app */
124 return 0;