Here is a patch (against CVS HEAD) that adds XEmbed support for all X flavours and makes keyboard focus work for the GTK version. It needs the gtkplug, parentid and parent-fix patches [1]. [1] http://lists.gnu.org/archive/html/emacs-devel/2005-12/msg01558.html Some issues: * The current implementation is minimal although all XEmbed message types and parameters are enumerated in src/xterm.h. It is not clear to me if the additional protocol features are feasible for Emacs or how to implement them. * Emacs requests focus only when the buffer area is clicked. It might be a good idea to request focus also when the menubar or the toolbar is clicked. * I'm not sure if src/xterm.h and src/xterm.c are the correct files for the XEmbed enums and utility functions. * The implementation of XEMBED_FOCUS_{IN,OUT} seems clumsy. * I tested only --with-x and --with-gtk configurations. * The keyboard focus works correctly (at least) under Metacity, but there seems to be a problem when using the Ion 3 window manager. The original GtkPlug version could only be used with Ion because it seems to treat embedded windows like top-levels as far as focus is concerned; the embedder application is not in charge. timo