← easystroke

Account for dbus api change in compiz 0.9

8e0f187fc64078977ed896ddad0c3f15ab822dc7 · Thomas Jaeger · Aug 10, 2011 14:18

+23 −5 · 3 files changed

  • annotate.cc +10 −2
  • fire.cc +8 −2
  • water.cc +5 −1
diff --git a/annotate.cc b/annotate.cc
index 4bab714..a6f0481 100644
--- a/annotate.cc
+++ b/annotate.cc
@@ -14,6 +14,8 @@
  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 #include "annotate.h"
+#include <stdio.h>
+#include <X11/Xlib.h>
 
 Annotate::Annotate() {
 	const char *ofc = "org.freedesktop.compiz";
@@ -23,8 +25,14 @@ Annotate::Annotate() {
 		g_error_free(error);
 		throw DBusException();
 	}
-	draw_proxy = dbus_g_proxy_new_for_name(bus, ofc, "/org/freedesktop/compiz/annotate/allscreens/draw", ofc);
-	clear_proxy = dbus_g_proxy_new_for_name(bus, ofc, "/org/freedesktop/compiz/annotate/allscreens/clear_key", ofc);
+
+	char draw[256];
+	char clear[256];
+	snprintf(draw, sizeof(draw), "/org/freedesktop/compiz/annotate/screen%d/draw", DefaultScreen(dpy));
+	snprintf(clear, sizeof(clear), "/org/freedesktop/compiz/annotate/screen%d/clear_key", DefaultScreen(dpy));
+
+	draw_proxy = dbus_g_proxy_new_for_name(bus, ofc, draw, ofc);
+	clear_proxy = dbus_g_proxy_new_for_name(bus, ofc, clear, ofc);
 }
 
 void Annotate::draw(Point p, Point q) {
diff --git a/fire.cc b/fire.cc
index 8a15b63..729cf9f 100644
--- a/fire.cc
+++ b/fire.cc
@@ -14,6 +14,7 @@
  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 #include "fire.h"
+#include <X11/Xlib.h>
 #include <math.h>
 
 Fire::Fire() {
@@ -24,8 +25,13 @@ Fire::Fire() {
 		g_error_free(error);
 		throw DBusException();
 	}
-	point_proxy = dbus_g_proxy_new_for_name(bus, ofc, "/org/freedesktop/compiz/firepaint/allscreens/add_particle", ofc);
-	clear_proxy = dbus_g_proxy_new_for_name(bus, ofc, "/org/freedesktop/compiz/firepaint/allscreens/clear_key", ofc);
+	char add[256];
+	char clear[256];
+	snprintf(add, sizeof(add), "/org/freedesktop/compiz/firepaint/screen%d/add_particle", DefaultScreen(dpy));
+	snprintf(clear, sizeof(clear), "/org/freedesktop/compiz/firepaint/screen%d/clear_key", DefaultScreen(dpy));
+
+	point_proxy = dbus_g_proxy_new_for_name(bus, ofc, add, ofc);
+	clear_proxy = dbus_g_proxy_new_for_name(bus, ofc, clear, ofc);
 }
 
 void Fire::add_point(float x, float y) {
diff --git a/water.cc b/water.cc
index abe21cd..a528b01 100644
--- a/water.cc
+++ b/water.cc
@@ -14,6 +14,8 @@
  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 #include "water.h"
+#include <X11/Xlib.h>
+#include <stdio.h>
 
 Water::Water() {
 	const char *ofc = "org.freedesktop.compiz";
@@ -23,7 +25,9 @@ Water::Water() {
 		g_error_free(error);
 		throw DBusException();
 	}
-	line_proxy = dbus_g_proxy_new_for_name(bus, ofc, "/org/freedesktop/compiz/water/allscreens/line", ofc);
+	char line[256];
+	snprintf(line, sizeof(line), "/org/freedesktop/compiz/water/screen%d/line", DefaultScreen(dpy));
+	line_proxy = dbus_g_proxy_new_for_name(bus, ofc, line, ofc);
 }
 
 void Water::draw(Point p, Point q) {