when focus on root window becomes None, set it to something other than

2003-09-26  Havoc Pennington  <hp@redhat.com>

	* src/display.c (event_callback): when focus on root window
	becomes None, set it to something other than None so keybindings
	keep working and print a warning about how some application sucks.
	#84564
	(event_callback): Fix debug spew to print focus event details
	properly
	(meta_display_open): when setting initial focus, always use
	RevertToPointerRoot and fix the focus if it's None or PointerRoot
This commit is contained in:
Havoc Pennington 2003-09-27 02:40:09 +00:00 committed by Havoc Pennington
parent 922932d240
commit 26c2ae81ea
2 changed files with 32 additions and 3 deletions

View File

@ -1,3 +1,14 @@
2003-09-26 Havoc Pennington <hp@redhat.com>
* src/display.c (event_callback): when focus on root window
becomes None, set it to something other than None so keybindings
keep working and print a warning about how some application sucks.
#84564
(event_callback): Fix debug spew to print focus event details
properly
(meta_display_open): when setting initial focus, always use
RevertToPointerRoot and fix the focus if it's None or PointerRoot
2003-09-26 Padraig O'Briain <padraig.obriain@sun.com> 2003-09-26 Padraig O'Briain <padraig.obriain@sun.com>
* src/Makefile.am: Add -DMETACITY_LIBDIR to support loading of modules * src/Makefile.am: Add -DMETACITY_LIBDIR to support loading of modules

View File

@ -592,7 +592,12 @@ meta_display_open (const char *name)
XGetInputFocus (display->xdisplay, &focus, &ret_to); XGetInputFocus (display->xdisplay, &focus, &ret_to);
/* Force a new FocusIn (does this work?) */ /* Force a new FocusIn (does this work?) */
XSetInputFocus (display->xdisplay, focus, ret_to, CurrentTime); if (focus == None || focus == PointerRoot)
focus = display->no_focus_window;
/* FIXME CurrentTime evil */
XSetInputFocus (display->xdisplay, focus, RevertToPointerRoot,
CurrentTime);
meta_error_trap_pop (display, FALSE); meta_error_trap_pop (display, FALSE);
} }
@ -1563,7 +1568,7 @@ event_callback (XEvent *event,
"???", "???",
event->xany.window, event->xany.window,
meta_event_mode_to_string (event->xfocus.mode), meta_event_mode_to_string (event->xfocus.mode),
meta_event_detail_to_string (event->xfocus.mode)); meta_event_detail_to_string (event->xfocus.detail));
} }
else if (meta_display_screen_for_root (display, else if (meta_display_screen_for_root (display,
event->xany.window) != NULL) event->xany.window) != NULL)
@ -1576,7 +1581,20 @@ event_callback (XEvent *event,
"???", "???",
event->xany.window, event->xany.window,
meta_event_mode_to_string (event->xfocus.mode), meta_event_mode_to_string (event->xfocus.mode),
meta_event_detail_to_string (event->xfocus.mode)); meta_event_detail_to_string (event->xfocus.detail));
if (event->type == FocusIn &&
event->xfocus.detail == NotifyDetailNone)
{
/* FIXME _() gettextify on HEAD */
meta_warning ("Working around an application which called XSetInputFocus (None) or with RevertToNone instead of RevertToPointerRoot, this is a minor bug in some application. If you can figure out which application causes this please report it as a bug against that application.\n");
/* Fix the problem */
XSetInputFocus (display->xdisplay,
display->no_focus_window,
RevertToPointerRoot,
CurrentTime); /* CurrentTime FIXME */
}
} }
break; break;
case KeymapNotify: case KeymapNotify: