Package: rdesktop
Version: 1.7.1-1
Severity: normal
Tags: patch

rdesktop supports a number of extended window manager hints, but not 
_WM_NET_PID.

The attached patch fixes that.  I've tested it against 1.8.2 as well as 1.7.1.

Please let me know if you'd prefer for me to submit it directly upstream as 
well as here.

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 3.12-1-686-pae (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages rdesktop depends on:
ii  libasound2    1.0.27.2-3
ii  libc6         2.18-5
ii  libpcsclite1  1.8.11-1
ii  libssl1.0.0   1.0.1g-3
ii  libx11-6      2:1.6.2-1
ii  libxrandr2    2:1.4.2-1

rdesktop recommends no packages.

Versions of packages rdesktop suggests:
pn  pcscd  <none>

-- no debconf information
>From 5a2fd7d8e2a43d3ac1645cd929f3d17cc7e970af Mon Sep 17 00:00:00 2001
From: Klee Dienes <[email protected]>
Date: Fri, 23 May 2014 08:14:39 -0400
Subject: [PATCH 1/3] Add _WM_NET_PID support.

---
 ewmhints.c | 10 +++++++++-
 xproto.h   |  1 +
 xwin.c     |  3 +++
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/ewmhints.c b/ewmhints.c
index ae132e5..e542ff4 100644
--- a/ewmhints.c
+++ b/ewmhints.c
@@ -35,7 +35,8 @@ extern Display *g_display;
 static Atom g_net_wm_state_maximized_vert_atom, g_net_wm_state_maximized_horz_atom,
 	g_net_wm_state_hidden_atom, g_net_wm_name_atom, g_utf8_string_atom,
 	g_net_wm_state_skip_taskbar_atom, g_net_wm_state_skip_pager_atom,
-	g_net_wm_state_modal_atom, g_net_wm_icon_atom, g_net_wm_state_above_atom;
+	g_net_wm_state_modal_atom, g_net_wm_icon_atom, g_net_wm_state_above_atom,
+	g_net_wm_pid_atom;
 
 Atom g_net_wm_state_atom, g_net_wm_desktop_atom;
 
@@ -191,6 +192,7 @@ ewmh_init()
 	g_net_wm_name_atom = XInternAtom(g_display, "_NET_WM_NAME", False);
 	g_net_wm_icon_atom = XInternAtom(g_display, "_NET_WM_ICON", False);
 	g_utf8_string_atom = XInternAtom(g_display, "UTF8_STRING", False);
+	g_net_wm_pid_atom = XInternAtom(g_display, "_NET_WM_PID", False);
 }
 
 
@@ -409,6 +411,12 @@ ewmh_set_wm_name(Window wnd, const char *title)
 			8, PropModeReplace, (unsigned char *) title, len);
 }
 
+void
+ewmh_set_wm_pid(Window wnd, pid_t pid)
+{
+	XChangeProperty(g_display, wnd, g_net_wm_pid_atom, XA_CARDINAL, sizeof(pid_t) * 8,
+			PropModeReplace, &pid, 1);
+}
 
 int
 ewmh_set_window_popup(Window wnd)
diff --git a/xproto.h b/xproto.h
index e3c07a5..3b7083a 100644
--- a/xproto.h
+++ b/xproto.h
@@ -7,6 +7,7 @@ int ewmh_change_state(Window wnd, int state);
 int ewmh_move_to_desktop(Window wnd, unsigned int desktop);
 int ewmh_get_window_desktop(Window wnd);
 void ewmh_set_wm_name(Window wnd, const char *title);
+void ewmh_set_wm_pid(Window wnd, pid_t pid);
 int ewmh_set_window_popup(Window wnd);
 int ewmh_set_window_modal(Window wnd);
 void ewmh_set_icon(Window wnd, int width, int height, const char *rgba_data);
diff --git a/xwin.c b/xwin.c
index 1637848..f321a05 100644
--- a/xwin.c
+++ b/xwin.c
@@ -506,6 +506,7 @@ sw_find_group(unsigned long id, RD_BOOL dont_create)
 	sg->wnd =
 		XCreateWindow(g_display, RootWindowOfScreen(g_screen), -1, -1, 1, 1, 0,
 			      CopyFromParent, CopyFromParent, CopyFromParent, 0, &attribs);
+	ewmh_set_wm_pid(sg->wnd, getpid());
 
 	sg->id = id;
 	sg->refcnt = 0;
@@ -2030,6 +2031,7 @@ ui_create_window(void)
 			      wndheight, 0, g_depth, InputOutput, g_visual,
 			      CWBackPixel | CWBackingStore | CWOverrideRedirect | CWColormap |
 			      CWBorderPixel, &attribs);
+	ewmh_set_wm_pid(g_wnd, getpid());
 
 	if (g_gc == NULL)
 	{
@@ -3930,6 +3932,7 @@ ui_seamless_create_window(unsigned long id, unsigned long group, unsigned long p
 	wnd = XCreateWindow(g_display, RootWindowOfScreen(g_screen), -1, -1, 1, 1, 0, g_depth,
 			    InputOutput, g_visual,
 			    CWBackPixel | CWBackingStore | CWColormap | CWBorderPixel, &attribs);
+	ewmh_set_wm_pid(wnd, getpid());
 
 	XStoreName(g_display, wnd, "SeamlessRDP");
 	ewmh_set_wm_name(wnd, "SeamlessRDP");
-- 
1.9.1

Reply via email to