From 10430c175793f70dd195d684d1ac9bc3e3a21bfe Mon Sep 17 00:00:00 2001 From: Manuel Bachmann Date: Fri, 11 Apr 2014 19:01:17 +0200 Subject: Add the wl-pre utility. Change-Id: I3cfe6e729986296b9412896f79f53505fc9577d9 Signed-off-by: Manuel Bachmann --- packaging/weston-generic.spec | 1 + tz-launcher/Makefile.am | 8 +++++++- tz-launcher/wl-pre.c | 25 +++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 tz-launcher/wl-pre.c diff --git a/packaging/weston-generic.spec b/packaging/weston-generic.spec index 42ae626..f17f393 100644 --- a/packaging/weston-generic.spec +++ b/packaging/weston-generic.spec @@ -151,3 +151,4 @@ ln -sf ../weston-user.service %{_unitdir_user}/default.target.wants/ %defattr(-,root,root) %license tz-launcher/COPYING %{_bindir}/tz-launcher +%{_bindir}/wl-pre diff --git a/tz-launcher/Makefile.am b/tz-launcher/Makefile.am index d7e8eb8..c1ecd64 100644 --- a/tz-launcher/Makefile.am +++ b/tz-launcher/Makefile.am @@ -10,7 +10,7 @@ AM_CPPFLAGS = \ CLEANFILES = -bin_PROGRAMS += tz-launcher +bin_PROGRAMS += tz-launcher wl-pre tz_launcher_LDFLAGS = -export-dynamic tz_launcher_CPPFLAGS = $(AM_CPPFLAGS) @@ -28,3 +28,9 @@ tz_launcher_SOURCES = \ toytoolkit/text-cursor-position-protocol.c \ toytoolkit/workspaces-protocol.c \ toytoolkit/window.c + +wl_pre_LDFLAGS = -export-dynamic +wl_pre_CFLAGS = $(GCC_CFLAGS) $(CLIENT_CFLAGS) +wl_pre_LDADD = $(DLOPEN_LIBS) $(CLIENT_LIBS) + +wl_pre_SOURCES = wl-pre.c diff --git a/tz-launcher/wl-pre.c b/tz-launcher/wl-pre.c new file mode 100644 index 0000000..275af41 --- /dev/null +++ b/tz-launcher/wl-pre.c @@ -0,0 +1,25 @@ +#include +#include + + +int main (int argc, char *argv[]) +{ + if (argc != 2) { + printf ("Usage : wl-pre \"\"\n"); + return 0; + } + + struct wl_display *display = NULL; + + while (!display) { + display = wl_display_connect (NULL); + sleep (1); + } + + char *command; + asprintf (&command, "%s &", argv[1]); + system (command); + free (command); + + return 0; +} -- cgit v1.2.3