forked from len0rd/rockbox
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:
parent
1118c88639
commit
0326934e91
1 changed files with 321 additions and 320 deletions
|
@ -97,8 +97,7 @@ static XrmOptionDescRec *merged_options;
|
|||
static int merged_options_size;
|
||||
static char **merged_defaults;
|
||||
|
||||
static void
|
||||
merge_options (void)
|
||||
static void merge_options (void)
|
||||
{
|
||||
int def_opts_size, opts_size;
|
||||
int def_defaults_size, defaults_size;
|
||||
|
@ -122,8 +121,10 @@ merge_options (void)
|
|||
;
|
||||
for (defaults_size = 0; defaults[defaults_size]; defaults_size++)
|
||||
;
|
||||
|
||||
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,
|
||||
def_defaults_size * sizeof(*defaults));
|
||||
memcpy (merged_defaults + def_defaults_size, defaults,
|
||||
|
@ -139,7 +140,8 @@ merge_options (void)
|
|||
if (**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);
|
||||
strcat (newr, oldr);
|
||||
*s = newr;
|
||||
|
@ -147,13 +149,12 @@ merge_options (void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
static int
|
||||
screenhack_ehandler (Display *dpy, XErrorEvent *error)
|
||||
static int screenhack_ehandler (Display *dpy, XErrorEvent *error)
|
||||
{
|
||||
fprintf (stderr, "\nX error in %s:\n", progname);
|
||||
if (XmuPrintDefaultErrorMessage (dpy, error, stderr))
|
||||
|
@ -163,8 +164,7 @@ screenhack_ehandler (Display *dpy, XErrorEvent *error)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static Bool
|
||||
MapNotify_event_p (Display *dpy, XEvent *event, XPointer window)
|
||||
static Bool MapNotify_event_p (Display *dpy, XEvent *event, XPointer window)
|
||||
{
|
||||
return (event->xany.type == MapNotify &&
|
||||
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.
|
||||
Exit if the WM_PROTOCOLS WM_DELETE_WINDOW ClientMessage is received.
|
||||
*/
|
||||
int
|
||||
screenhack_handle_event (Display *dpy, XEvent *event)
|
||||
int screenhack_handle_event (Display *dpy, XEvent *event)
|
||||
{
|
||||
int key=0;
|
||||
switch (event->xany.type)
|
||||
|
@ -195,18 +194,20 @@ screenhack_handle_event (Display *dpy, XEvent *event)
|
|||
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);
|
||||
/* fprintf(stderr, "KEY PRESSED: %c (%02x)\n", c, c); */
|
||||
}
|
||||
break;
|
||||
case ResizeRequest:
|
||||
screen_resized(event->xresizerequest.width, event->xresizerequest.height);
|
||||
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",
|
||||
/* fprintf(stderr, "EVENT: %d (see /usr/include/X11/X.h)\n",
|
||||
event->xany.type);
|
||||
*/
|
||||
break;
|
||||
case Expose:
|
||||
screen_redraw();
|
||||
|
@ -246,8 +247,7 @@ screenhack_handle_event (Display *dpy, XEvent *event)
|
|||
}
|
||||
|
||||
|
||||
int
|
||||
screenhack_handle_events (void)
|
||||
int screenhack_handle_events (void)
|
||||
{
|
||||
int key=0;
|
||||
while (XPending (dpy))
|
||||
|
@ -264,10 +264,11 @@ static Visual *
|
|||
pick_visual (Screen *screen)
|
||||
{
|
||||
#ifdef USE_GL
|
||||
/* If we're linking against GL (that is, this is the version of screenhack.o
|
||||
that the GL hacks will use, which is different from the one that the
|
||||
non-GL hacks will use) then try to pick the "best" visual by interrogating
|
||||
the GL library instead of by asking Xlib. GL knows better.
|
||||
/* If we're linking against GL (that is, this is the version of
|
||||
screenhack.o that the GL hacks will use, which is different from the
|
||||
one that the non-GL hacks will use) then try to pick the "best" visual
|
||||
by interrogating the GL library instead of by asking Xlib. GL knows
|
||||
better.
|
||||
*/
|
||||
Visual *v = 0;
|
||||
char *string = get_string_resource ("visualID", "VisualID");
|
||||
|
@ -299,9 +300,8 @@ pick_visual (Screen *screen)
|
|||
"-window-id 0x2c00001 -install") and complain, since when drawing
|
||||
on an existing window, we have no choice about these things.
|
||||
*/
|
||||
static void
|
||||
visual_warning (Screen *screen, Window window, Visual *visual, Colormap cmap,
|
||||
Bool window_p)
|
||||
static void visual_warning (Screen *screen, Window window, Visual *visual,
|
||||
Colormap cmap, Bool window_p)
|
||||
{
|
||||
char *visual_string = get_string_resource ("visualID", "VisualID");
|
||||
Visual *desired_visual = pick_visual (screen);
|
||||
|
@ -351,8 +351,7 @@ visual_warning (Screen *screen, Window window, Visual *visual, Colormap cmap,
|
|||
}
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
Widget toplevel;
|
||||
Display *dpy;
|
||||
|
@ -373,9 +372,9 @@ main (int argc, char **argv)
|
|||
|
||||
#ifdef __sgi
|
||||
/* 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
|
||||
to be black, thanks.) This should be the same as setting the
|
||||
"*useSchemes: none" resource, but it's not -- if that resource is
|
||||
overridden by the current desktop color scheme (we'd like our
|
||||
backgrounds to be black, thanks.) This should be the same as setting
|
||||
the "*useSchemes: none" resource, but it's not -- if that resource is
|
||||
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,
|
||||
turn them off from C instead.
|
||||
|
@ -520,7 +519,8 @@ main (int argc, char **argv)
|
|||
if (get_boolean_resource ("installColormap", "InstallColormap"))
|
||||
{
|
||||
cmap = XCreateColormap (dpy, window,
|
||||
DefaultVisualOfScreen (XtScreen (toplevel)),
|
||||
DefaultVisualOfScreen (XtScreen
|
||||
(toplevel)),
|
||||
AllocNone);
|
||||
XSetWindowColormap (dpy, window, cmap);
|
||||
}
|
||||
|
@ -550,7 +550,8 @@ main (int argc, char **argv)
|
|||
XWindowAttributes xgwa;
|
||||
XGetWindowAttributes (dpy, window, &xgwa);
|
||||
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,
|
||||
PropModeReplace,
|
||||
(unsigned char *) &XA_WM_DELETE_WINDOW, 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue