summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2010-09-14 15:53:32 -0400
committerKristian Høgsberg <krh@bitplanet.net>2010-09-14 15:54:02 -0400
commitc5dcb90d2a0d4c31b54b8aa1a91e7b243f9b983b (patch)
treee369f75a5b67c11f6b3cd78ec3a9b05eef86ba1c
parent2cd5144fa554b408664310aa9bea2a76bd939103 (diff)
Use scanner for screenshooter protocol
-rw-r--r--compositor/Makefile9
-rw-r--r--compositor/screenshooter.c25
-rw-r--r--compositor/screenshooter.xml7
3 files changed, 22 insertions, 19 deletions
diff --git a/compositor/Makefile b/compositor/Makefile
index a17d414..f31c9ee 100644
--- a/compositor/Makefile
+++ b/compositor/Makefile
@@ -10,8 +10,17 @@ compositor : \
compositor-drm.o \
compositor-x11.o \
screenshooter.o \
+ screenshooter-protocol.o \
drm.o
+screenshooter.c : screenshooter-server-protocol.h
+
+screenshooter-protocol.c : screenshooter.xml
+ ../wayland/scanner code < $< > $@
+
+screenshooter-server-protocol.h : screenshooter.xml
+ ../wayland/scanner server-header < $< > $@
+
clean :
rm -f compositor *.o .*.deps
diff --git a/compositor/screenshooter.c b/compositor/screenshooter.c
index aa7788e..c1716ec 100644
--- a/compositor/screenshooter.c
+++ b/compositor/screenshooter.c
@@ -21,18 +21,15 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "compositor.h"
+#include "screenshooter-server-protocol.h"
-struct screenshooter {
+struct wl_screenshooter {
struct wl_object base;
struct wlsc_compositor *ec;
};
-struct screenshooter_interface {
- void (*shoot)(struct wl_client *client, struct screenshooter *shooter);
-};
-
static void
-screenshooter_shoot(struct wl_client *client, struct screenshooter *shooter)
+screenshooter_shoot(struct wl_client *client, struct wl_screenshooter *shooter)
{
struct wlsc_compositor *ec = shooter->ec;
struct wlsc_output *output;
@@ -70,30 +67,20 @@ screenshooter_shoot(struct wl_client *client, struct screenshooter *shooter)
}
}
-static const struct wl_message screenshooter_methods[] = {
- { "shoot", "", NULL }
-};
-
-static const struct wl_interface screenshooter_interface = {
- "screenshooter", 1,
- ARRAY_LENGTH(screenshooter_methods),
- screenshooter_methods,
-};
-
-struct screenshooter_interface screenshooter_implementation = {
+struct wl_screenshooter_interface screenshooter_implementation = {
screenshooter_shoot
};
void
screenshooter_create(struct wlsc_compositor *ec)
{
- struct screenshooter *shooter;
+ struct wl_screenshooter *shooter;
shooter = malloc(sizeof *shooter);
if (shooter == NULL)
return;
- shooter->base.interface = &screenshooter_interface;
+ shooter->base.interface = &wl_screenshooter_interface;
shooter->base.implementation =
(void(**)(void)) &screenshooter_implementation;
shooter->ec = ec;
diff --git a/compositor/screenshooter.xml b/compositor/screenshooter.xml
new file mode 100644
index 0000000..f8d993d
--- /dev/null
+++ b/compositor/screenshooter.xml
@@ -0,0 +1,7 @@
+<protocol name="screenshooter">
+
+ <interface name="screenshooter" version="1">
+ <request name="shoot"/>
+ </interface>
+
+</protocol>