From: Kristian Høgsberg Date: Tue, 14 Sep 2010 20:23:24 +0000 (-0400) Subject: Use scanner to generate screenshooter client code as well X-Git-Tag: 0.85.0~416 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3dd66d66a39453d48c7ef4ec85c1d02e66088846;p=platform%2Fupstream%2Fwayland.git Use scanner to generate screenshooter client code as well --- diff --git a/clients/Makefile b/clients/Makefile index 222a7ae..c85b250 100644 --- a/clients/Makefile +++ b/clients/Makefile @@ -13,12 +13,20 @@ clean : flower : flower.o window.o wayland-glib.o cairo-util.o gears : gears.o window.o wayland-glib.o cairo-util.o -screenshot : screenshot.o wayland-glib.o cairo-util.o +screenshot : screenshot.o screenshooter-protocol.o wayland-glib.o cairo-util.o terminal : terminal.o window.o wayland-glib.o cairo-util.o image : image.o window.o wayland-glib.o cairo-util.o view : view.o window.o wayland-glib.o cairo-util.o dnd : dnd.o window.o wayland-glib.o cairo-util.o +screenshoot.c : screenshooter-client-protocol.h + +screenshooter-protocol.c : ../compositor/screenshooter.xml + ../wayland/scanner code < $< > $@ + +screenshooter-client-protocol.h : ../compositor/screenshooter.xml + ../wayland/scanner client-header < $< > $@ + terminal : LDLIBS += -lutil view : CFLAGS += $(POPPLER_CFLAGS) view : LDLIBS += $(POPPLER_LIBS) diff --git a/clients/screenshot.c b/clients/screenshot.c index 4891fd7..e9fa5aa 100644 --- a/clients/screenshot.c +++ b/clients/screenshot.c @@ -29,6 +29,7 @@ #include "wayland-client.h" #include "wayland-glib.h" +#include "screenshooter-client-protocol.h" /* The screenshooter is a good example of a custom object exposed by * the compositor and serves as a test bed for implementing client @@ -36,36 +37,14 @@ static const char socket_name[] = "\0wayland"; -#define SCREENSHOOTER_SHOOT 0 - -struct screenshooter; - -static const struct wl_message screenshooter_requests[] = { - { "shoot", "" }, -}; - -static const struct wl_interface screenshooter_interface = { - "screenshooter", 1, - ARRAY_LENGTH(screenshooter_requests), screenshooter_requests, - 0, NULL -}; - -static inline void -screenshooter_shoot(struct screenshooter *shooter) -{ - wl_proxy_marshal((struct wl_proxy *) shooter, SCREENSHOOTER_SHOOT); -} - static void handle_global(struct wl_display *display, uint32_t id, const char *interface, uint32_t version, void *data) { - struct screenshooter **screenshooter = data; + struct wl_screenshooter **screenshooter = data; if (strcmp(interface, "screenshooter") == 0) - *screenshooter = (struct screenshooter *) - wl_proxy_create_for_id(display, - &screenshooter_interface, id); + *screenshooter = wl_screenshooter_create(display, id); } int main(int argc, char *argv[]) @@ -73,7 +52,7 @@ int main(int argc, char *argv[]) struct wl_display *display; GMainLoop *loop; GSource *source; - struct screenshooter *screenshooter; + struct wl_screenshooter *screenshooter; display = wl_display_create(socket_name, sizeof socket_name); if (display == NULL) { @@ -93,7 +72,7 @@ int main(int argc, char *argv[]) source = wl_glib_source_new(display); g_source_attach(source, NULL); - screenshooter_shoot(screenshooter); + wl_screenshooter_shoot(screenshooter); g_idle_add((GSourceFunc) g_main_loop_quit, loop); g_main_loop_run(loop);