blob: 361369b2910f24b204916f3ec61718e2ca9d0355 [file] [log] [blame]
Andrew Geisslerc9f78652020-09-18 14:11:35 -05001From b9b2b8d1af283a13cdccea55562cf332de48dcb9 Mon Sep 17 00:00:00 2001
2From: Ross Burton <ross@openedhand.com>
3Date: Wed, 28 Mar 2007 16:10:50 +0000
4Subject: [PATCH] Add xev
5
Patrick Williamsc124f4f2015-09-15 14:41:29 -05006Upstream-Status: Inappropriate [disable feature]
7
8---
Andrew Geisslerc9f78652020-09-18 14:11:35 -05009 xev.c | 64 +----------------------------------------------------------
10 1 file changed, 1 insertion(+), 63 deletions(-)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050011
Andrew Geisslerc9f78652020-09-18 14:11:35 -050012diff --git a/xev.c b/xev.c
13index ea69234..6d5eb30 100644
14--- a/xev.c
15+++ b/xev.c
16@@ -175,17 +175,6 @@ do_KeyPress(XEvent *eventp)
Brad Bishop19323692019-04-05 15:28:33 -040017 nbytes = XLookupString(e, str, 256, &ks, NULL);
Patrick Williamsc124f4f2015-09-15 14:41:29 -050018
19 /* not supposed to call XmbLookupString on a key release event */
20- if (e->type == KeyPress && xic) {
Brad Bishop19323692019-04-05 15:28:33 -040021- do {
22- nmbbytes = XmbLookupString(xic, e, buf, bsize - 1, &ks, &status);
23- buf[nmbbytes] = '\0';
24-
25- if (status == XBufferOverflow) {
26- bsize = nmbbytes + 1;
27- buf = realloc(buf, bsize);
28- }
29- } while (status == XBufferOverflow);
Patrick Williamsc124f4f2015-09-15 14:41:29 -050030- }
Patrick Williamsc124f4f2015-09-15 14:41:29 -050031
32 if (ks == NoSymbol)
Brad Bishop19323692019-04-05 15:28:33 -040033 ksname = "NoSymbol";
Andrew Geisslerc9f78652020-09-18 14:11:35 -050034@@ -220,16 +209,6 @@ do_KeyPress(XEvent *eventp)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050035 }
36
37 /* not supposed to call XmbLookupString on a key release event */
38- if (e->type == KeyPress && xic) {
Andrew Geisslerc9f78652020-09-18 14:11:35 -050039- output(Indent, "XmbLookupString gives %d bytes: ", nmbbytes);
Brad Bishop19323692019-04-05 15:28:33 -040040- if (nmbbytes > 0) {
41- dump(buf, nmbbytes);
Andrew Geisslerc9f78652020-09-18 14:11:35 -050042- output(NewLine, " \"%s\"", buf);
Brad Bishop19323692019-04-05 15:28:33 -040043- }
44- else {
Andrew Geisslerc9f78652020-09-18 14:11:35 -050045- output_new_line();
Brad Bishop19323692019-04-05 15:28:33 -040046- }
47- }
48
Andrew Geisslerc9f78652020-09-18 14:11:35 -050049 output(Indent | NewLine, "XFilterEvent returns: %s",
Brad Bishop19323692019-04-05 15:28:33 -040050 XFilterEvent(eventp, e->window) ? "True" : "False");
Andrew Geisslerc9f78652020-09-18 14:11:35 -050051@@ -1211,7 +1190,7 @@ parse_event_mask(const char *s, long event_masks[])
Brad Bishop19323692019-04-05 15:28:33 -040052 if (s)
53 return True;
Patrick Williamsc124f4f2015-09-15 14:41:29 -050054 }
55- }
Brad Bishop19323692019-04-05 15:28:33 -040056+ }
Patrick Williamsc124f4f2015-09-15 14:41:29 -050057
Brad Bishop19323692019-04-05 15:28:33 -040058 if (s != NULL)
59 fprintf(stderr, "%s: unrecognized event mask '%s'\n", ProgramName, s);
Andrew Geisslerc9f78652020-09-18 14:11:35 -050060@@ -1361,37 +1340,6 @@ main(int argc, char **argv)
Brad Bishop19323692019-04-05 15:28:33 -040061 fprintf(stderr, "%s: XSetLocaleModifiers failed\n", ProgramName);
Patrick Williamsc124f4f2015-09-15 14:41:29 -050062 }
63
Brad Bishop19323692019-04-05 15:28:33 -040064- xim = XOpenIM(dpy, NULL, NULL, NULL);
65- if (xim == NULL) {
66- fprintf(stderr, "%s: XOpenIM failed\n", ProgramName);
Patrick Williamsc124f4f2015-09-15 14:41:29 -050067- }
Brad Bishop19323692019-04-05 15:28:33 -040068-
69- if (xim) {
70- imvalret = XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL);
71- if (imvalret != NULL || xim_styles == NULL) {
72- fprintf(stderr, "%s: input method doesn't support any styles\n",
73- ProgramName);
74- }
75-
76- if (xim_styles) {
77- xim_style = 0;
78- for (i = 0; i < xim_styles->count_styles; i++) {
79- if (xim_styles->supported_styles[i] ==
80- (XIMPreeditNothing | XIMStatusNothing)) {
81- xim_style = xim_styles->supported_styles[i];
82- break;
83- }
84- }
85-
86- if (xim_style == 0) {
87- fprintf(stderr,
88- "%s: input method doesn't support the style we support\n",
89- ProgramName);
90- }
91- XFree(xim_styles);
92- }
93- }
94-
95 screen = DefaultScreen(dpy);
Patrick Williamsc124f4f2015-09-15 14:41:29 -050096
Brad Bishop19323692019-04-05 15:28:33 -040097 attr.event_mask = event_masks[EVENT_MASK_INDEX_CORE];
Andrew Geisslerc9f78652020-09-18 14:11:35 -050098@@ -1446,16 +1394,6 @@ main(int argc, char **argv)
Brad Bishop19323692019-04-05 15:28:33 -040099 printf("Outer window is 0x%lx, inner window is 0x%lx\n", w, subw);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500100 }
101
102- if (xim && xim_style) {
Brad Bishop19323692019-04-05 15:28:33 -0400103- xic = XCreateIC(xim,
104- XNInputStyle, xim_style,
105- XNClientWindow, w, XNFocusWindow, w, NULL);
106-
107- if (xic == NULL) {
108- fprintf(stderr, "XCreateIC failed\n");
109- }
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500110- }
Brad Bishop19323692019-04-05 15:28:33 -0400111-
112 have_rr = XRRQueryExtension(dpy, &rr_event_base, &rr_error_base);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500113 if (have_rr) {
Brad Bishop19323692019-04-05 15:28:33 -0400114 int rr_major, rr_minor;