|
47 | 47 | #include <unistd.h> |
48 | 48 | #endif |
49 | 49 |
|
| 50 | +// For WM_CLIENT_MACHINE |
| 51 | +#include <X11/Xmu/SysUtil.h> |
| 52 | + |
50 | 53 | #include "wraster.h" |
51 | 54 |
|
52 | 55 | // For X_HAVE_UTF8_STRING |
@@ -762,23 +765,41 @@ - (gswindow_device_t *)_createServerWindow:(NSRect)frame |
762 | 765 | * of type 'long' or 'unsigned long' even on machines where those types |
763 | 766 | * hold 64bit values. |
764 | 767 | */ |
765 | | - XChangeProperty(dpy, window->ident, generic._GNUSTEP_WM_ATTR_ATOM, |
766 | | - generic._GNUSTEP_WM_ATTR_ATOM, 32, PropModeReplace, |
767 | | - (unsigned char *)&window->win_attrs, |
| 768 | + XChangeProperty(dpy, window->ident, generic._GNUSTEP_WM_ATTR_ATOM, generic._GNUSTEP_WM_ATTR_ATOM, |
| 769 | + 32, PropModeReplace, (unsigned char *)&window->win_attrs, |
768 | 770 | sizeof(GNUstepWMAttributes) / sizeof(CARD32)); |
769 | 771 |
|
770 | | - // send to the WM window style hints |
771 | | - if ((generic.wm & XGWM_WINDOWMAKER) == 0) { |
772 | | - setWindowHintsForStyle(dpy, window->ident, style, |
773 | | - generic._MOTIF_WM_HINTS_ATOM); |
774 | | - } |
775 | | - |
776 | | - // For window managers supporting EWMH, but not Window Maker, |
777 | | - // where we use a different solution, set the window icon. |
| 772 | + // Set EWMH properties |
778 | 773 | if ((generic.wm & XGWM_EWMH) != 0) { |
| 774 | + char hostname[256]; |
| 775 | + XTextProperty machineName; |
| 776 | + long pid; |
| 777 | + |
| 778 | + // _NET_WM_PID |
| 779 | + pid = (long)getpid(); |
| 780 | + XChangeProperty(dpy, window->ident, generic._NET_WM_PID_ATOM, XA_CARDINAL, 32, PropModeReplace, |
| 781 | + (unsigned char *)&pid, 1); |
| 782 | + |
| 783 | + // WM_CLIENT_MACHINE |
| 784 | + hostname[0] = '\0'; |
| 785 | + machineName.encoding = XA_STRING; |
| 786 | + machineName.format = 8; |
| 787 | + machineName.nitems = XmuGetHostname(hostname, sizeof(hostname)); |
| 788 | + machineName.value = (unsigned char *)hostname; |
| 789 | + if (hostname[0] != '\0') { |
| 790 | + XChangeProperty(dpy, window->ident, XA_WM_CLIENT_MACHINE, XA_STRING, 8, PropModeReplace, |
| 791 | + (unsigned char *)hostname, (int)strlen(hostname)); |
| 792 | + } |
| 793 | + |
| 794 | + // _NET_WM_ICON |
779 | 795 | [self _setNetWMIconFor:window->ident]; |
780 | 796 | } |
781 | 797 |
|
| 798 | + // send to the WM window style hints |
| 799 | + if ((generic.wm & XGWM_WINDOWMAKER) == 0) { |
| 800 | + setWindowHintsForStyle(dpy, window->ident, style, generic._MOTIF_WM_HINTS_ATOM); |
| 801 | + } |
| 802 | + |
782 | 803 | // Use the globally active input mode |
783 | 804 | window->gen_hints.flags = InputHint; |
784 | 805 | window->gen_hints.input = False; |
|
0 commit comments