diff options
author | David Benjamin <davidben@mit.edu> | 2012-01-07 15:02:06 +0800 |
---|---|---|
committer | Chong Yidong <cyd@gnu.org> | 2012-01-07 15:02:06 +0800 |
commit | 75bf0d333960bf6f60af0005194fb21dec5b4485 (patch) | |
tree | 408f37d3c297c9d29277669062d3225421d03bd8 | |
parent | 29232a68e057e6fe47508f24e2fe713ae0cfa0c3 (diff) | |
download | emacs-75bf0d333960bf6f60af0005194fb21dec5b4485.tar.gz emacs-75bf0d333960bf6f60af0005194fb21dec5b4485.tar.bz2 emacs-75bf0d333960bf6f60af0005194fb21dec5b4485.zip |
Fix focus handling for embedded frames.
* xfns.c (Fx_focus_frame): Use it for embedded frames.
* xterm.c (x_embed_request_focus): New function.
* xterm.h: Add prototype.
Fixes: debbugs:9977
-rw-r--r-- | src/ChangeLog | 8 | ||||
-rw-r--r-- | src/xfns.c | 18 | ||||
-rw-r--r-- | src/xterm.c | 12 | ||||
-rw-r--r-- | src/xterm.h | 1 |
4 files changed, 36 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 9e236b25785..468e73c190b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2012-01-07 David Benjamin <davidben@mit.edu> (tiny change) + + * xterm.c (x_embed_request_focus): New function. + + * xterm.h: Add prototype. + + * xfns.c (Fx_focus_frame): Use it for embedded frames (Bug#9977). + 2012-01-05 Glenn Morris <rgm@gnu.org> * emacs.c (emacs_copyright): Update short copyright year to 2012. diff --git a/src/xfns.c b/src/xfns.c index 6f44b05fa6c..f00335b5d03 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -3519,9 +3519,21 @@ FRAME nil means use the selected frame. */) BLOCK_INPUT; x_catch_errors (dpy); - XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), - RevertToParent, CurrentTime); - x_ewmh_activate_frame (f); + + if (FRAME_X_EMBEDDED_P (f)) + { + /* For Xembedded frames, normally the embedder forwards key + events. See XEmbed Protocol Specification at + http://freedesktop.org/wiki/Specifications/xembed-spec */ + xembed_request_focus (f); + } + else + { + XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), + RevertToParent, CurrentTime); + x_ewmh_activate_frame (f); + } + x_uncatch_errors (); UNBLOCK_INPUT; diff --git a/src/xterm.c b/src/xterm.c index 73bafbda2fa..4b34d6344ac 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -8981,6 +8981,18 @@ x_lower_frame (struct frame *f) } } +/* Request focus with XEmbed */ + +void +xembed_request_focus (FRAME_PTR f) +{ + /* See XEmbed Protocol Specification at + http://freedesktop.org/wiki/Specifications/xembed-spec */ + if (f->async_visible) + xembed_send_message (f, CurrentTime, + XEMBED_REQUEST_FOCUS, 0, 0, 0); +} + /* Activate frame with Extended Window Manager Hints */ void diff --git a/src/xterm.h b/src/xterm.h index c77f386a2ad..86daa7bd27e 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -967,6 +967,7 @@ extern void x_clear_errors (Display *); extern void x_set_window_size (struct frame *, int, int, int); extern void x_set_mouse_position (struct frame *, int, int); extern void x_set_mouse_pixel_position (struct frame *, int, int); +extern void xembed_request_focus (struct frame *); extern void x_ewmh_activate_frame (struct frame *); extern void x_make_frame_visible (struct frame *); extern void x_make_frame_invisible (struct frame *); |