diff options
| author | Jan Djärv | 2010-04-04 12:47:12 +0200 |
|---|---|---|
| committer | Jan Djärv | 2010-04-04 12:47:12 +0200 |
| commit | 3e6bec3b8cd377d078fedc514b26747e60b19ff0 (patch) | |
| tree | 1ab8204a2b6a3ac57fe8e91de8c066feb53891a7 | |
| parent | feb72cfb9338c1a9386dc772950adf513fb14d23 (diff) | |
| download | emacs-3e6bec3b8cd377d078fedc514b26747e60b19ff0.tar.gz emacs-3e6bec3b8cd377d078fedc514b26747e60b19ff0.zip | |
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.
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/xfns.c | 44 |
2 files changed, 47 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 6629a29ed9e..218ea86b84b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2010-04-04 Jan Djärv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * xfns.c (set_machine_and_pid_properties): New function. | ||
| 4 | (Fx_create_frame): Call set_machine_and_pid_properties. | ||
| 5 | |||
| 1 | 2010-04-03 Eli Zaretskii <eliz@gnu.org> | 6 | 2010-04-03 Eli Zaretskii <eliz@gnu.org> |
| 2 | 7 | ||
| 3 | * bidi.c (bidi_resolve_explicit, bidi_level_of_next_char): Check | 8 | * bidi.c (bidi_resolve_explicit, bidi_level_of_next_char): Check |
diff --git a/src/xfns.c b/src/xfns.c index ae5858ccfb5..8a0e43bcb48 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -203,6 +203,10 @@ Lisp_Object Qfont_param; | |||
| 203 | 203 | ||
| 204 | extern Lisp_Object Vwindow_system_version; | 204 | extern Lisp_Object Vwindow_system_version; |
| 205 | 205 | ||
| 206 | /* In editfns.c */ | ||
| 207 | |||
| 208 | extern Lisp_Object Vsystem_name; | ||
| 209 | |||
| 206 | /* The below are defined in frame.c. */ | 210 | /* The below are defined in frame.c. */ |
| 207 | 211 | ||
| 208 | #if GLYPH_DEBUG | 212 | #if GLYPH_DEBUG |
| @@ -3145,6 +3149,37 @@ If FRAME is nil, use the selected frame. */) | |||
| 3145 | return Qnil; | 3149 | return Qnil; |
| 3146 | } | 3150 | } |
| 3147 | 3151 | ||
| 3152 | static void | ||
| 3153 | set_machine_and_pid_properties (struct frame *f) | ||
| 3154 | { | ||
| 3155 | /* See the above comment "Note: Encoding strategy". */ | ||
| 3156 | XTextProperty text; | ||
| 3157 | int bytes, stringp; | ||
| 3158 | int do_free_text_value = 0; | ||
| 3159 | |||
| 3160 | text.value = x_encode_text (Vsystem_name, | ||
| 3161 | Qcompound_text, 0, &bytes, &stringp, | ||
| 3162 | &do_free_text_value); | ||
| 3163 | text.encoding = (stringp ? XA_STRING | ||
| 3164 | : FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT); | ||
| 3165 | text.format = 8; | ||
| 3166 | text.nitems = bytes; | ||
| 3167 | XSetWMClientMachine (FRAME_X_DISPLAY (f), | ||
| 3168 | FRAME_OUTER_WINDOW (f), | ||
| 3169 | &text); | ||
| 3170 | if (do_free_text_value) | ||
| 3171 | xfree (text.value); | ||
| 3172 | |||
| 3173 | long pid = (long)getpid(); | ||
| 3174 | XChangeProperty (FRAME_X_DISPLAY (f), | ||
| 3175 | FRAME_OUTER_WINDOW (f), | ||
| 3176 | XInternAtom (FRAME_X_DISPLAY (f), | ||
| 3177 | "_NET_WM_PID", | ||
| 3178 | False), | ||
| 3179 | XA_CARDINAL, 32, PropModeReplace, | ||
| 3180 | (unsigned char *) &pid, 1); | ||
| 3181 | } | ||
| 3182 | |||
| 3148 | DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, | 3183 | DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, |
| 3149 | 1, 1, 0, | 3184 | 1, 1, 0, |
| 3150 | doc: /* Make a new X window, which is called a "frame" in Emacs terms. | 3185 | doc: /* Make a new X window, which is called a "frame" in Emacs terms. |
| @@ -3531,19 +3566,24 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 3531 | ; | 3566 | ; |
| 3532 | } | 3567 | } |
| 3533 | 3568 | ||
| 3569 | BLOCK_INPUT; | ||
| 3570 | |||
| 3571 | /* Set machine name and pid for the purpose of window managers. */ | ||
| 3572 | set_machine_and_pid_properties(f); | ||
| 3573 | |||
| 3534 | /* Set the WM leader property. GTK does this itself, so this is not | 3574 | /* Set the WM leader property. GTK does this itself, so this is not |
| 3535 | needed when using GTK. */ | 3575 | needed when using GTK. */ |
| 3536 | if (dpyinfo->client_leader_window != 0) | 3576 | if (dpyinfo->client_leader_window != 0) |
| 3537 | { | 3577 | { |
| 3538 | BLOCK_INPUT; | ||
| 3539 | XChangeProperty (FRAME_X_DISPLAY (f), | 3578 | XChangeProperty (FRAME_X_DISPLAY (f), |
| 3540 | FRAME_OUTER_WINDOW (f), | 3579 | FRAME_OUTER_WINDOW (f), |
| 3541 | dpyinfo->Xatom_wm_client_leader, | 3580 | dpyinfo->Xatom_wm_client_leader, |
| 3542 | XA_WINDOW, 32, PropModeReplace, | 3581 | XA_WINDOW, 32, PropModeReplace, |
| 3543 | (unsigned char *) &dpyinfo->client_leader_window, 1); | 3582 | (unsigned char *) &dpyinfo->client_leader_window, 1); |
| 3544 | UNBLOCK_INPUT; | ||
| 3545 | } | 3583 | } |
| 3546 | 3584 | ||
| 3585 | UNBLOCK_INPUT; | ||
| 3586 | |||
| 3547 | /* Initialize `default-minibuffer-frame' in case this is the first | 3587 | /* Initialize `default-minibuffer-frame' in case this is the first |
| 3548 | frame on this terminal. */ | 3588 | frame on this terminal. */ |
| 3549 | if (FRAME_HAS_MINIBUF_P (f) | 3589 | if (FRAME_HAS_MINIBUF_P (f) |