emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r99826: Set WM_CLIENT_MACHINE and _NE


From: jhd
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r99826: Set WM_CLIENT_MACHINE and _NET_WM_PID properties (Bug#5828).
Date: Sun, 04 Apr 2010 12:47:12 +0200
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 99826
committer: jhd <address@hidden>
branch nick: trunk
timestamp: Sun 2010-04-04 12:47:12 +0200
message:
  Set WM_CLIENT_MACHINE and _NET_WM_PID properties (Bug#5828).
  
  * xfns.c (set_machine_and_pid_properties): New function.
           (Fx_create_frame): Call set_machine_and_pid_properties.
modified:
  src/ChangeLog
  src/xfns.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2010-04-03 13:43:23 +0000
+++ b/src/ChangeLog     2010-04-04 10:47:12 +0000
@@ -1,3 +1,8 @@
+2010-04-04  Jan Djärv  <address@hidden>
+
+       * xfns.c (set_machine_and_pid_properties): New function.
+       (Fx_create_frame): Call set_machine_and_pid_properties.
+
 2010-04-03  Eli Zaretskii  <address@hidden>
 
        * bidi.c (bidi_resolve_explicit, bidi_level_of_next_char): Check

=== modified file 'src/xfns.c'
--- a/src/xfns.c        2010-03-24 18:02:56 +0000
+++ b/src/xfns.c        2010-04-04 10:47:12 +0000
@@ -203,6 +203,10 @@
 
 extern Lisp_Object Vwindow_system_version;
 
+/* In editfns.c */
+
+extern Lisp_Object Vsystem_name;
+
 /* The below are defined in frame.c.  */
 
 #if GLYPH_DEBUG
@@ -3145,6 +3149,37 @@
   return Qnil;
 }
 
+static void
+set_machine_and_pid_properties (struct frame *f)
+{
+  /* See the above comment "Note: Encoding strategy".  */
+  XTextProperty text;
+  int bytes, stringp;
+  int do_free_text_value = 0;
+
+  text.value = x_encode_text (Vsystem_name,
+                              Qcompound_text, 0, &bytes, &stringp,
+                              &do_free_text_value);
+  text.encoding = (stringp ? XA_STRING
+                   : FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT);
+  text.format = 8;
+  text.nitems = bytes;
+  XSetWMClientMachine (FRAME_X_DISPLAY (f),
+                       FRAME_OUTER_WINDOW (f),
+                       &text);
+  if (do_free_text_value)
+    xfree (text.value);
+
+  long pid = (long)getpid();
+  XChangeProperty (FRAME_X_DISPLAY (f),
+                   FRAME_OUTER_WINDOW (f),
+                   XInternAtom (FRAME_X_DISPLAY (f),
+                                "_NET_WM_PID",
+                                False),
+                   XA_CARDINAL, 32, PropModeReplace,
+                   (unsigned char *) &pid, 1);
+}
+
 DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
        1, 1, 0,
        doc: /* Make a new X window, which is called a "frame" in Emacs terms.
@@ -3531,19 +3566,24 @@
        ;
     }
 
+  BLOCK_INPUT;
+                       
+  /* Set machine name and pid for the purpose of window managers.  */
+  set_machine_and_pid_properties(f);
+
   /* Set the WM leader property.  GTK does this itself, so this is not
      needed when using GTK.  */
   if (dpyinfo->client_leader_window != 0)
     {
-      BLOCK_INPUT;
       XChangeProperty (FRAME_X_DISPLAY (f),
                        FRAME_OUTER_WINDOW (f),
                        dpyinfo->Xatom_wm_client_leader,
                        XA_WINDOW, 32, PropModeReplace,
                        (unsigned char *) &dpyinfo->client_leader_window, 1);
-      UNBLOCK_INPUT;
     }
 
+  UNBLOCK_INPUT;
+
   /* Initialize `default-minibuffer-frame' in case this is the first
      frame on this terminal.  */
   if (FRAME_HAS_MINIBUF_P (f)


reply via email to

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