File xrandr-print-outputs-per-provider.patch of Package xrandr

Index: xrandr-1.5.2/xrandr.c
===================================================================
--- xrandr-1.5.2.orig/xrandr.c
+++ xrandr-1.5.2/xrandr.c
@@ -2584,6 +2584,53 @@ get_monitors(Bool get_active)
     monitors->monitors = m;
 }
 
+static void
+print_providers (Bool current)
+{
+    int k;
+
+    if (!has_1_4) {
+	printf ("RandR 1.4 not supported\n");
+	exit (0);
+    }
+
+    get_screen (current);
+    get_crtcs ();
+    get_outputs ();
+    get_providers ();
+
+    if (providers) {
+	int j;
+	int i;
+
+	printf("Providers: number : %d\n", num_providers);
+
+	for (j = 0; j < num_providers; j++) {
+	    provider_t *provider = &providers[j];
+	    XRRProviderInfo *info = provider->info;
+
+	    printf("Provider %d: id: 0x%x; cap: 0x%x (", j, (int)provider->provider.xid, info->capabilities);
+	    for (k = 0; k < 4; k++)
+		if (info->capabilities & (1 << k)) {
+		    printf("%s", capability_name(1<<k));
+		    if ((info->capabilities & (0xff << (k + 1))) != 0)
+			printf (", ");
+		}
+	    printf (");");
+
+	    printf(" crtcs: %d; outputs: %d; associated providers: %d; name: %s\n", info->ncrtcs, info->noutputs, info->nassociatedproviders, info->name);
+
+	    for (i = 0; i < info->noutputs; i++) {
+		output_t *output = find_output_by_xid (info->outputs[i]);
+		if (output)
+		    printf ("    output %s\n", output->output.string);
+		else
+		    printf ("    output 0x%x\n", (int)info->outputs[i]);
+	    }
+	}
+    }
+}
+
 int
 main (int argc, char **argv)
 {
@@ -3906,31 +3953,8 @@ main (int argc, char **argv)
 	}
 	exit (0);
     }
-    if (list_providers) {
-	if (!has_1_4) {
-	    printf ("RandR 1.4 not supported\n");
-	    exit (0);
-	}
-
-	get_screen (current);
-	get_providers ();
-
-	if (providers) {
-	    printf("Providers: number : %d\n", num_providers);
-
-	    for (int j = 0; j < num_providers; j++) {
-		provider_t *provider = &providers[j];
-		XRRProviderInfo *info = provider->info;
-
-		printf("Provider %d: id: 0x%x cap: 0x%x", j, (int)provider->provider.xid, info->capabilities);
-		for (int k = 0; k < 4; k++)
-			if (info->capabilities & (1 << k))
-				printf(", %s", capability_name(1<<k));
-
-		printf(" crtcs: %d outputs: %d associated providers: %d name:%s\n", info->ncrtcs, info->noutputs, info->nassociatedproviders, info->name);
-	    }
-	}
-    }
+    if (list_providers)
+       print_providers (current);
     if (list_monitors || list_active_monitors) {
 
 	if (!has_1_5) {
openSUSE Build Service is sponsored by