mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-03-27 07:58:47 -04:00
Use scanner for screenshooter protocol
This commit is contained in:
parent
2cd5144fa5
commit
c5dcb90d2a
3 changed files with 22 additions and 19 deletions
|
|
@ -10,8 +10,17 @@ compositor : \
|
||||||
compositor-drm.o \
|
compositor-drm.o \
|
||||||
compositor-x11.o \
|
compositor-x11.o \
|
||||||
screenshooter.o \
|
screenshooter.o \
|
||||||
|
screenshooter-protocol.o \
|
||||||
drm.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 :
|
clean :
|
||||||
rm -f compositor *.o .*.deps
|
rm -f compositor *.o .*.deps
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,18 +21,15 @@
|
||||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||||
|
|
||||||
#include "compositor.h"
|
#include "compositor.h"
|
||||||
|
#include "screenshooter-server-protocol.h"
|
||||||
|
|
||||||
struct screenshooter {
|
struct wl_screenshooter {
|
||||||
struct wl_object base;
|
struct wl_object base;
|
||||||
struct wlsc_compositor *ec;
|
struct wlsc_compositor *ec;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct screenshooter_interface {
|
|
||||||
void (*shoot)(struct wl_client *client, struct screenshooter *shooter);
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
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_compositor *ec = shooter->ec;
|
||||||
struct wlsc_output *output;
|
struct wlsc_output *output;
|
||||||
|
|
@ -70,30 +67,20 @@ screenshooter_shoot(struct wl_client *client, struct screenshooter *shooter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wl_message screenshooter_methods[] = {
|
struct wl_screenshooter_interface screenshooter_implementation = {
|
||||||
{ "shoot", "", NULL }
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct wl_interface screenshooter_interface = {
|
|
||||||
"screenshooter", 1,
|
|
||||||
ARRAY_LENGTH(screenshooter_methods),
|
|
||||||
screenshooter_methods,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct screenshooter_interface screenshooter_implementation = {
|
|
||||||
screenshooter_shoot
|
screenshooter_shoot
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
screenshooter_create(struct wlsc_compositor *ec)
|
screenshooter_create(struct wlsc_compositor *ec)
|
||||||
{
|
{
|
||||||
struct screenshooter *shooter;
|
struct wl_screenshooter *shooter;
|
||||||
|
|
||||||
shooter = malloc(sizeof *shooter);
|
shooter = malloc(sizeof *shooter);
|
||||||
if (shooter == NULL)
|
if (shooter == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
shooter->base.interface = &screenshooter_interface;
|
shooter->base.interface = &wl_screenshooter_interface;
|
||||||
shooter->base.implementation =
|
shooter->base.implementation =
|
||||||
(void(**)(void)) &screenshooter_implementation;
|
(void(**)(void)) &screenshooter_implementation;
|
||||||
shooter->ec = ec;
|
shooter->ec = ec;
|
||||||
|
|
|
||||||
7
compositor/screenshooter.xml
Normal file
7
compositor/screenshooter.xml
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
<protocol name="screenshooter">
|
||||||
|
|
||||||
|
<interface name="screenshooter" version="1">
|
||||||
|
<request name="shoot"/>
|
||||||
|
</interface>
|
||||||
|
|
||||||
|
</protocol>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue