[PATCH weston 09/10] Rename screenshooter protocol to weston_screenshooter

Jonas Ådahl jadahl at gmail.com
Wed Nov 4 00:49:58 PST 2015


Due to the effort of moving a way from non-prefixed protocols, rename
the weston specific screenshooter protocol to weston_screenshooter.

Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
---
 Makefile.am                       | 14 +++++++-------
 clients/screenshot.c              | 21 +++++++++++++--------
 protocol/screenshooter.xml        | 12 ------------
 protocol/weston-screenshooter.xml | 12 ++++++++++++
 src/screenshooter.c               | 12 ++++++------
 5 files changed, 38 insertions(+), 33 deletions(-)
 delete mode 100644 protocol/screenshooter.xml
 create mode 100644 protocol/weston-screenshooter.xml

diff --git a/Makefile.am b/Makefile.am
index c2e7fcf..580f282 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -113,8 +113,8 @@ systemd_notify_la_SOURCES =			\
 endif
 
 nodist_weston_SOURCES =					\
-	protocol/screenshooter-protocol.c		\
-	protocol/screenshooter-server-protocol.h	\
+	protocol/weston-screenshooter-protocol.c			\
+	protocol/weston-screenshooter-server-protocol.h			\
 	protocol/text-cursor-position-protocol.c	\
 	protocol/text-cursor-position-server-protocol.h	\
 	protocol/text-input-unstable-v1-protocol.c			\
@@ -577,8 +577,8 @@ weston_flower_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
 weston_screenshooter_SOURCES =				\
 	clients/screenshot.c
 nodist_weston_screenshooter_SOURCES =			\
-	protocol/screenshooter-protocol.c		\
-	protocol/screenshooter-client-protocol.h
+	protocol/weston-screenshooter-protocol.c	\
+	protocol/weston-screenshooter-client-protocol.h
 weston_screenshooter_LDADD = $(CLIENT_LIBS) libshared.la
 weston_screenshooter_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
 
@@ -749,8 +749,8 @@ endif
 endif
 
 BUILT_SOURCES +=					\
-	protocol/screenshooter-protocol.c		\
-	protocol/screenshooter-client-protocol.h	\
+	protocol/weston-screenshooter-protocol.c			\
+	protocol/weston-screenshooter-client-protocol.h			\
 	protocol/text-cursor-position-client-protocol.h	\
 	protocol/text-cursor-position-protocol.c	\
 	protocol/text-input-unstable-v1-protocol.c			\
@@ -1341,7 +1341,7 @@ BUILT_SOURCES +=				\
 
 EXTRA_DIST +=					\
 	protocol/weston-desktop-shell.xml	\
-	protocol/screenshooter.xml		\
+	protocol/weston-screenshooter.xml	\
 	protocol/workspaces.xml			\
 	protocol/text-cursor-position.xml	\
 	protocol/weston-test.xml		\
diff --git a/clients/screenshot.c b/clients/screenshot.c
index f11e3ba..18b5f88 100644
--- a/clients/screenshot.c
+++ b/clients/screenshot.c
@@ -36,7 +36,7 @@
 #include <cairo.h>
 
 #include <wayland-client.h>
-#include "screenshooter-client-protocol.h"
+#include "weston-screenshooter-client-protocol.h"
 #include "shared/os-compatibility.h"
 
 /* The screenshooter is a good example of a custom object exposed by
@@ -44,7 +44,7 @@
  * side marshalling outside libwayland.so */
 
 static struct wl_shm *shm;
-static struct screenshooter *screenshooter;
+static struct weston_screenshooter *screenshooter;
 static struct wl_list output_list;
 int min_x, min_y, max_x, max_y;
 int buffer_copy_done;
@@ -118,12 +118,12 @@ static const struct wl_output_listener output_listener = {
 };
 
 static void
-screenshot_done(void *data, struct screenshooter *screenshooter)
+screenshot_done(void *data, struct weston_screenshooter *screenshooter)
 {
 	buffer_copy_done = 1;
 }
 
-static const struct screenshooter_listener screenshooter_listener = {
+static const struct weston_screenshooter_listener screenshooter_listener = {
 	screenshot_done
 };
 
@@ -141,9 +141,10 @@ handle_global(void *data, struct wl_registry *registry,
 		wl_output_add_listener(output->output, &output_listener, output);
 	} else if (strcmp(interface, "wl_shm") == 0) {
 		shm = wl_registry_bind(registry, name, &wl_shm_interface, 1);
-	} else if (strcmp(interface, "screenshooter") == 0) {
+	} else if (strcmp(interface, "weston_screenshooter") == 0) {
 		screenshooter = wl_registry_bind(registry, name,
-						 &screenshooter_interface, 1);
+						 &weston_screenshooter_interface,
+						 1);
 	}
 }
 
