emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r106814: Fix focus handling for embed


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r106814: Fix focus handling for embedded frames.
Date: Sat, 07 Jan 2012 15:02:06 +0800
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 106814
fixes bug(s): http://debbugs.gnu.org/9977
author: David Benjamin <address@hidden>
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sat 2012-01-07 15:02:06 +0800
message:
  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.
modified:
  src/ChangeLog
  src/xfns.c
  src/xterm.c
  src/xterm.h
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-01-05 09:46:05 +0000
+++ b/src/ChangeLog     2012-01-07 07:02:06 +0000
@@ -1,3 +1,11 @@
+2012-01-07  David Benjamin  <address@hidden>  (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  <address@hidden>
 
        * emacs.c (emacs_copyright): Update short copyright year to 2012.

=== modified file 'src/xfns.c'
--- a/src/xfns.c        2012-01-05 09:46:05 +0000
+++ b/src/xfns.c        2012-01-07 07:02:06 +0000
@@ -3519,9 +3519,21 @@
 
   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;
 

=== modified file 'src/xterm.c'
--- a/src/xterm.c       2012-01-05 09:46:05 +0000
+++ b/src/xterm.c       2012-01-07 07:02:06 +0000
@@ -8981,6 +8981,18 @@
     }
 }
 
+/* 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

=== modified file 'src/xterm.h'
--- a/src/xterm.h       2012-01-05 09:46:05 +0000
+++ b/src/xterm.h       2012-01-07 07:02:06 +0000
@@ -967,6 +967,7 @@
 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 *);


reply via email to

[Prev in Thread] Current Thread [Next in Thread]