From b9b2b8d1af283a13cdccea55562cf332de48dcb9 Mon Sep 17 00:00:00 2001
From: Ross Burton <ross@openedhand.com>
Date: Wed, 28 Mar 2007 16:10:50 +0000
Subject: [PATCH] Add xev

Upstream-Status: Inappropriate [disable feature]

---
 xev.c | 64 +----------------------------------------------------------
 1 file changed, 1 insertion(+), 63 deletions(-)

diff --git a/xev.c b/xev.c
index ea69234..6d5eb30 100644
--- a/xev.c
+++ b/xev.c
@@ -175,17 +175,6 @@ do_KeyPress(XEvent *eventp)
     nbytes = XLookupString(e, str, 256, &ks, NULL);
 
     /* not supposed to call XmbLookupString on a key release event */
-    if (e->type == KeyPress && xic) {
-        do {
-            nmbbytes = XmbLookupString(xic, e, buf, bsize - 1, &ks, &status);
-            buf[nmbbytes] = '\0';
-
-            if (status == XBufferOverflow) {
-                bsize = nmbbytes + 1;
-                buf = realloc(buf, bsize);
-            }
-        } while (status == XBufferOverflow);
-    }
 
     if (ks == NoSymbol)
         ksname = "NoSymbol";
@@ -220,16 +209,6 @@ do_KeyPress(XEvent *eventp)
     }
 
     /* not supposed to call XmbLookupString on a key release event */
-    if (e->type == KeyPress && xic) {
-        output(Indent, "XmbLookupString gives %d bytes: ", nmbbytes);
-        if (nmbbytes > 0) {
-            dump(buf, nmbbytes);
-            output(NewLine, " \"%s\"", buf);
-        }
-        else {
-            output_new_line();
-        }
-    }
 
     output(Indent | NewLine, "XFilterEvent returns: %s",
            XFilterEvent(eventp, e->window) ? "True" : "False");
@@ -1211,7 +1190,7 @@ parse_event_mask(const char *s, long event_masks[])
             if (s)
                 return True;
         }
-    }
+	}
 
     if (s != NULL)
         fprintf(stderr, "%s: unrecognized event mask '%s'\n", ProgramName, s);
@@ -1361,37 +1340,6 @@ main(int argc, char **argv)
         fprintf(stderr, "%s:  XSetLocaleModifiers failed\n", ProgramName);
     }
 
-    xim = XOpenIM(dpy, NULL, NULL, NULL);
-    if (xim == NULL) {
-        fprintf(stderr, "%s:  XOpenIM failed\n", ProgramName);
-    }
-
-    if (xim) {
-        imvalret = XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL);
-        if (imvalret != NULL || xim_styles == NULL) {
-            fprintf(stderr, "%s:  input method doesn't support any styles\n",
-                    ProgramName);
-        }
-
-        if (xim_styles) {
-            xim_style = 0;
-            for (i = 0; i < xim_styles->count_styles; i++) {
-                if (xim_styles->supported_styles[i] ==
-                    (XIMPreeditNothing | XIMStatusNothing)) {
-                    xim_style = xim_styles->supported_styles[i];
-                    break;
-                }
-            }
-
-            if (xim_style == 0) {
-                fprintf(stderr,
-                        "%s: input method doesn't support the style we support\n",
-                        ProgramName);
-            }
-            XFree(xim_styles);
-        }
-    }
-
     screen = DefaultScreen(dpy);
 
     attr.event_mask = event_masks[EVENT_MASK_INDEX_CORE];
@@ -1446,16 +1394,6 @@ main(int argc, char **argv)
         printf("Outer window is 0x%lx, inner window is 0x%lx\n", w, subw);
     }
 
-    if (xim && xim_style) {
-        xic = XCreateIC(xim,
-                        XNInputStyle, xim_style,
-                        XNClientWindow, w, XNFocusWindow, w, NULL);
-
-        if (xic == NULL) {
-            fprintf(stderr, "XCreateIC failed\n");
-        }
-    }
-
     have_rr = XRRQueryExtension(dpy, &rr_event_base, &rr_error_base);
     if (have_rr) {
         int rr_major, rr_minor;
