Re: [pulseaudio-discuss] [PATCH] attach X11 properties to Screen, not Display
On Tue, 27.10.09 19:57, Leszek Koltunski (les...@koltunski.pl) wrote: > 1) Formatting corrected > 2) Fallback to screen 0 added. It works: Thanks a lot! Applied. Lennart -- Lennart PoetteringRed Hat, Inc. lennart [at] poettering [dot] net http://0pointer.net/lennart/ GnuPG 0x1A015CC4 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH] attach X11 properties to Screen, not Display
1) Formatting corrected 2) Fallback to screen 0 added. It works: leszek# pax11publish -D ":0.0" -d Server: {571eae318b6377f95367e6524abdec09}unix:/home/leszek/.pulse/571eae318b6377f95367e6524abdec09-runtime/native Sink: alsa_output.pci-_01_06.0.analog-stereo Cookie: 3ac2381a17c704d94ef0edb1b8fdf289ff003587b59a45d6ae3aa0f3c1586032192d180896ffb9412193d7531ea1c869e53c3c3ffb9c2c5fcd0dd036baccdac959992a599fa398823fb35d61a07fd17466e095cc00ffa22c9c14ff9d982ee368c6c16c24014b150bbed5facac7b37c35507b4fb73d9d0bd2efe22bbd4f86a7de42d8d105c8900ecc3462f0dece7d1a6b845275b095a301112544f1409ab3beb84989bc5ae19459b57c3415275334b849824659c9696e6c797d46be53d0957831569fa9a535713a8a1f216cfa7aeb6d6faa35f4b9a7fed5f4fc21dfb47ca9514f26fd118f09836e5c2308be49254189d967c20d258a65cd1fc2d4aa2f2652 leszek# pax11publish -D ":0.1" -d Server: {571eae318b6377f95367e6524abdec09}unix:/home/leszek/.pulse/571eae318b6377f95367e6524abdec09-runtime/native Sink: alsa_output.pci-_00_07.0.analog-stereo Cookie: 3ac2381a17c704d94ef0edb1b8fdf289ff003587b59a45d6ae3aa0f3c1586032192d180896ffb9412193d7531ea1c869e53c3c3ffb9c2c5fcd0dd036baccdac959992a599fa398823fb35d61a07fd17466e095cc00ffa22c9c14ff9d982ee368c6c16c24014b150bbed5facac7b37c35507b4fb73d9d0bd2efe22bbd4f86a7de42d8d105c8900ecc3462f0dece7d1a6b845275b095a301112544f1409ab3beb84989bc5ae19459b57c3415275334b849824659c9696e6c797d46be53d0957831569fa9a535713a8a1f216cfa7aeb6d6faa35f4b9a7fed5f4fc21dfb47ca9514f26fd118f09836e5c2308be49254189d967c20d258a65cd1fc2d4aa2f2652 leszek# xprop -root -display ":0.1" -remove PULSE_SINK leszek# pax11publish -D ":0.1" -d Server: {571eae318b6377f95367e6524abdec09}unix:/home/leszek/.pulse/571eae318b6377f95367e6524abdec09-runtime/native Sink: alsa_output.pci-_01_06.0.analog-stereo Cookie: 3ac2381a17c704d94ef0edb1b8fdf289ff003587b59a45d6ae3aa0f3c1586032192d180896ffb9412193d7531ea1c869e53c3c3ffb9c2c5fcd0dd036baccdac959992a599fa398823fb35d61a07fd17466e095cc00ffa22c9c14ff9d982ee368c6c16c24014b150bbed5facac7b37c35507b4fb73d9d0bd2efe22bbd4f86a7de42d8d105c8900ecc3462f0dece7d1a6b845275b095a301112544f1409ab3beb84989bc5ae19459b57c3415275334b849824659c9696e6c797d46be53d0957831569fa9a535713a8a1f216cfa7aeb6d6faa35f4b9a7fed5f4fc21dfb47ca9514f26fd118f09836e5c2308be49254189d967c20d258a65cd1fc2d4aa2f2652 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.0 +0800 +++ pulseaudio-0.9.19-new/src/pulsecore/x11prop.c 2009-10-27 19:29:39.0 +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) { @@ -47,13 +47,21 @@ unsigned long nbytes_after; unsigned char *prop = NULL; char *ret = NULL; +int window_ret; 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) -goto finish; + +window_ret = XGetWindowProperty(d, DefaultRootWindow(d), a, 0, (long) ((l+2)/4), False, XA_STRING, &actual_type, &actual_format, &nitems, &nbytes_after, &prop); -if (actual_type != XA_STRING) -goto finish; +if( window_ret != Success || actual_type != XA_STRING ) { +if( DefaultScreen(d) != 0 ) { +window_ret = XGetWindowProperty(d, RootWindow(d,0), a, 0, (long) ((l+2)/4), False, XA_STRING, &actual_type, &actual_format, &nitems, &nbytes_after, &prop); + +if( window_ret != Success || actual_type != XA_STRING ) +goto finish; +} +else goto finish; +} memcpy(p, prop, nitems); p[nitems] = 0; ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH] attach X11 properties to Screen, not Display
On Mon, 26.10.09 23:45, Leszek Koltunski (les...@koltunski.pl) wrote: > 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.c2009-10-26 > 23:07:57.0 +0800 > +++ pulseaudio-0.9.19-new/src/pulsecore/x11prop.c2009-10-26 > 22:36:46.0 +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)); > } Also, please disable line breaking in your mailer. Otherwise I cannot apply your patches here. Patches formatted with git format-patch are preferred btw, Lennart -- Lennart PoetteringRed Hat, Inc. lennart [at] poettering [dot] net http://0pointer.net/lennart/ GnuPG 0x1A015CC4 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH] attach X11 properties to Screen, not Display
On Mon, 26.10.09 23:45, Leszek Koltunski (les...@koltunski.pl) wrote: > The patch below attaches X11 properties to a Screen, not a Display. Using > it, I am able to do the following: Uh. As mentioned earlier I'd prefer if when reading those props we would fallback to screen 0 if the default screen has no data attached and the default screen isn't 0 anyway. That would have two advantages: firstly, we keep better compat with the current logic. Secondly, this would allow us to cater for both the folks who want to attach the audio server contact data to screens and those who want to attach it to displays. Otherwise the patch looks good to me. > 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! That prop is added by module-publish-x11 and is simply used to make sure that the module on unload does not kill the data someone else set. Lennart -- Lennart PoetteringRed Hat, Inc. lennart [at] poettering [dot] net http://0pointer.net/lennart/ GnuPG 0x1A015CC4 ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [PATCH] attach X11 properties to Screen, not Display
Cool. The above patch actually fully works. One kjust has to load two modules-x11-publish: pactl load-module module-x11-publish display=":0.0" sink=alsa_output.pci-_01_06.0.analog-stereo pactl load-module module-x11-publish display=":0.1" sink=alsa_output.pci-_00_07.0.analog-stereo ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [PATCH] attach X11 properties to Screen, not Display
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-_01_06.0.analog-stereo -e leszek# pax11publish -D ":0.1" -O alsa_output.pci-_00_07.0.analog-stereo -e leszek# xprop -root -display ":0.0" | grep PULSE PULSE_COOKIE(STRING) = "3ac2381a17c704d94ef0edb1b8fdf289ff003587b59a45d6ae3aa0f3c1586032192d180896ffb9412193d7531ea1c869e53c3c3ffb9c2c5fcd0dd036baccdac959992a599fa398823fb35d61a07fd17466e095cc00ffa22c9c14ff9d982ee368c6c16c24014b150bbed5facac7b37c35507b4fb73d9d0bd2efe22bbd4f86a7de42d8d105c8900ecc3462f0dece7d1a6b845275b095a301112544f1409ab3beb84989bc5ae19459b57c3415275334b849824659c9696e6c797d46be53d0957831569fa9a535713a8a1f216cfa7aeb6d6faa35f4b9a7fed5f4fc21dfb47ca9514f26fd118f09836e5c2308be49254189d967c20d258a65cd1fc2d4aa2f2652" PULSE_SINK(STRING) = "alsa_output.pci-_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) = "3ac2381a17c704d94ef0edb1b8fdf289ff003587b59a45d6ae3aa0f3c1586032192d180896ffb9412193d7531ea1c869e53c3c3ffb9c2c5fcd0dd036baccdac959992a599fa398823fb35d61a07fd17466e095cc00ffa22c9c14ff9d982ee368c6c16c24014b150bbed5facac7b37c35507b4fb73d9d0bd2efe22bbd4f86a7de42d8d105c8900ecc3462f0dece7d1a6b845275b095a301112544f1409ab3beb84989bc5ae19459b57c3415275334b849824659c9696e6c797d46be53d0957831569fa9a535713a8a1f216cfa7aeb6d6faa35f4b9a7fed5f4fc21dfb47ca9514f26fd118f09836e5c2308be49254189d967c20d258a65cd1fc2d4aa2f2652" PULSE_SINK(STRING) = "alsa_output.pci-_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-_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.c2009-10-26 23:07:57.0 +0800 +++ pulseaudio-0.9.19-new/src/pulsecore/x11prop.c2009-10-26 22:36:46.0 +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) ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss