From: Sung-Jin Park Date: Mon, 19 Jun 2017 03:37:11 +0000 (+0900) Subject: doctor: add code to intialize pepper desktop-shell, libinput, udev X-Git-Tag: accepted/tizen/unified/20170703.064025~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F99%2F134499%2F2;p=platform%2Fcore%2Fuifw%2Fpepper.git doctor: add code to intialize pepper desktop-shell, libinput, udev Change-Id: Iea0776fc41f076bedb792eb3c97c86a75a923dbb Signed-off-by: Sung-Jin Park --- diff --git a/configure.ac b/configure.ac index 6b30b21..47de5db 100644 --- a/configure.ac +++ b/configure.ac @@ -241,11 +241,13 @@ if test x$enable_x11 = xyes; then fi # doctor -DOCTOR_REQUIRES="wayland-server pixman-1" +DOCTOR_REQUIRES="wayland-server pixman-1 libudev" PKG_CHECK_MODULES(DOCTOR, [$DOCTOR_REQUIRES]) DOCTOR_CFLAGS="$PEPPER_DIR $PEPPER_DRM_DIR $PEPPER_DESKTOP_SHELL_DIR $DOCTOR_CFLAGS" +DOCTOR_CFLAGS="$PEPPER_LIBINPUT_DIR $DOCTOR_CFLAGS" DOCTOR_LIBS="$PEPPER_LIB $PEPPER_DRM_LIB $PEPPER_DESKTOP_SHELL_LIB $DOCTOR_LIBS" +DOCTOR_LIBS="$PEPPER_LIBINPUT_LIB $PEPPER_LIBINPUT_LIBS $DOCTOR_LIBS" AC_SUBST(DOCTOR_CFLAGS) AC_SUBST(DOCTOR_LIBS) diff --git a/src/bin/doctor/server.c b/src/bin/doctor/server.c index c692feb..165f87a 100644 --- a/src/bin/doctor/server.c +++ b/src/bin/doctor/server.c @@ -28,26 +28,66 @@ #include +#include +#include +#include + int main(int argc, char **argv) { + struct udev *udev = NULL; + pepper_libinput_t *input = NULL; + struct wl_display *display; pepper_compositor_t *compositor; + const char* socket_name = NULL; + + if (!getenv("XDG_RUNTIME_DIR")) + setenv("XDG_RUNTIME_DIR", "/run", 1); + + socket_name = getenv("WAYLAND_DISPLAY"); + + if (!socket_name) + socket_name = "wayland-0"; + + compositor = pepper_compositor_create(socket_name); - compositor = pepper_compositor_create("wayland-0"); if (!compositor) return -1; display = pepper_compositor_get_display(compositor); - if (!display) { + + if (!display) + { pepper_compositor_destroy(compositor); return -1; } + udev = udev_new(); + PEPPER_CHECK(udev, goto shutdown_on_failure, "Failed to get udev !\n"); + + input = pepper_libinput_create(compositor, udev); + PEPPER_CHECK(input, goto shutdown_on_failure, "Failed to create pepepr libinput !\n"); + + if (!pepper_desktop_shell_init(compositor)) + { + PEPPER_ERROR("Failed to initialize pepper desktop shell !\n"); + goto shutdown_on_failure; + } + /* Enter main loop. */ wl_display_run(display); - pepper_compositor_destroy(compositor); +shutdown_on_failure: + + if (input) + pepper_libinput_destroy(input); + + if (udev) + udev_unref(udev); + + if (compositor) + pepper_compositor_destroy(compositor); return 0; }