Skip to content

Commit 824375e

Browse files
committed
gnustep/back: set more EWMH properties during window creation.
1 parent 1a9ed84 commit 824375e

1 file changed

Lines changed: 32 additions & 11 deletions

File tree

Libraries/gnustep/back/Source/x11/XGServerWindow.m

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
#include <unistd.h>
4848
#endif
4949

50+
// For WM_CLIENT_MACHINE
51+
#include <X11/Xmu/SysUtil.h>
52+
5053
#include "wraster.h"
5154

5255
// For X_HAVE_UTF8_STRING
@@ -762,23 +765,41 @@ - (gswindow_device_t *)_createServerWindow:(NSRect)frame
762765
* of type 'long' or 'unsigned long' even on machines where those types
763766
* hold 64bit values.
764767
*/
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,
768770
sizeof(GNUstepWMAttributes) / sizeof(CARD32));
769771

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
778773
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
779795
[self _setNetWMIconFor:window->ident];
780796
}
781797

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+
782803
// Use the globally active input mode
783804
window->gen_hints.flags = InputHint;
784805
window->gen_hints.input = False;

0 commit comments

Comments
 (0)