Commented out the KEY PRESSED and EVENT debug messages

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@400 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Robert Hak 2002-05-03 06:51:05 +00:00
parent 1118c88639
commit 0326934e91

View file

@ -97,8 +97,7 @@ static XrmOptionDescRec *merged_options;
static int merged_options_size; static int merged_options_size;
static char **merged_defaults; static char **merged_defaults;
static void static void merge_options (void)
merge_options (void)
{ {
int def_opts_size, opts_size; int def_opts_size, opts_size;
int def_defaults_size, defaults_size; int def_defaults_size, defaults_size;
@ -122,8 +121,10 @@ merge_options (void)
; ;
for (defaults_size = 0; defaults[defaults_size]; defaults_size++) for (defaults_size = 0; defaults[defaults_size]; defaults_size++)
; ;
merged_defaults = (char **) merged_defaults = (char **)
malloc ((def_defaults_size + defaults_size + 1) * sizeof (*defaults));; malloc ((def_defaults_size + defaults_size + 1) * sizeof (*defaults));
memcpy (merged_defaults, default_defaults, memcpy (merged_defaults, default_defaults,
def_defaults_size * sizeof(*defaults)); def_defaults_size * sizeof(*defaults));
memcpy (merged_defaults + def_defaults_size, defaults, memcpy (merged_defaults + def_defaults_size, defaults,
@ -139,7 +140,8 @@ merge_options (void)
if (**s == '.') if (**s == '.')
{ {
const char *oldr = *s; const char *oldr = *s;
char *newr = (char *) malloc(strlen(oldr) + strlen(progclass) + 3); char *newr = (char *) malloc(strlen(oldr)
+ strlen(progclass) + 3);
strcpy (newr, progclass); strcpy (newr, progclass);
strcat (newr, oldr); strcat (newr, oldr);
*s = newr; *s = newr;
@ -147,13 +149,12 @@ merge_options (void)
} }
} }
/* Make the X errors print out the name of this program, so we have some /* Make the X errors print out the name of this program, so we have some
clue which one has a bug when they die under the screensaver. clue which one has a bug when they die under the screensaver.
*/ */
static int static int screenhack_ehandler (Display *dpy, XErrorEvent *error)
screenhack_ehandler (Display *dpy, XErrorEvent *error)
{ {
fprintf (stderr, "\nX error in %s:\n", progname); fprintf (stderr, "\nX error in %s:\n", progname);
if (XmuPrintDefaultErrorMessage (dpy, error, stderr)) if (XmuPrintDefaultErrorMessage (dpy, error, stderr))
@ -163,8 +164,7 @@ screenhack_ehandler (Display *dpy, XErrorEvent *error)
return 0; return 0;
} }
static Bool static Bool MapNotify_event_p (Display *dpy, XEvent *event, XPointer window)
MapNotify_event_p (Display *dpy, XEvent *event, XPointer window)
{ {
return (event->xany.type == MapNotify && return (event->xany.type == MapNotify &&
event->xvisibility.window == (Window) window); event->xvisibility.window == (Window) window);
@ -181,8 +181,7 @@ static Atom XA_WM_PROTOCOLS, XA_WM_DELETE_WINDOW;
/* Dead-trivial event handling: exits if "q" or "ESC" are typed. /* Dead-trivial event handling: exits if "q" or "ESC" are typed.
Exit if the WM_PROTOCOLS WM_DELETE_WINDOW ClientMessage is received. Exit if the WM_PROTOCOLS WM_DELETE_WINDOW ClientMessage is received.
*/ */
int int screenhack_handle_event (Display *dpy, XEvent *event)
screenhack_handle_event (Display *dpy, XEvent *event)
{ {
int key=0; int key=0;
switch (event->xany.type) switch (event->xany.type)
@ -195,18 +194,20 @@ screenhack_handle_event (Display *dpy, XEvent *event)
if (! (keysym >= XK_Shift_L && keysym <= XK_Hyper_R)) if (! (keysym >= XK_Shift_L && keysym <= XK_Hyper_R))
XBell (dpy, 0); /* beep for non-chord keys */ XBell (dpy, 0); /* beep for non-chord keys */
key = keysym; key = keysym;
fprintf(stderr, "KEY PRESSED: %c (%02x)\n", c, c); /* fprintf(stderr, "KEY PRESSED: %c (%02x)\n", c, c); */
} }
break; break;
case ResizeRequest: case ResizeRequest:
screen_resized(event->xresizerequest.width, event->xresizerequest.height); screen_resized(event->xresizerequest.width,
event->xresizerequest.height);
screen_redraw(); screen_redraw();
fprintf(stderr, "WINDOW RESIZED to width %d height %d\n", fprintf(stderr, "WINDOW RESIZED to width %d height %d\n",
event->xresizerequest.width, event->xresizerequest.height); event->xresizerequest.width, event->xresizerequest.height);
break; break;
default: default:
fprintf(stderr, "EVENT: %d (see /usr/include/X11/X.h)\n", /* fprintf(stderr, "EVENT: %d (see /usr/include/X11/X.h)\n",
event->xany.type); event->xany.type);
*/
break; break;
case Expose: case Expose:
screen_redraw(); screen_redraw();
@ -246,8 +247,7 @@ screenhack_handle_event (Display *dpy, XEvent *event)
} }
int int screenhack_handle_events (void)
screenhack_handle_events (void)
{ {
int key=0; int key=0;
while (XPending (dpy)) while (XPending (dpy))
@ -264,10 +264,11 @@ 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 screenhack.o /* If we're linking against GL (that is, this is the version of
that the GL hacks will use, which is different from the one that the screenhack.o that the GL hacks will use, which is different from the
non-GL hacks will use) then try to pick the "best" visual by interrogating one that the non-GL hacks will use) then try to pick the "best" visual
the GL library instead of by asking Xlib. GL knows better. by interrogating the GL library instead of by asking Xlib. GL knows
better.
*/ */
Visual *v = 0; Visual *v = 0;
char *string = get_string_resource ("visualID", "VisualID"); char *string = get_string_resource ("visualID", "VisualID");
@ -299,9 +300,8 @@ pick_visual (Screen *screen)
"-window-id 0x2c00001 -install") and complain, since when drawing "-window-id 0x2c00001 -install") and complain, since when drawing
on an existing window, we have no choice about these things. on an existing window, we have no choice about these things.
*/ */
static void static void visual_warning (Screen *screen, Window window, Visual *visual,
visual_warning (Screen *screen, Window window, Visual *visual, Colormap cmap, Colormap cmap, Bool window_p)
Bool window_p)
{ {
char *visual_string = get_string_resource ("visualID", "VisualID"); char *visual_string = get_string_resource ("visualID", "VisualID");
Visual *desired_visual = pick_visual (screen); Visual *desired_visual = pick_visual (screen);
@ -351,8 +351,7 @@ visual_warning (Screen *screen, Window window, Visual *visual, Colormap cmap,
} }
int int main (int argc, char **argv)
main (int argc, char **argv)
{ {
Widget toplevel; Widget toplevel;
Display *dpy; Display *dpy;
@ -373,9 +372,9 @@ main (int argc, char **argv)
#ifdef __sgi #ifdef __sgi
/* We have to do this on SGI to prevent the background color from being /* We have to do this on SGI to prevent the background color from being
overridden by the current desktop color scheme (we'd like our backgrounds overridden by the current desktop color scheme (we'd like our
to be black, thanks.) This should be the same as setting the backgrounds to be black, thanks.) This should be the same as setting
"*useSchemes: none" resource, but it's not -- if that resource is the "*useSchemes: none" resource, but it's not -- if that resource is
present in the `default_defaults' above, it doesn't work, though it present in the `default_defaults' above, it doesn't work, though it
does work when passed as an -xrm arg on the command line. So screw it, does work when passed as an -xrm arg on the command line. So screw it,
turn them off from C instead. turn them off from C instead.
@ -435,7 +434,7 @@ main (int argc, char **argv)
} }
dont_clear = get_boolean_resource ("dontClearRoot", "Boolean"); dont_clear = get_boolean_resource ("dontClearRoot", "Boolean");
/*dont_map = get_boolean_resource ("dontMapWindow", "Boolean"); */ /*dont_map = get_boolean_resource ("dontMapWindow", "Boolean"); */
mono_p = get_boolean_resource ("mono", "Boolean"); mono_p = get_boolean_resource ("mono", "Boolean");
if (CellsOfScreen (DefaultScreenOfDisplay (dpy)) <= 2) if (CellsOfScreen (DefaultScreenOfDisplay (dpy)) <= 2)
mono_p = True; mono_p = True;
@ -520,7 +519,8 @@ main (int argc, char **argv)
if (get_boolean_resource ("installColormap", "InstallColormap")) if (get_boolean_resource ("installColormap", "InstallColormap"))
{ {
cmap = XCreateColormap (dpy, window, cmap = XCreateColormap (dpy, window,
DefaultVisualOfScreen (XtScreen (toplevel)), DefaultVisualOfScreen (XtScreen
(toplevel)),
AllocNone); AllocNone);
XSetWindowColormap (dpy, window, cmap); XSetWindowColormap (dpy, window, cmap);
} }
@ -550,7 +550,8 @@ main (int argc, char **argv)
XWindowAttributes xgwa; XWindowAttributes xgwa;
XGetWindowAttributes (dpy, window, &xgwa); XGetWindowAttributes (dpy, window, &xgwa);
XSelectInput (dpy, window, XSelectInput (dpy, window,
xgwa.your_event_mask | KeyPressMask | ButtonPressMask | ResizeRedirectMask | ExposureMask); xgwa.your_event_mask | KeyPressMask |
ButtonPressMask | ResizeRedirectMask | ExposureMask);
XChangeProperty (dpy, window, XA_WM_PROTOCOLS, XA_ATOM, 32, XChangeProperty (dpy, window, XA_WM_PROTOCOLS, XA_ATOM, 32,
PropModeReplace, PropModeReplace,
(unsigned char *) &XA_WM_DELETE_WINDOW, 1); (unsigned char *) &XA_WM_DELETE_WINDOW, 1);