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

2009-10-27 Thread Leszek Koltunski
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] Automatic selection of an audio sink depending on value of ENV variable

2009-10-27 Thread Lennart Poettering
On Tue, 27.10.09 16:39, Jeremy Visser (jer...@visser.name) wrote:

 On Mon, 2009-10-26 at 16:05 +0100, Lennart Poettering wrote:
   NVidia offers two ways to do it: you can setup the second monitor to be 
   what
   they call a separate X screen ( and that it precisely what I have here )
   or a TwinView (nvidia-speak for Xinerama ).
 
  this is bogus. gnome-panel is xinerama-aware and does not stretch
  panels across to monitors of the same screen.
 
 You are right, Lennart. Just FYI, TwinView is actually not the same
 thing as Xinerama. It is a proprietary and hacky NVIDIA solution to
 multiple monitors (been around for yonks -- before Xinerama was in X, I
 believe, but you wouldn't have heard of it unless you have had NVIDIA
 hardware).

Yes, but the nvidia drivers actually implemented the xinerama
interfaces pretty early so that clients that are xinerama-aware know
where to put their stuff. gnome-panel was xinerama-aware.

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