Index: src/actions.c =================================================================== RCS file: /cvsroot/ratpoison/ratpoison/src/actions.c,v retrieving revision 1.276 diff -u -r1.276 actions.c --- src/actions.c 24 May 2006 02:47:57 -0000 1.276 +++ src/actions.c 24 May 2006 02:54:09 -0000 @@ -4309,7 +4309,7 @@ XSelectInput(dpy, RootWindow (dpy, screens[i].screen_num), PropertyChangeMask | ColormapChangeMask | SubstructureRedirectMask | SubstructureNotifyMask - | StructureNotifyMask); + | StructureNotifyMask | FocusChangeMask ); /* Map its key window */ XMapWindow (dpy, screens[i].key_window); } Index: src/events.c =================================================================== RCS file: /cvsroot/ratpoison/ratpoison/src/events.c,v retrieving revision 1.135 diff -u -r1.135 events.c --- src/events.c 24 May 2006 02:48:22 -0000 1.135 +++ src/events.c 24 May 2006 02:54:09 -0000 @@ -689,6 +689,32 @@ } static void +focus_in (XFocusChangeEvent *ev) { + rp_screen *s; + + PRINT_DEBUG (("window id: %x detail:%x\n",(unsigned int)ev->window,ev->detail)); + if (ev->detail == NotifyInferior || ev->detail == NotifyNonlinear ) { + s = find_screen (ev->window); + if (s != NULL) { + PRINT_DEBUG (("screen's top window focused!\n")); + /* stupid things like xine like to focus the root window + * when exiting, after ratpoison already focused another window. + * change it back then */ + rp_frame *frame = current_frame(); + rp_window *current_window; + if (frame) + current_window = find_window_number(frame->win_number); + else + current_window = NULL; + if (current_window) + set_rp_window_focus(current_window); + XSync (dpy, False); + } + } + focus_change(ev); +} + +static void mapping_notify (XMappingEvent *ev) { ungrab_keys_all_wins(); @@ -846,7 +872,7 @@ case FocusIn: PRINT_DEBUG (("--- Handling FocusIn ---\n")); - focus_change (&ev->xfocus); + focus_in (&ev->xfocus); break; case MappingNotify: Index: src/screen.c =================================================================== RCS file: /cvsroot/ratpoison/ratpoison/src/screen.c,v retrieving revision 1.15 diff -u -r1.15 screen.c --- src/screen.c 20 Apr 2006 02:10:02 -0000 1.15 +++ src/screen.c 24 May 2006 02:54:09 -0000 @@ -267,7 +267,7 @@ XSelectInput(dpy, RootWindow (dpy, screen_num), PropertyChangeMask | ColormapChangeMask | SubstructureRedirectMask | SubstructureNotifyMask - | StructureNotifyMask); + | StructureNotifyMask | FocusChangeMask); XSync (dpy, False); /* Add netwm support. FIXME: I think this is busted. */