Extensive code policing (indentation levels, tab characters).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6199 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2005-03-18 00:03:22 +00:00
parent f89087df4b
commit 31b28f523a
4 changed files with 302 additions and 310 deletions

View file

@ -172,7 +172,8 @@ static int get_raw_button (void)
/* return a release event */ /* return a release event */
button_state &= ~k; button_state &= ~k;
k |= BUTTON_REL; k |= BUTTON_REL;
} else { }
else {
if(k) { if(k) {
button_state |= k; button_state |= k;
k = button_state; k = button_state;

View file

@ -132,7 +132,7 @@ static XrmOptionDescRec default_options [] = {
{ "-window", ".root", XrmoptionNoArg, "False" }, { "-window", ".root", XrmoptionNoArg, "False" },
{ "-mono", ".mono", XrmoptionNoArg, "True" }, { "-mono", ".mono", XrmoptionNoArg, "True" },
{ "-install", ".installColormap", XrmoptionNoArg, "True" }, { "-install", ".installColormap", XrmoptionNoArg, "True" },
{ "-noinstall",".installColormap", XrmoptionNoArg, "False" }, { "-noinstall", ".installColormap", XrmoptionNoArg, "False" },
{ "-visual", ".visualID", XrmoptionSepArg, 0 }, { "-visual", ".visualID", XrmoptionSepArg, 0 },
{ "-window-id", ".windowID", XrmoptionSepArg, 0 }, { "-window-id", ".windowID", XrmoptionSepArg, 0 },
{ 0, 0, 0, 0 } { 0, 0, 0, 0 }
@ -299,32 +299,31 @@ int screenhack_handle_event(Display *dpy, XEvent *event,
} }
break; break;
case Expose: case Expose:
{
screen_redraw(); screen_redraw();
}
break;
default:
break; break;
case ClientMessage: case ClientMessage:
{
if (event->xclient.message_type != XA_WM_PROTOCOLS) { if (event->xclient.message_type != XA_WM_PROTOCOLS) {
char *s = XGetAtomName(dpy, event->xclient.message_type); char *s = XGetAtomName(dpy, event->xclient.message_type);
if (!s) s = "(null)"; if (!s)
s = "(null)";
fprintf (stderr, "%s: unknown ClientMessage %s received!\n", fprintf (stderr, "%s: unknown ClientMessage %s received!\n",
progname, s); progname, s);
} }
else if (event->xclient.data.l[0] != (int)XA_WM_DELETE_WINDOW) { else if (event->xclient.data.l[0] != (int)XA_WM_DELETE_WINDOW) {
char *s1 = XGetAtomName(dpy, event->xclient.message_type); char *s1 = XGetAtomName(dpy, event->xclient.message_type);
char *s2 = XGetAtomName(dpy, event->xclient.data.l[0]); char *s2 = XGetAtomName(dpy, event->xclient.data.l[0]);
if (!s1) s1 = "(null)"; if (!s1)
if (!s2) s2 = "(null)"; s1 = "(null)";
if (!s2)
s2 = "(null)";
fprintf (stderr, "%s: unknown ClientMessage %s[%s] received!\n", fprintf (stderr, "%s: unknown ClientMessage %s[%s] received!\n",
progname, s1, s2); progname, s1, s2);
} }
else { else {
exit (0); exit (0);
} }
} break;
default:
break; break;
} }
return key; return key;
@ -344,8 +343,7 @@ int screenhack_handle_events(bool *release, bool *repeat)
} }
static Visual * static Visual *pick_visual (Screen *screen)
pick_visual (Screen *screen)
{ {
#ifdef USE_GL #ifdef USE_GL
/* If we're linking against GL (that is, this is the version of /* If we're linking against GL (that is, this is the version of
@ -444,13 +442,13 @@ int main (int argc, char **argv)
snprintf(geometry, 40, "*geometry: %dx%d", snprintf(geometry, 40, "*geometry: %dx%d",
LCD_WIDTH*display_zoom+14, LCD_HEIGHT*display_zoom+8); LCD_WIDTH*display_zoom+14, LCD_HEIGHT*display_zoom+8);
#else #else
snprintf(geometry, 40, "*geometry: %dx%d", 280*display_zoom, 132*display_zoom); snprintf(geometry, 40, "*geometry: %dx%d", 280*display_zoom,
132*display_zoom);
#endif #endif
default_defaults[GEOMETRY_POSITION]=geometry; default_defaults[GEOMETRY_POSITION]=geometry;
} }
printf(KEYBOARD_GENERIC KEYBOARD_SPECIFIC); printf(KEYBOARD_GENERIC KEYBOARD_SPECIFIC);
merge_options (); merge_options ();
#ifdef __sgi #ifdef __sgi

View file

@ -84,8 +84,7 @@ void init_window ()
cmap = xgwa.colormap; cmap = xgwa.colormap;
gcv.function = GXxor; gcv.function = GXxor;
gcv.foreground = gcv.foreground = get_pixel_resource("foreground", "Foreground", dpy, cmap);
get_pixel_resource ("foreground", "Foreground", dpy, cmap);
draw_gc = XCreateGC (dpy, window, GCForeground, &gcv); draw_gc = XCreateGC (dpy, window, GCForeground, &gcv);
screen_resized(LCD_WIDTH, LCD_HEIGHT); screen_resized(LCD_WIDTH, LCD_HEIGHT);
@ -97,40 +96,38 @@ void screen_resized(int width, int height)
maxx = width; maxx = width;
maxy = height; maxy = height;
XSetForeground (dpy, draw_gc, get_pixel_resource ("background", "Background", XSetForeground(dpy, draw_gc,
dpy, cmap)); get_pixel_resource("background", "Background", dpy, cmap));
XFillRectangle(dpy, window, draw_gc, 0, 0, width*display_zoom, height*display_zoom); XFillRectangle(dpy, window, draw_gc, 0, 0, width*display_zoom,
height*display_zoom);
lcd_display_redraw=true; lcd_display_redraw=true;
screen_redraw(); screen_redraw();
} }
void drawrect(int color, int x1, int y1, int x2, int y2) void drawrect(int color, int x1, int y1, int x2, int y2)
{ {
if (color==0) { if (color==0)
XSetForeground(dpy, draw_gc, XSetForeground(dpy, draw_gc,
get_pixel_resource("background", "Background", dpy, cmap)); get_pixel_resource("background", "Background", dpy, cmap));
}
else else
XSetForeground(dpy, draw_gc, XSetForeground(dpy, draw_gc,
get_pixel_resource("foreground", "Foreground", dpy, cmap)); get_pixel_resource("foreground", "Foreground", dpy, cmap));
XFillRectangle(dpy, window, draw_gc, x1*display_zoom, y1*display_zoom, XFillRectangle(dpy, window, draw_gc, x1*display_zoom, y1*display_zoom,
x2*display_zoom, y2*display_zoom); x2*display_zoom, y2*display_zoom);
} }
static void help(void) static void help(void)
{ {
printf(PROGNAME " " ROCKBOXUI_VERSION " " __DATE__ "\n" printf(PROGNAME " " ROCKBOXUI_VERSION " " __DATE__ "\n"
"usage: " PROGNAME "\n" "usage: " PROGNAME "\n");
);
} }
void drawline(int color, int x1, int y1, int x2, int y2) void drawline(int color, int x1, int y1, int x2, int y2)
{ {
if (color==0) { if (color==0)
XSetForeground(dpy, draw_gc, XSetForeground(dpy, draw_gc,
get_pixel_resource("background", "Background", dpy, cmap)); get_pixel_resource("background", "Background", dpy, cmap));
}
else else
XSetForeground(dpy, draw_gc, XSetForeground(dpy, draw_gc,
get_pixel_resource("foreground", "Foreground", dpy, cmap)); get_pixel_resource("foreground", "Foreground", dpy, cmap));
@ -144,10 +141,9 @@ void drawline(int color, int x1, int y1, int x2, int y2)
void drawdot(int color, int x, int y) void drawdot(int color, int x, int y)
{ {
if (color==0) { if (color==0)
XSetForeground(dpy, draw_gc, XSetForeground(dpy, draw_gc,
get_pixel_resource("background", "Background", dpy, cmap)); get_pixel_resource("background", "Background", dpy, cmap));
}
else else
XSetForeground(dpy, draw_gc, XSetForeground(dpy, draw_gc,
get_pixel_resource("foreground", "Foreground", dpy, cmap)); get_pixel_resource("foreground", "Foreground", dpy, cmap));
@ -158,10 +154,9 @@ void drawdot(int color, int x, int y)
void drawdots(int color, struct coordinate *points, int count) void drawdots(int color, struct coordinate *points, int count)
{ {
if (color==0) { if (color==0)
XSetForeground(dpy, draw_gc, XSetForeground(dpy, draw_gc,
get_pixel_resource("background", "Background", dpy, cmap)); get_pixel_resource("background", "Background", dpy, cmap));
}
else else
XSetForeground(dpy, draw_gc, XSetForeground(dpy, draw_gc,
get_pixel_resource("foreground", "Foreground", dpy, cmap)); get_pixel_resource("foreground", "Foreground", dpy, cmap));
@ -177,10 +172,9 @@ void drawdots(int color, struct coordinate *points, int count)
void drawrectangles(int color, struct rectangle *points, int count) void drawrectangles(int color, struct rectangle *points, int count)
{ {
if (color==0) { if (color==0)
XSetForeground(dpy, draw_gc, XSetForeground(dpy, draw_gc,
get_pixel_resource("background", "Background", dpy, cmap)); get_pixel_resource("background", "Background", dpy, cmap));
}
else else
XSetForeground(dpy, draw_gc, XSetForeground(dpy, draw_gc,
get_pixel_resource("foreground", "Foreground", dpy, cmap)); get_pixel_resource("foreground", "Foreground", dpy, cmap));
@ -191,21 +185,20 @@ void drawrectangles(int color, struct rectangle *points, int count)
points[count].y*display_zoom, points[count].y*display_zoom,
points[count].width*display_zoom, points[count].width*display_zoom,
points[count].height*display_zoom); points[count].height*display_zoom);
} }
} }
void drawtext(int color, int x, int y, char *text) void drawtext(int color, int x, int y, char *text)
{ {
if (color==0) { if (color==0)
XSetForeground(dpy, draw_gc, XSetForeground(dpy, draw_gc,
get_pixel_resource("background", "Background", dpy, cmap)); get_pixel_resource("background", "Background", dpy, cmap));
}
else else
XSetForeground(dpy, draw_gc, XSetForeground(dpy, draw_gc,
get_pixel_resource("foreground", "Foreground", dpy, cmap)); get_pixel_resource("foreground", "Foreground", dpy, cmap));
XDrawString(dpy, window, draw_gc, x*display_zoom, y*display_zoom, text, strlen(text)); XDrawString(dpy, window, draw_gc, x*display_zoom, y*display_zoom, text,
strlen(text));
} }
/* this is where the applicaton starts */ /* this is where the applicaton starts */
@ -218,9 +211,9 @@ screenhack (Display *the_dpy, Window the_window)
/* This doesn't work, but I don't know why (Daniel 1999-12-01) */ /* This doesn't work, but I don't know why (Daniel 1999-12-01) */
helpme = get_boolean_resource ("help", "Boolean"); helpme = get_boolean_resource ("help", "Boolean");
if(helpme) { if(helpme)
help(); help();
}
printf(PROGNAME " " ROCKBOXUI_VERSION " (" __DATE__ ")\n"); printf(PROGNAME " " ROCKBOXUI_VERSION " (" __DATE__ ")\n");
dpy=the_dpy; dpy=the_dpy;