warning hunt and kill session

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1000 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Daniel Stenberg 2002-06-14 11:00:13 +00:00
parent 7a8d95d8ff
commit ed6c7e4e03
8 changed files with 84 additions and 71 deletions

View file

@ -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();

View file

@ -17,8 +17,16 @@
*
****************************************************************************/
#include <stdio.h>
#include <sys/types.h>
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);

View file

@ -17,9 +17,15 @@
*
****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <dirent.h>
#include <fcntl.h>
#include "debug.h"
#define DIRFUNCTIONS_DEFINED /* prevent those prototypes */
#define dirent x11_dirent
#include "../../firmware/common/dir.h"

View file

@ -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;

View file

@ -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);
}
}

View file

@ -18,6 +18,7 @@
****************************************************************************/
#include "kernel.h"
#include <poll.h>
/* ticks is HZ per second */
void x11_sleep(int ticks)

View file

@ -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

View file

@ -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;