summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-06-14 11:00:13 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-06-14 11:00:13 +0000
commited6c7e4e030ebf2b294ddcad830c88089f6f09af (patch)
tree1a86de1d2425a1d0a6c6b8e307b4d35e981f28fc
parent7a8d95d8ff1247486596ea5b5a95b02ec1fd5a3c (diff)
downloadrockbox-ed6c7e4e030ebf2b294ddcad830c88089f6f09af.tar.gz
rockbox-ed6c7e4e030ebf2b294ddcad830c88089f6f09af.zip
warning hunt and kill session
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1000 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--uisimulator/x11/button-x11.c4
-rw-r--r--uisimulator/x11/file.h8
-rw-r--r--uisimulator/x11/io.c6
-rw-r--r--uisimulator/x11/lcd-x11.c3
-rw-r--r--uisimulator/x11/screenhack.c121
-rw-r--r--uisimulator/x11/sleep.c1
-rw-r--r--uisimulator/x11/uibasic.c10
-rw-r--r--uisimulator/x11/vroot.h2
8 files changed, 84 insertions, 71 deletions
diff --git a/uisimulator/x11/button-x11.c b/uisimulator/x11/button-x11.c
index 53639a37cd..947ca91a16 100644
--- a/uisimulator/x11/button-x11.c
+++ b/uisimulator/x11/button-x11.c
@@ -39,6 +39,10 @@ void button_init()
39 * +,Enter = On, Off 39 * +,Enter = On, Off
40 * 40 *
41 */ 41 */
42
43/* from uibasic.c */
44extern int screenhack_handle_events (void);
45
42static int get_raw_button (void) 46static int get_raw_button (void)
43{ 47{
44 int k = screenhack_handle_events(); 48 int k = screenhack_handle_events();
diff --git a/uisimulator/x11/file.h b/uisimulator/x11/file.h
index 7ea72580ad..76ddd6b8bb 100644
--- a/uisimulator/x11/file.h
+++ b/uisimulator/x11/file.h
@@ -17,8 +17,16 @@
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19 19
20#include <stdio.h>
20#include <sys/types.h> 21#include <sys/types.h>
21 22
23int x11_open(char *name, int opts);
24
22#define open(x,y) x11_open(x,y) 25#define open(x,y) x11_open(x,y)
23 26
24#include "../../firmware/common/file.h" 27#include "../../firmware/common/file.h"
28
29extern int open(char* pathname, int flags);
30extern int close(int fd);
31extern int read(int fd, void* buf, int count);
32extern int lseek(int fd, int offset, int whence);
diff --git a/uisimulator/x11/io.c b/uisimulator/x11/io.c
index 7c2df3cd37..87ef6ba4b5 100644
--- a/uisimulator/x11/io.c
+++ b/uisimulator/x11/io.c
@@ -17,9 +17,15 @@
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19 19
20#include <stdio.h>
21#include <stdlib.h>
22#include <string.h>
20#include <sys/stat.h> 23#include <sys/stat.h>
21#include <dirent.h> 24#include <dirent.h>
22 25
26#include <fcntl.h>
27#include "debug.h"
28
23#define DIRFUNCTIONS_DEFINED /* prevent those prototypes */ 29#define DIRFUNCTIONS_DEFINED /* prevent those prototypes */
24#define dirent x11_dirent 30#define dirent x11_dirent
25#include "../../firmware/common/dir.h" 31#include "../../firmware/common/dir.h"
diff --git a/uisimulator/x11/lcd-x11.c b/uisimulator/x11/lcd-x11.c
index d60e2ce0ee..96ce800c8f 100644
--- a/uisimulator/x11/lcd-x11.c
+++ b/uisimulator/x11/lcd-x11.c
@@ -44,6 +44,9 @@ extern Display *dpy;
44 44
45unsigned char display_copy[LCD_WIDTH][LCD_HEIGHT/8]; 45unsigned char display_copy[LCD_WIDTH][LCD_HEIGHT/8];
46 46
47/* this is in uibasic.c */
48extern void drawdots(int color, XPoint *points, int count);
49
47void lcd_update (void) 50void lcd_update (void)
48{ 51{
49 int x, y; 52 int x, y;
diff --git a/uisimulator/x11/screenhack.c b/uisimulator/x11/screenhack.c
index 0c795e7d19..72915f41a5 100644
--- a/uisimulator/x11/screenhack.c
+++ b/uisimulator/x11/screenhack.c
@@ -166,6 +166,7 @@ static int screenhack_ehandler (Display *dpy, XErrorEvent *error)
166 166
167static Bool MapNotify_event_p (Display *dpy, XEvent *event, XPointer window) 167static Bool MapNotify_event_p (Display *dpy, XEvent *event, XPointer window)
168{ 168{
169 (void)dpy;
169 return (event->xany.type == MapNotify && 170 return (event->xany.type == MapNotify &&
170 event->xvisibility.window == (Window) window); 171 event->xvisibility.window == (Window) window);
171} 172}
@@ -184,64 +185,60 @@ static Atom XA_WM_PROTOCOLS, XA_WM_DELETE_WINDOW;
184int screenhack_handle_event (Display *dpy, XEvent *event) 185int screenhack_handle_event (Display *dpy, XEvent *event)
185{ 186{
186 int key=0; 187 int key=0;
187 switch (event->xany.type) 188 switch (event->xany.type) {
188 { 189 case KeyPress:
189 case KeyPress: 190 {
190 { 191 KeySym keysym;
191 KeySym keysym; 192 unsigned char c = 0;
192 unsigned char c = 0; 193 XLookupString (&event->xkey, &c, 1, &keysym, 0);
193 XLookupString (&event->xkey, &c, 1, &keysym, 0); 194 if (! (keysym >= XK_Shift_L && keysym <= XK_Hyper_R))
194 if (! (keysym >= XK_Shift_L && keysym <= XK_Hyper_R)) 195 XBell (dpy, 0); /* beep for non-chord keys */
195 XBell (dpy, 0); /* beep for non-chord keys */ 196 key = keysym;
196 key = keysym; 197 /* fprintf(stderr, "KEY PRESSED: %c (%02x)\n", c, c); */
197/* fprintf(stderr, "KEY PRESSED: %c (%02x)\n", c, c); */ 198 }
198 } 199 break;
199 break; 200 case ResizeRequest:
200 case ResizeRequest: 201 screen_resized(event->xresizerequest.width,
201 screen_resized(event->xresizerequest.width, 202 event->xresizerequest.height);
202 event->xresizerequest.height); 203 screen_redraw();
203 screen_redraw(); 204 fprintf(stderr, "WINDOW RESIZED to width %d height %d\n",
204 fprintf(stderr, "WINDOW RESIZED to width %d height %d\n", 205 event->xresizerequest.width, event->xresizerequest.height);
205 event->xresizerequest.width, event->xresizerequest.height); 206 break;
206 break; 207 default:
207 default:
208/* fprintf(stderr, "EVENT: %d (see /usr/include/X11/X.h)\n", 208/* fprintf(stderr, "EVENT: %d (see /usr/include/X11/X.h)\n",
209 event->xany.type); 209 event->xany.type);
210*/ 210*/
211 break; 211 break;
212 case Expose: 212 case Expose:
213 screen_redraw(); 213 screen_redraw();
214 fprintf(stderr, "EXPOSE: x: %d y: %d width: %d height: %d\n", 214 fprintf(stderr, "EXPOSE: x: %d y: %d width: %d height: %d\n",
215 event->xexpose.x, event->xexpose.y, 215 event->xexpose.x, event->xexpose.y,
216 event->xexpose.width, event->xexpose.height); 216 event->xexpose.width, event->xexpose.height);
217 break; 217 break;
218 case ButtonPress: 218 case ButtonPress:
219 fprintf(stderr, "BUTTON PRESSED: x: %d y:%d\n",event->xbutton.x,event->xbutton.y); 219 fprintf(stderr, "BUTTON PRESSED: x: %d y:%d\n",event->xbutton.x,event->xbutton.y);
220 break; 220 break;
221 case ClientMessage: 221 case ClientMessage:
222 { 222 {
223 if (event->xclient.message_type != XA_WM_PROTOCOLS) 223 if (event->xclient.message_type != XA_WM_PROTOCOLS) {
224 { 224 char *s = XGetAtomName(dpy, event->xclient.message_type);
225 char *s = XGetAtomName(dpy, event->xclient.message_type); 225 if (!s) s = "(null)";
226 if (!s) s = "(null)"; 226 fprintf (stderr, "%s: unknown ClientMessage %s received!\n",
227 fprintf (stderr, "%s: unknown ClientMessage %s received!\n", 227 progname, s);
228 progname, s); 228 }
229 } 229 else if (event->xclient.data.l[0] != (int)XA_WM_DELETE_WINDOW) {
230 else if (event->xclient.data.l[0] != XA_WM_DELETE_WINDOW) 230 char *s1 = XGetAtomName(dpy, event->xclient.message_type);
231 { 231 char *s2 = XGetAtomName(dpy, event->xclient.data.l[0]);
232 char *s1 = XGetAtomName(dpy, event->xclient.message_type); 232 if (!s1) s1 = "(null)";
233 char *s2 = XGetAtomName(dpy, event->xclient.data.l[0]); 233 if (!s2) s2 = "(null)";
234 if (!s1) s1 = "(null)"; 234 fprintf (stderr, "%s: unknown ClientMessage %s[%s] received!\n",
235 if (!s2) s2 = "(null)"; 235 progname, s1, s2);
236 fprintf (stderr, "%s: unknown ClientMessage %s[%s] received!\n", 236 }
237 progname, s1, s2); 237 else {
238 } 238 exit (0);
239 else 239 }
240 { 240 }
241 exit (0); 241 break;
242 }
243 }
244 break;
245 } 242 }
246 return key; 243 return key;
247} 244}
@@ -311,10 +308,10 @@ static void visual_warning (Screen *screen, Window window, Visual *visual,
311 if (window == RootWindowOfScreen (screen)) 308 if (window == RootWindowOfScreen (screen))
312 strcpy (win, "root window"); 309 strcpy (win, "root window");
313 else 310 else
314 sprintf (win, "window 0x%x", (unsigned long) window); 311 sprintf (win, "window 0x%lx", (long) window);
315 312
316 if (window_p) 313 if (window_p)
317 sprintf (why, "-window-id 0x%x", (unsigned long) window); 314 sprintf (why, "-window-id 0x%lx", (long)window);
318 else 315 else
319 strcpy (why, "-root"); 316 strcpy (why, "-root");
320 317
@@ -333,8 +330,8 @@ static void visual_warning (Screen *screen, Window window, Visual *visual,
333 { 330 {
334 fprintf (stderr, "%s: ignoring `-visual %s' because of `%s'.\n", 331 fprintf (stderr, "%s: ignoring `-visual %s' because of `%s'.\n",
335 progname, visual_string, why); 332 progname, visual_string, why);
336 fprintf (stderr, "%s: using %s's visual 0x%x.\n", 333 fprintf (stderr, "%s: using %s's visual 0x%lx.\n",
337 progname, win, XVisualIDFromVisual (visual)); 334 progname, win, (long)XVisualIDFromVisual (visual));
338 } 335 }
339 free (visual_string); 336 free (visual_string);
340 } 337 }
@@ -345,8 +342,8 @@ static void visual_warning (Screen *screen, Window window, Visual *visual,
345 { 342 {
346 fprintf (stderr, "%s: ignoring `-install' because of `%s'.\n", 343 fprintf (stderr, "%s: ignoring `-install' because of `%s'.\n",
347 progname, why); 344 progname, why);
348 fprintf (stderr, "%s: using %s's colormap 0x%x.\n", 345 fprintf (stderr, "%s: using %s's colormap 0x%lx.\n",
349 progname, win, (unsigned long) cmap); 346 progname, win, (long) cmap);
350 } 347 }
351} 348}
352 349
diff --git a/uisimulator/x11/sleep.c b/uisimulator/x11/sleep.c
index 387c2c64d0..b888664122 100644
--- a/uisimulator/x11/sleep.c
+++ b/uisimulator/x11/sleep.c
@@ -18,6 +18,7 @@
18 ****************************************************************************/ 18 ****************************************************************************/
19 19
20#include "kernel.h" 20#include "kernel.h"
21#include <poll.h>
21 22
22/* ticks is HZ per second */ 23/* ticks is HZ per second */
23void x11_sleep(int ticks) 24void x11_sleep(int ticks)
diff --git a/uisimulator/x11/uibasic.c b/uisimulator/x11/uibasic.c
index b47362b9d0..19ab9c5980 100644
--- a/uisimulator/x11/uibasic.c
+++ b/uisimulator/x11/uibasic.c
@@ -71,7 +71,6 @@ void init_window ()
71{ 71{
72 XGCValues gcv; 72 XGCValues gcv;
73 XWindowAttributes xgwa; 73 XWindowAttributes xgwa;
74 char *test_p;
75 74
76 XGetWindowAttributes (dpy, window, &xgwa); 75 XGetWindowAttributes (dpy, window, &xgwa);
77 76
@@ -176,15 +175,12 @@ void drawtext(int color, int x, int y, char *text)
176 XDrawString(dpy, window, draw_gc, x, y, text, strlen(text)); 175 XDrawString(dpy, window, draw_gc, x, y, text, strlen(text));
177} 176}
178 177
178/* this is where the applicaton starts */
179extern void app_main(void);
179 180
180void 181void
181screenhack (Display *the_dpy, Window the_window) 182screenhack (Display *the_dpy, Window the_window)
182{ 183{
183 unsigned short porttouse=0;
184 char *proxy = NULL;
185 char *url = NULL;
186 int i;
187 char *guiname="Rock-the-box";
188 Bool helpme; 184 Bool helpme;
189 185
190 /* This doesn't work, but I don't know why (Daniel 1999-12-01) */ 186 /* This doesn't work, but I don't know why (Daniel 1999-12-01) */
@@ -206,8 +202,6 @@ screenhack (Display *the_dpy, Window the_window)
206 202
207void screen_redraw() 203void screen_redraw()
208{ 204{
209 int y, x;
210
211 /* draw a border around the "Recorder" screen */ 205 /* draw a border around the "Recorder" screen */
212 206
213#define X1 0 207#define X1 0
diff --git a/uisimulator/x11/vroot.h b/uisimulator/x11/vroot.h
index ba3e5d29fa..83c7ba9acc 100644
--- a/uisimulator/x11/vroot.h
+++ b/uisimulator/x11/vroot.h
@@ -78,7 +78,7 @@ VirtualRootWindowOfScreen(screen) Screen *screen;
78 if (screen != save_screen) { 78 if (screen != save_screen) {
79 Display *dpy = DisplayOfScreen(screen); 79 Display *dpy = DisplayOfScreen(screen);
80 Atom __SWM_VROOT = None; 80 Atom __SWM_VROOT = None;
81 int i; 81 unsigned int i;
82 Window rootReturn, parentReturn, *children; 82 Window rootReturn, parentReturn, *children;
83 unsigned int numChildren; 83 unsigned int numChildren;
84 84