[pulseaudio-discuss] [PATCH] attach X11 properties to Screen, not Display

Leszek Koltunski leszek at koltunski.pl
Mon Oct 26 08:45:25 PDT 2009


The patch below attaches X11 properties to a Screen, not a Display. Using
it, I am able to do the following:

leszek# pax11publish -D ":0.0" -O alsa_output.pci-0000_01_06.0.analog-stereo
-e

leszek# pax11publish -D ":0.1" -O alsa_output.pci-0000_00_07.0.analog-stereo
-e

leszek# xprop -root -display ":0.0" | grep PULSE
PULSE_COOKIE(STRING) =
"3ac2381a17c704d94ef0edb1b8fdf289ff003587b59a45d6ae3aa0f3c1586032192d180896ffb9412193d7531ea1cdddd869e53c3c3ffb9c2c5fcd0dd036baccdac959992a599fa398823fb35d61a07fd17466e095cc00ffa22c9c14ff9d982ee368c6c16c24014b150bbed5facac7b37c35507b4fb73d9d0bd2efe22bbd4f86a7de42d8d105c8900ecc3462f0dece7d1a6b845275b095a301112544f1409ab3beb84989bc5ae19459b57c3415275334b849824659c9696e6c797d46be53d0957831569fa9a535713a8a1f216cfa7aeb6d6faa35f4b9a7fed5f4fc21dfb47ca9514f26fd118f09836e5c2308be49254189d967c20d258a65cd1fc2d4aa2f2652"
PULSE_SINK(STRING) = "alsa_output.pci-0000_01_06.0.analog-stereo"
PULSE_SERVER(STRING) = "leszek-desktop"
PULSE_SESSION_ID(STRING) =
"571eae318b6377f95367e6524abdec09-1256566213.375419-376893987"

leszek# xprop -root -display ":0.1" | grep PULSE
PULSE_COOKIE(STRING) =
"3ac2381a17c704d94ef0edb1b8fdf289ff003587b59a45d6ae3aa0f3c1586032192d180896ffb9412193d7531ea1cdddd869e53c3c3ffb9c2c5fcd0dd036baccdac959992a599fa398823fb35d61a07fd17466e095cc00ffa22c9c14ff9d982ee368c6c16c24014b150bbed5facac7b37c35507b4fb73d9d0bd2efe22bbd4f86a7de42d8d105c8900ecc3462f0dece7d1a6b845275b095a301112544f1409ab3beb84989bc5ae19459b57c3415275334b849824659c9696e6c797d46be53d0957831569fa9a535713a8a1f216cfa7aeb6d6faa35f4b9a7fed5f4fc21dfb47ca9514f26fd118f09836e5c2308be49254189d967c20d258a65cd1fc2d4aa2f2652"
PULSE_SINK(STRING) = "alsa_output.pci-0000_00_07.0.analog-stereo"
PULSE_SERVER(STRING) = "leszek-desktop"

Now I try playing something from :0.0 - sound correctly gets routed to
alsa_output.pci-0000_01_06.0.analog-stereo

However when I try to play something from :0.1, all I can hear is silence. I
notice that for some reason PULSE_SESSION is missing from :0.1's root
window. I add it:

leszek# xprop -root -display ":0.1" -f PULSE_SESSION_ID 8s -set
PULSE_SESSION_ID
571eae318b6377f95367e6524abdec09-1256566213.375419-376893987

..and everything works!

Apart the problem with PULSE_SESSION, there is another one: the above
confuses gnome-volume-manager which seems to completely disregard the X11
props.

*****************************************************************************
diff -Naur pulseaudio-0.9.19-old/src/pulsecore/x11prop.c
pulseaudio-0.9.19-new/src/pulsecore/x11prop.c
--- pulseaudio-0.9.19-old/src/pulsecore/x11prop.c    2009-10-26
23:07:57.000000000 +0800
+++ pulseaudio-0.9.19-new/src/pulsecore/x11prop.c    2009-10-26
22:36:46.000000000 +0800
@@ -32,12 +32,12 @@

 void pa_x11_set_prop(Display *d, const char *name, const char *data) {
     Atom a = XInternAtom(d, name, False);
-    XChangeProperty(d, RootWindow(d, 0), a, XA_STRING, 8, PropModeReplace,
(const unsigned char*) data, (int) (strlen(data)+1));
+    XChangeProperty(d, DefaultRootWindow(d), a, XA_STRING, 8,
PropModeReplace, (const unsigned char*) data, (int) (strlen(data)+1));
 }

 void pa_x11_del_prop(Display *d, const char *name) {
     Atom a = XInternAtom(d, name, False);
-    XDeleteProperty(d, RootWindow(d, 0), a);
+    XDeleteProperty(d, DefaultRootWindow(d), a);
 }

 char* pa_x11_get_prop(Display *d, const char *name, char *p, size_t l) {
@@ -49,7 +49,7 @@
     char *ret = NULL;

     Atom a = XInternAtom(d, name, False);
-    if (XGetWindowProperty(d, RootWindow(d, 0), a, 0, (long) ((l+2)/4),
False, XA_STRING, &actual_type, &actual_format, &nitems, &nbytes_after,
&prop) != Success)
+    if (XGetWindowProperty(d, DefaultRootWindow(d), a, 0, (long) ((l+2)/4),
False, XA_STRING, &actual_type, &actual_format, &nitems, &nbytes_after,
&prop) != Success)
         goto finish;

     if (actual_type != XA_STRING)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20091026/eceb98ab/attachment.htm>


More information about the pulseaudio-discuss mailing list