<div dir="ltr">It looks definitely better this way, and would really be useful. Advocating for this patch to be merged (eventually after the 1.5 release if the feature freeze blocks).<br><br>Regards,<br>Manuel<br></div><div class="gmail_extra">
<br><br><div class="gmail_quote">2014-05-02 15:53 GMT+02:00 Jason Ekstrand <span dir="ltr"><<a href="mailto:jason@jlekstrand.net" target="_blank">jason@jlekstrand.net</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Yeah, this looks better.<br><br>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net" target="_blank">jason@jlekstrand.net</a>><br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra">
<br><br><div class="gmail_quote">On Fri, May 2, 2014 at 4:01 AM, Andrew Wedgbury <span dir="ltr"><<a href="mailto:andrew.wedgbury@realvnc.com" target="_blank">andrew.wedgbury@realvnc.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I've updated this based on comments, simplifying the command handling.<br>
<div><br>
Currently the screen-share module uses a hard-coded command to start the<br>
fullscreen shell server. This patch causes the module to read the command from<br>
the weston config file (from the "command" key in the "screen-share" section).<br>
The default value remains the same (i.e. to run weston with the RDP backend and<br>
fullscreen shell), but is now located in the weston config file.<br>
<br>
As well as allowing the arguments to the fullscreen shell server to be changed,<br>
this also permits an alternative fullscreen shell server to be used if required,<br>
without needing to recompile. Since the command is run as the user running<br>
weston, this should not pose any additional security risk.<br>
<br>
</div>Signed-off-by: Andrew Wedgbury <<a href="mailto:andrew.wedgbury@realvnc.com" target="_blank">andrew.wedgbury@realvnc.com</a>><br>
---<br>
src/screen-share.c | 44 ++++++++++++++++++++++++++++++--------------<br>
<a href="http://weston.ini.in" target="_blank">weston.ini.in</a> | 3 +++<br>
2 files changed, 33 insertions(+), 14 deletions(-)<br>
<br>
diff --git a/src/screen-share.c b/src/screen-share.c<br>
index 6f60b81..f9dcba1 100644<br>
<div>--- a/src/screen-share.c<br>
+++ b/src/screen-share.c<br>
@@ -32,6 +32,7 @@<br>
#include <signal.h><br>
#include <linux/input.h><br>
#include <errno.h><br>
+#include <ctype.h><br>
<br>
#include <wayland-client.h><br>
<br>
@@ -101,6 +102,11 @@ struct ss_shm_buffer {<br>
pixman_image_t *pm_image;<br>
};<br>
<br>
+struct screen_share {<br>
+ struct weston_compositor *compositor;<br>
+ char *command;<br>
+};<br>
+<br>
static void<br>
ss_seat_handle_pointer_enter(void *data, struct wl_pointer *pointer,<br>
uint32_t serial, struct wl_surface *surface,<br>
</div>@@ -982,13 +988,18 @@ shared_output_destroy(struct shared_output *so)<br>
<div> }<br>
<br>
static struct shared_output *<br>
-weston_output_share(struct weston_output *output,<br>
- const char *path, char *const argv[])<br>
+weston_output_share(struct weston_output *output, const char* command)<br>
{<br>
int sv[2];<br>
char str[32];<br>
pid_t pid;<br>
sigset_t allsigs;<br>
</div>+ char *const argv[] = {<br>
+ "/bin/sh",<br>
+ "-c",<br>
+ (char*)command,<br>
+ NULL<br>
+ };<br>
<div><br>
if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, sv) < 0) {<br>
weston_log("weston_output_share: socketpair failed: %m\n");<br>
</div>@@ -1025,7 +1036,7 @@ weston_output_share(struct weston_output *output,<br>
<div> snprintf(str, sizeof str, "%d", sv[1]);<br>
setenv("WAYLAND_SERVER_SOCKET", str, 1);<br>
<br>
- execv(path, argv);<br>
</div>+ execv(argv[0], argv);<br>
<div> weston_log("weston_output_share: exec failed: %m\n");<br>
abort();<br>
} else {<br>
</div>@@ -1056,7 +1067,7 @@ share_output_binding(struct weston_seat *seat, uint32_t time, uint32_t key,<br>
<div> void *data)<br>
{<br>
struct weston_output *output;<br>
- const char *path = BINDIR "/weston";<br>
+ struct screen_share *ss = data;<br>
<br>
if (!seat->pointer) {<br>
weston_log("Cannot pick output: Seat does not have pointer\n");<br>
</div>@@ -1071,23 +1082,28 @@ share_output_binding(struct weston_seat *seat, uint32_t time, uint32_t key,<br>
<div> return;<br>
}<br>
<br>
- char *const argv[] = {<br>
- "weston",<br>
- "--backend=rdp-backend.so",<br>
- "--shell=fullscreen-shell.so",<br>
- "--no-clients-resize",<br>
- NULL<br>
- };<br>
-<br>
- weston_output_share(output, path, argv);<br>
+ weston_output_share(output, ss->command);<br>
}<br>
<br>
</div><div> WL_EXPORT int<br>
module_init(struct weston_compositor *compositor,<br>
int *argc, char *argv[])<br>
{<br>
+ struct screen_share *ss;<br>
+ struct weston_config_section *section;<br>
+<br>
+ ss = zalloc(sizeof *ss);<br>
+ if (ss == NULL)<br>
+ return -1;<br>
+ ss->compositor = compositor;<br>
+<br>
+ section = weston_config_get_section(compositor->config, "screen-share",<br>
+ NULL, NULL);<br>
+<br>
+ weston_config_section_get_string(section, "command", &ss->command, "");<br>
</div><div><div>+<br>
weston_compositor_add_key_binding(compositor, KEY_S,<br>
MODIFIER_CTRL | MODIFIER_ALT,<br>
- share_output_binding, compositor);<br>
+ share_output_binding, ss);<br>
return 0;<br>
}<br>
diff --git a/<a href="http://weston.ini.in" target="_blank">weston.ini.in</a> b/<a href="http://weston.ini.in" target="_blank">weston.ini.in</a><br>
index 2c39177..1f216a7 100644<br>
--- a/<a href="http://weston.ini.in" target="_blank">weston.ini.in</a><br>
+++ b/<a href="http://weston.ini.in" target="_blank">weston.ini.in</a><br>
@@ -65,3 +65,6 @@ path=@libexecdir@/weston-keyboard<br>
#constant_accel_factor = 50<br>
#min_accel_factor = 0.16<br>
#max_accel_factor = 1.0<br>
+<br>
+[screen-share]<br>
+command=@bindir@/weston --backend=rdp-backend.so --shell=fullscreen-shell.so --no-clients-resize<br>
--<br>
1.9.2<br>
<br>
_______________________________________________<br>
wayland-devel mailing list<br>
<a href="mailto:wayland-devel@lists.freedesktop.org" target="_blank">wayland-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
</div></div></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
wayland-devel mailing list<br>
<a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr"><font>Regards,<br>
<br>
<i><b>Manuel BACHMANN</b><br>
Tizen Project<br>
VANNES-FR</i><br>
</font></div>
</div>