changeset 33917:da037b5d9ede

x11_common: XChangeProperty uses long for 32-bits. Adapted from a patch in OpenBSD's ports tree, with suggestions from Alexander Strasser.
author cigaes
date Sat, 20 Aug 2011 10:19:23 +0000
parents 7941d02c012b
children 294df8d5648d
files libvo/x11_common.c
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/x11_common.c	Sat Aug 20 08:18:36 2011 +0000
+++ b/libvo/x11_common.c	Sat Aug 20 10:19:23 2011 +0000
@@ -729,12 +729,18 @@
 {
     XClassHint wmClass;
     pid_t pid = getpid();
+    long prop = pid & 0x7FFFFFFF;
 
     wmClass.res_name = vo_winname ? vo_winname : name;
     wmClass.res_class = "MPlayer";
     XSetClassHint(display, window, &wmClass);
+
+    /* PID sizes other than 32-bit are not handled by the EWMH spec */
+    if ((pid_t)prop != pid)
+        return;
+
     XChangeProperty(display, window, XA_NET_WM_PID, XA_CARDINAL, 32,
-                    PropModeReplace, (unsigned char *) &pid, 1);
+                    PropModeReplace, (unsigned char *)&prop, 1);
 }
 
 Window vo_window = None;