summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 53639a3..947ca91 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 7ea7258..76ddd6b 100644
--- a/uisimulator/x11/file.h
+++ b/uisimulator/x11/file.h
@@ -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);
diff --git a/uisimulator/x11/io.c b/uisimulator/x11/io.c
index 7c2df3c..87ef6ba 100644
--- a/uisimulator/x11/io.c
+++ b/uisimulator/x11/io.c
@@ -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"
diff --git a/uisimulator/x11/lcd-x11.c b/uisimulator/x11/lcd-x11.c
index d60e2ce..96ce800 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 0c795e7..72915f4 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 387c2c6..b888664 100644
--- a/uisimulator/x11/sleep.c
+++ b/uisimulator/x11/sleep.c
@@ -18,6 +18,7 @@
****************************************************************************/
#include "kernel.h"
+#include <poll.h>
/* ticks is HZ per second */
void x11_sleep(int ticks)
diff --git a/uisimulator/x11/uibasic.c b/uisimulator/x11/uibasic.c
index b47362b..19ab9c5 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 ba3e5d2..83c7ba9 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;