mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-31 22:25:25 -04:00
Use scanner to generate screenshooter client code as well
This commit is contained in:
parent
c5dcb90d2a
commit
3dd66d66a3
2 changed files with 14 additions and 27 deletions
|
|
@ -13,12 +13,20 @@ clean :
|
||||||
|
|
||||||
flower : flower.o window.o wayland-glib.o cairo-util.o
|
flower : flower.o window.o wayland-glib.o cairo-util.o
|
||||||
gears : gears.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
|
terminal : terminal.o window.o wayland-glib.o cairo-util.o
|
||||||
image : image.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
|
view : view.o window.o wayland-glib.o cairo-util.o
|
||||||
dnd : dnd.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
|
terminal : LDLIBS += -lutil
|
||||||
view : CFLAGS += $(POPPLER_CFLAGS)
|
view : CFLAGS += $(POPPLER_CFLAGS)
|
||||||
view : LDLIBS += $(POPPLER_LIBS)
|
view : LDLIBS += $(POPPLER_LIBS)
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
#include "wayland-client.h"
|
#include "wayland-client.h"
|
||||||
#include "wayland-glib.h"
|
#include "wayland-glib.h"
|
||||||
|
#include "screenshooter-client-protocol.h"
|
||||||
|
|
||||||
/* The screenshooter is a good example of a custom object exposed by
|
/* The screenshooter is a good example of a custom object exposed by
|
||||||
* the compositor and serves as a test bed for implementing client
|
* the compositor and serves as a test bed for implementing client
|
||||||
|
|
@ -36,36 +37,14 @@
|
||||||
|
|
||||||
static const char socket_name[] = "\0wayland";
|
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
|
static void
|
||||||
handle_global(struct wl_display *display, uint32_t id,
|
handle_global(struct wl_display *display, uint32_t id,
|
||||||
const char *interface, uint32_t version, void *data)
|
const char *interface, uint32_t version, void *data)
|
||||||
{
|
{
|
||||||
struct screenshooter **screenshooter = data;
|
struct wl_screenshooter **screenshooter = data;
|
||||||
|
|
||||||
if (strcmp(interface, "screenshooter") == 0)
|
if (strcmp(interface, "screenshooter") == 0)
|
||||||
*screenshooter = (struct screenshooter *)
|
*screenshooter = wl_screenshooter_create(display, id);
|
||||||
wl_proxy_create_for_id(display,
|
|
||||||
&screenshooter_interface, id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
|
@ -73,7 +52,7 @@ int main(int argc, char *argv[])
|
||||||
struct wl_display *display;
|
struct wl_display *display;
|
||||||
GMainLoop *loop;
|
GMainLoop *loop;
|
||||||
GSource *source;
|
GSource *source;
|
||||||
struct screenshooter *screenshooter;
|
struct wl_screenshooter *screenshooter;
|
||||||
|
|
||||||
display = wl_display_create(socket_name, sizeof socket_name);
|
display = wl_display_create(socket_name, sizeof socket_name);
|
||||||
if (display == NULL) {
|
if (display == NULL) {
|
||||||
|
|
@ -93,7 +72,7 @@ int main(int argc, char *argv[])
|
||||||
source = wl_glib_source_new(display);
|
source = wl_glib_source_new(display);
|
||||||
g_source_attach(source, NULL);
|
g_source_attach(source, NULL);
|
||||||
|
|
||||||
screenshooter_shoot(screenshooter);
|
wl_screenshooter_shoot(screenshooter);
|
||||||
|
|
||||||
g_idle_add((GSourceFunc) g_main_loop_quit, loop);
|
g_idle_add((GSourceFunc) g_main_loop_quit, loop);
|
||||||
g_main_loop_run(loop);
|
g_main_loop_run(loop);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue