Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 301182
Collapse All | Expand All

(-)src/evrouter.c (-2 / +22 lines)
Lines 106-121 Link Here
106
static char *
106
static char *
107
get_focus ()
107
get_focus ()
108
{
108
{
109
	Window     focus;
109
	Window     focus, root, parent;
110
	Window *children;
110
	XClassHint xch = {NULL, NULL};
111
	XClassHint xch = {NULL, NULL};
111
	int        i;
112
	int        i;
112
	char       * wname = NULL;
113
	char       * wname = NULL;
113
	static char * oldwname = "(null)";
114
	static char * oldwname = "(null)";
115
	unsigned int	num_children;
114
116
115
	XGetInputFocus (d, &focus, &i);
117
	XGetInputFocus (d, &focus, &i);
116
	if (focus != None) {
118
	if (focus != None) {
117
		XGetClassHint (d, focus, &xch);
119
		XGetClassHint (d, focus, &xch);
118
		XFetchName (d, focus, &wname);
120
		XFetchName (d, focus, &wname);
121
		XQueryTree(d, focus, &root, &parent, &children, &num_children);
122
		if ((!xch.res_class) && (parent) && (focus != root)) {
123
			XFree(xch.res_class);
124
			XFree(xch.res_name);
125
			XFree(wname);
126
			XGetClassHint(d, parent, &xch);
127
			XFetchName (d, parent, &wname);
128
		}	                	                
119
	}
129
	}
120
130
121
	if (train_mode) {
131
	if (train_mode) {
Lines 238-248 Link Here
238
static void
248
static void
239
handle_event (evdev_t * dev, int devindex, struct input_event * ev)
249
handle_event (evdev_t * dev, int devindex, struct input_event * ev)
240
{
250
{
241
	Window          focus;
251
	Window          focus, root, parent;
252
	Window		*children;
242
	XClassHint      xch = {NULL, NULL};
253
	XClassHint      xch = {NULL, NULL};
243
	int             i, k;
254
	int             i, k;
244
	char          * wname = NULL;
255
	char          * wname = NULL;
245
	unsigned int    mods;
256
	unsigned int    mods;
257
	unsigned int	num_children;
246
	XErrorHandler   old_handler;
258
	XErrorHandler   old_handler;
247
		
259
		
248
	if ((ev->type != EV_KEY) && 
260
	if ((ev->type != EV_KEY) && 
Lines 262-267 Link Here
262
	if (focus != None) {
274
	if (focus != None) {
263
		XGetClassHint (d, focus, &xch);
275
		XGetClassHint (d, focus, &xch);
264
		XFetchName (d, focus, &wname);
276
		XFetchName (d, focus, &wname);
277
		XQueryTree(d, focus, &root, &parent, &children, &num_children);
278
		if ((!xch.res_class) && (parent) && (focus != root)) {
279
			XFree(xch.res_class);
280
			XFree(xch.res_name);
281
			XFree(wname);
282
			XGetClassHint(d, parent, &xch);
283
			XFetchName (d, parent, &wname);
284
		}	                	                
265
	}
285
	}
266
	XSetErrorHandler(old_handler);
286
	XSetErrorHandler(old_handler);
267
287

Return to bug 301182