From ed6c7e4e030ebf2b294ddcad830c88089f6f09af Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 14 Jun 2002 11:00:13 +0000 Subject: [PATCH] warning hunt and kill session git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1000 a1c6a512-1295-4272-9138-f99709370657 --- uisimulator/x11/button-x11.c | 4 ++ uisimulator/x11/file.h | 8 +++ uisimulator/x11/io.c | 6 ++ uisimulator/x11/lcd-x11.c | 3 + uisimulator/x11/screenhack.c | 121 +++++++++++++++++------------------ uisimulator/x11/sleep.c | 1 + uisimulator/x11/uibasic.c | 10 +-- uisimulator/x11/vroot.h | 2 +- 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() * +,Enter = On, Off * */ + +/* from uibasic.c */ +extern int screenhack_handle_events (void); + static int get_raw_button (void) { 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 @@ * ****************************************************************************/ +#include #include +int x11_open(char *name, int opts); + #define open(x,y) x11_open(x,y) #include "../../firmware/common/file.h" + +extern int open(char* pathname, int flags); +extern int close(int fd); +extern int read(int fd, void* buf, int count); +extern 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 @@ * ****************************************************************************/ +#include +#include +#include #include #include +#include +#include "debug.h" + #define DIRFUNCTIONS_DEFINED /* prevent those prototypes */ #define dirent x11_dirent #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; unsigned char display_copy[LCD_WIDTH][LCD_HEIGHT/8]; +/* this is in uibasic.c */ +extern void drawdots(int color, XPoint *points, int count); + void lcd_update (void) { 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) static Bool MapNotify_event_p (Display *dpy, XEvent *event, XPointer window) { + (void)dpy; return (event->xany.type == MapNotify && event->xvisibility.window == (Window) window); } @@ -184,64 +185,60 @@ static Atom XA_WM_PROTOCOLS, XA_WM_DELETE_WINDOW; int screenhack_handle_event (Display *dpy, XEvent *event) { int key=0; - switch (event->xany.type) - { - case KeyPress: - { - KeySym keysym; - unsigned char c = 0; - XLookupString (&event->xkey, &c, 1, &keysym, 0); - if (! (keysym >= XK_Shift_L && keysym <= XK_Hyper_R)) - XBell (dpy, 0); /* beep for non-chord keys */ - key = keysym; -/* fprintf(stderr, "KEY PRESSED: %c (%02x)\n", c, c); */ - } - break; - case ResizeRequest: - screen_resized(event->xresizerequest.width, - event->xresizerequest.height); - screen_redraw(); - fprintf(stderr, "WINDOW RESIZED to width %d height %d\n", - event->xresizerequest.width, event->xresizerequest.height); - break; - default: + switch (event->xany.type) { + case KeyPress: + { + KeySym keysym; + unsigned char c = 0; + XLookupString (&event->xkey, &c, 1, &keysym, 0); + if (! (keysym >= XK_Shift_L && keysym <= XK_Hyper_R)) + XBell (dpy, 0); /* beep for non-chord keys */ + key = keysym; + /* fprintf(stderr, "KEY PRESSED: %c (%02x)\n", c, c); */ + } + break; + case ResizeRequest: + screen_resized(event->xresizerequest.width, + event->xresizerequest.height); + screen_redraw(); + fprintf(stderr, "WINDOW RESIZED to width %d height %d\n", + event->xresizerequest.width, event->xresizerequest.height); + break; + default: /* fprintf(stderr, "EVENT: %d (see /usr/include/X11/X.h)\n", - event->xany.type); + event->xany.type); */ - break; - case Expose: - screen_redraw(); - fprintf(stderr, "EXPOSE: x: %d y: %d width: %d height: %d\n", - event->xexpose.x, event->xexpose.y, - event->xexpose.width, event->xexpose.height); - break; - case ButtonPress: - fprintf(stderr, "BUTTON PRESSED: x: %d y:%d\n",event->xbutton.x,event->xbutton.y); - break; - case ClientMessage: - { - if (event->xclient.message_type != XA_WM_PROTOCOLS) - { - char *s = XGetAtomName(dpy, event->xclient.message_type); - if (!s) s = "(null)"; - fprintf (stderr, "%s: unknown ClientMessage %s received!\n", - progname, s); - } - else if (event->xclient.data.l[0] != XA_WM_DELETE_WINDOW) - { - char *s1 = XGetAtomName(dpy, event->xclient.message_type); - char *s2 = XGetAtomName(dpy, event->xclient.data.l[0]); - if (!s1) s1 = "(null)"; - if (!s2) s2 = "(null)"; - fprintf (stderr, "%s: unknown ClientMessage %s[%s] received!\n", - progname, s1, s2); - } - else - { - exit (0); - } - } - break; + break; + case Expose: + screen_redraw(); + fprintf(stderr, "EXPOSE: x: %d y: %d width: %d height: %d\n", + event->xexpose.x, event->xexpose.y, + event->xexpose.width, event->xexpose.height); + break; + case ButtonPress: + fprintf(stderr, "BUTTON PRESSED: x: %d y:%d\n",event->xbutton.x,event->xbutton.y); + break; + case ClientMessage: + { + if (event->xclient.message_type != XA_WM_PROTOCOLS) { + char *s = XGetAtomName(dpy, event->xclient.message_type); + if (!s) s = "(null)"; + fprintf (stderr, "%s: unknown ClientMessage %s received!\n", + progname, s); + } + else if (event->xclient.data.l[0] != (int)XA_WM_DELETE_WINDOW) { + char *s1 = XGetAtomName(dpy, event->xclient.message_type); + char *s2 = XGetAtomName(dpy, event->xclient.data.l[0]); + if (!s1) s1 = "(null)"; + if (!s2) s2 = "(null)"; + fprintf (stderr, "%s: unknown ClientMessage %s[%s] received!\n", + progname, s1, s2); + } + else { + exit (0); + } + } + break; } return key; } @@ -311,10 +308,10 @@ static void visual_warning (Screen *screen, Window window, Visual *visual, if (window == RootWindowOfScreen (screen)) strcpy (win, "root window"); else - sprintf (win, "window 0x%x", (unsigned long) window); + sprintf (win, "window 0x%lx", (long) window); if (window_p) - sprintf (why, "-window-id 0x%x", (unsigned long) window); + sprintf (why, "-window-id 0x%lx", (long)window); else strcpy (why, "-root"); @@ -333,8 +330,8 @@ static void visual_warning (Screen *screen, Window window, Visual *visual, { fprintf (stderr, "%s: ignoring `-visual %s' because of `%s'.\n", progname, visual_string, why); - fprintf (stderr, "%s: using %s's visual 0x%x.\n", - progname, win, XVisualIDFromVisual (visual)); + fprintf (stderr, "%s: using %s's visual 0x%lx.\n", + progname, win, (long)XVisualIDFromVisual (visual)); } free (visual_string); } @@ -345,8 +342,8 @@ static void visual_warning (Screen *screen, Window window, Visual *visual, { fprintf (stderr, "%s: ignoring `-install' because of `%s'.\n", progname, why); - fprintf (stderr, "%s: using %s's colormap 0x%x.\n", - progname, win, (unsigned long) cmap); + fprintf (stderr, "%s: using %s's colormap 0x%lx.\n", + progname, win, (long) cmap); } } 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 @@ ****************************************************************************/ #include "kernel.h" +#include /* ticks is HZ per second */ void 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 () { XGCValues gcv; XWindowAttributes xgwa; - char *test_p; XGetWindowAttributes (dpy, window, &xgwa); @@ -176,15 +175,12 @@ void drawtext(int color, int x, int y, char *text) XDrawString(dpy, window, draw_gc, x, y, text, strlen(text)); } +/* this is where the applicaton starts */ +extern void app_main(void); void screenhack (Display *the_dpy, Window the_window) { - unsigned short porttouse=0; - char *proxy = NULL; - char *url = NULL; - int i; - char *guiname="Rock-the-box"; Bool helpme; /* 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) void screen_redraw() { - int y, x; - /* draw a border around the "Recorder" screen */ #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; if (screen != save_screen) { Display *dpy = DisplayOfScreen(screen); Atom __SWM_VROOT = None; - int i; + unsigned int i; Window rootReturn, parentReturn, *children; unsigned int numChildren;