From 26c2ae81eab6aa18ca1baa085e9f9b50f3d1b8da Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Sat, 27 Sep 2003 02:40:09 +0000 Subject: when focus on root window becomes None, set it to something other than 2003-09-26 Havoc Pennington * 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 --- ChangeLog | 11 +++++++++++ src/display.c | 24 +++++++++++++++++++++--- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2a7f5ac7..da151241 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2003-09-26 Havoc Pennington + + * 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 * src/Makefile.am: Add -DMETACITY_LIBDIR to support loading of modules diff --git a/src/display.c b/src/display.c index b838d9fa..d9396b42 100644 --- a/src/display.c +++ b/src/display.c @@ -592,7 +592,12 @@ meta_display_open (const char *name) XGetInputFocus (display->xdisplay, &focus, &ret_to); /* 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); } @@ -1563,7 +1568,7 @@ event_callback (XEvent *event, "???", event->xany.window, 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, event->xany.window) != NULL) @@ -1576,7 +1581,20 @@ event_callback (XEvent *event, "???", event->xany.window, 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; case KeymapNotify: -- cgit v1.2.1