remove wl screenshooter protocol

this should never have existed, as it makes no sense for a compositor to
use protocol in order to allow itself to take screenshots
devs/bu5hm4n/meson_wip
Mike Blumenkrantz 5 years ago
parent f605dd6441
commit 3055c0ecae
  1. 3
      src/bin/Makefile.mk
  2. 6
      src/bin/e_comp_wl.h
  3. 69
      src/bin/e_comp_wl_extensions.c
  4. 37
      src/modules/wl_drm/e_mod_main.c
  5. 12
      src/protocol/screenshooter.xml

@ -440,8 +440,6 @@ src/bin/generated/session-recovery-protocol.c \
src/bin/generated/session-recovery-server-protocol.h \
src/bin/generated/www-protocol.c \
src/bin/generated/www-server-protocol.h \
src/bin/generated/screenshooter-protocol.c \
src/bin/generated/screenshooter-server-protocol.h \
src/bin/generated/xdg-foreign-unstable-v1-protocol.c \
src/bin/generated/xdg-foreign-unstable-v1-server-protocol.h \
src/bin/generated/relative-pointer-unstable-v1-protocol.c \
@ -450,7 +448,6 @@ src/bin/generated/pointer-constraints-unstable-v1-protocol.c \
src/bin/generated/pointer-constraints-unstable-v1-server-protocol.h
src/bin/e_comp_wl_extensions.c: \
src/bin/generated/screenshooter-server-protocol.h \
src/bin/generated/session-recovery-server-protocol.h \
src/bin/generated/xdg-foreign-unstable-v1-protocol.c \
src/bin/generated/xdg-foreign-unstable-v1-server-protocol.h \

@ -97,12 +97,6 @@ struct _E_Comp_Wl_Subsurf_Data
typedef struct E_Comp_Wl_Extension_Data
{
struct
{
struct wl_global *global;
struct wl_client *client;
void (*read_pixels)(E_Comp_Wl_Output *output, void *pixels);
} screenshooter;
struct
{
struct wl_global *global;

@ -3,7 +3,6 @@
#include <uuid.h>
#include "screenshooter-server-protocol.h"
#include "session-recovery-server-protocol.h"
#include "www-server-protocol.h"
#include "xdg-foreign-unstable-v1-server-protocol.h"
@ -132,67 +131,6 @@ _e_comp_wl_session_recovery_destroy_uuid(struct wl_client *client EINA_UNUSED, s
e_remember_apply(ec->sr_remember, ec);
}
static void
_e_comp_wl_screenshooter_cb_shoot(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *output_resource, struct wl_resource *buffer_resource)
{
E_Comp_Wl_Output *output;
E_Comp_Wl_Buffer *buffer;
struct wl_shm_buffer *shm_buffer;
int stride;
void *pixels, *d;
output = wl_resource_get_user_data(output_resource);
buffer = e_comp_wl_buffer_get(buffer_resource);
if (!buffer)
{
wl_resource_post_no_memory(resource);
return;
}
if ((buffer->w < output->w) || (buffer->h < output->h))
{
ERR("Buffer size less than output");
/* send done with bad buffer error */
return;
}
stride = buffer->w * sizeof(int);
pixels = malloc(stride * buffer->h);
if (!pixels)
{
/* send done with bad buffer error */
ERR("Could not allocate space for destination");
return;
}
if (e_comp_wl->extensions->screenshooter.read_pixels)
e_comp_wl->extensions->screenshooter.read_pixels(output, pixels);
shm_buffer = wl_shm_buffer_get(buffer->resource);
if (!shm_buffer)
{
ERR("Could not get shm_buffer from resource");
return;
}
stride = wl_shm_buffer_get_stride(shm_buffer);
d = wl_shm_buffer_get_data(shm_buffer);
if (!d)
{
ERR("Could not get buffer data");
return;
}
wl_shm_buffer_begin_access(shm_buffer);
memcpy(d, pixels, buffer->h * stride);
wl_shm_buffer_end_access(shm_buffer);
free(pixels);
zwp_screenshooter_send_done(resource);
}
static void
_e_comp_wl_www_surface_del(struct wl_resource *res)
{
@ -639,11 +577,6 @@ static const struct zwp_e_session_recovery_interface _e_session_recovery_interfa
_e_comp_wl_session_recovery_destroy_uuid,
};
static const struct zwp_screenshooter_interface _e_screenshooter_interface =
{
_e_comp_wl_screenshooter_cb_shoot
};
static const struct www_interface _e_www_interface =
{
_e_comp_wl_www_cb_create
@ -691,7 +624,6 @@ _e_comp_wl_##NAME##_cb_bind(struct wl_client *client, void *data EINA_UNUSED, ui
}
GLOBAL_BIND_CB(session_recovery, zwp_e_session_recovery_interface)
GLOBAL_BIND_CB(screenshooter, zwp_screenshooter_interface)
GLOBAL_BIND_CB(www, www_interface)
GLOBAL_BIND_CB(zxdg_exporter_v1, zxdg_exporter_v1_interface)
GLOBAL_BIND_CB(zxdg_importer_v1, zxdg_importer_v1_interface)
@ -736,7 +668,6 @@ e_comp_wl_extensions_init(void)
/* try to add session_recovery to wayland globals */
GLOBAL_CREATE_OR_RETURN(session_recovery, zwp_e_session_recovery_interface, 1);
GLOBAL_CREATE_OR_RETURN(screenshooter, zwp_screenshooter_interface, 1);
GLOBAL_CREATE_OR_RETURN(www, www_interface, 1);
GLOBAL_CREATE_OR_RETURN(zxdg_exporter_v1, zxdg_exporter_v1_interface, 1);
e_comp_wl->extensions->zxdg_exporter_v1.surfaces = eina_hash_string_superfast_new(NULL);

@ -684,41 +684,6 @@ _drm2_key_up(Ecore_Event_Key *ev)
return EINA_FALSE;
}
static void
_drm2_read_pixels(E_Comp_Wl_Output *output, void *pixels)
{
Ecore_Drm2_Device *dev;
Ecore_Drm2_Output *out;
Ecore_Drm2_Fb *fb;
int i = 0, bstride;
unsigned char *s, *d = pixels;
unsigned int fstride = 0;
void *data;
dev = ecore_evas_data_get(e_comp->ee, "device");
if (!dev) return;
out = ecore_drm2_output_find(dev, output->x, output->y);
if (!out) return;
fb = ecore_drm2_output_latest_fb_get(out);
if (!fb) return;
data = ecore_drm2_fb_data_get(fb);
fstride = ecore_drm2_fb_stride_get(fb);
bstride = output->w * sizeof(int);
for (i = output->y; i < output->y + output->h; i++)
{
s = data;
s += (fstride * i) + (output->x * sizeof(int));
memcpy(d, s, (output->w * sizeof(int)));
d += bstride;
}
}
static Eina_Bool
_drm_randr_available(void)
{
@ -856,8 +821,6 @@ e_modapi_init(E_Module *m)
if (!e_comp_wl_init()) return NULL;
if (!e_comp_canvas_init(w, h)) return NULL;
e_comp_wl->extensions->screenshooter.read_pixels = _drm2_read_pixels;
ecore_evas_pointer_xy_get(e_comp->ee, &e_comp_wl->ptr.x,
&e_comp_wl->ptr.y);
evas_event_feed_mouse_in(e_comp->evas, 0, NULL);

@ -1,12 +0,0 @@
<protocol name="screenshooter">
<interface name="zwp_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>
Loading…
Cancel
Save