@@ -290,7 +291,9 @@ int main(int argc, char *argv[])
 		return -1;
 	}
 
-	screenshooter_add_listener(screenshooter, &screenshooter_listener, screenshooter);
+	weston_screenshooter_add_listener(screenshooter,
+					  &screenshooter_listener,
+					  screenshooter);
 
 	if (set_buffer_size(&width, &height))
 		return -1;
@@ -298,7 +301,9 @@ int main(int argc, char *argv[])
 
 	wl_list_for_each(output, &output_list, link) {
 		output->buffer = create_shm_buffer(output->width, output->height, &output->data);
-		screenshooter_shoot(screenshooter, output->output, output->buffer);
+		weston_screenshooter_shoot(screenshooter,
+					   output->output,
+					   output->buffer);
 		buffer_copy_done = 0;
 		while (!buffer_copy_done)
 			wl_display_roundtrip(display);
diff --git a/protocol/screenshooter.xml b/protocol/screenshooter.xml
deleted file mode 100644
index 76e3c85..0000000
--- a/protocol/screenshooter.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<protocol name="screenshooter">
-
-  <interface name="screenshooter" version="1">
-    <request name="shoot">
-      <arg name="output" type="object" interface="wl_output"/>
-      <arg name="buffer" type="object" interface="wl_buffer"/>
-    </request>
-    <event name="done">
-    </event>
-  </interface>
-
-</protocol>
diff --git a/protocol/weston-screenshooter.xml b/protocol/weston-screenshooter.xml
new file mode 100644
index 0000000..8c4486c
--- /dev/null
+++ b/protocol/weston-screenshooter.xml
@@ -0,0 +1,12 @@
+<protocol name="weston_screenshooter">
+
+  <interface name="weston_screenshooter" version="1">
+    <request name="shoot">
+      <arg name="output" type="object" interface="wl_output"/>
+      <arg name="buffer" type="object" interface="wl_buffer"/>
+    </request>
+    <event name="done">
+    </event>
+  </interface>
+
+</protocol>
diff --git a/src/screenshooter.c b/src/screenshooter.c
index 6e1af65..d0ec00e 100644
--- a/src/screenshooter.c
+++ b/src/screenshooter.c
@@ -34,7 +34,7 @@
 #include <sys/uio.h>
 
 #include "compositor.h"
-#include "screenshooter-server-protocol.h"
+#include "weston-screenshooter-server-protocol.h"
 #include "shared/helpers.h"
 
 #include "wcap/wcap-decode.h"
@@ -223,7 +223,7 @@ screenshooter_done(void *data, enum weston_screenshooter_outcome outcome)
 
 	switch (outcome) {
 	case WESTON_SCREENSHOOTER_SUCCESS:
-		screenshooter_send_done(resource);
+		weston_screenshooter_send_done(resource);
 		break;
 	case WESTON_SCREENSHOOTER_NO_MEMORY:
 		wl_resource_post_no_memory(resource);
@@ -252,7 +252,7 @@ screenshooter_shoot(struct wl_client *client,
 	weston_screenshooter_shoot(output, buffer, screenshooter_done, resource);
 }
 
-struct screenshooter_interface screenshooter_implementation = {
+struct weston_screenshooter_interface screenshooter_implementation = {
 	screenshooter_shoot
 };
 
@@ -264,7 +264,7 @@ bind_shooter(struct wl_client *client,
 	struct wl_resource *resource;
 
 	resource = wl_resource_create(client,
-				      &screenshooter_interface, 1, id);
+				      &weston_screenshooter_interface, 1, id);
 
 	if (client != shooter->client) {
 		wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
@@ -622,9 +622,9 @@ screenshooter_create(struct weston_compositor *ec)
 	shooter->client = NULL;
 
 	shooter->global = wl_global_create(ec->wl_display,
-					   &screenshooter_interface, 1,
+					   &weston_screenshooter_interface, 1,
 					   shooter, bind_shooter);
-	weston_compositor_add_key_binding(ec, KEY_S, MODIFIER_SUPER,
+	weston_compositor_add_key_binding(ec, KEY_S, MODIFIER_CTRL,
 					  screenshooter_binding, shooter);
 	weston_compositor_add_key_binding(ec, KEY_R, MODIFIER_SUPER,
 					  recorder_binding, shooter);
-- 
2.4.3



More information about the wayland-devel mailing list