Example #1
0
int
main(int argc, char *argv[])
{
	display = wl_display_create();

	if (!display)
		return EXIT_FAILURE;

	if (wl_display_add_socket(display, NULL) != 0)
		return EXIT_FAILURE;

	if (!swc_initialize(display, NULL, &manager))
		return EXIT_FAILURE;

	swc_add_binding(SWC_BINDING_KEY, SWC_MOD_LOGO, XKB_KEY_Return,
	                &spawn, terminal_command);
	swc_add_binding(SWC_BINDING_KEY, SWC_MOD_LOGO, XKB_KEY_r,
	                &spawn, dmenu_command);
	swc_add_binding(SWC_BINDING_KEY, SWC_MOD_LOGO, XKB_KEY_q,
	                &quit, NULL);

	event_loop = wl_display_get_event_loop(display);
	wl_display_run(display);
	wl_display_destroy(display);

	return EXIT_SUCCESS;
}
Example #2
0
File: wlc.c Project: UIKit0/wlc
void
wlc_cleanup(void)
{
   if (wlc.display) {
      wlc_log(WLC_LOG_INFO, "Cleanup wlc");

      // fd process never allocates display
      wlc_compositor_release(&wlc.compositor);
      wl_list_remove(&compositor_listener.link);
      wlc_xwayland_terminate();
      wlc_input_terminate();
      wlc_udev_terminate();
      wlc_fd_terminate();
   }

   // however if main process crashed, fd process does
   // know enough about tty to reset it.
   wlc_tty_terminate();

   if (wlc.display)
      wl_display_destroy(wlc.display);

   // reset te struct, but keep the wlc log state
   FILE *f = wlc.log_file;
   int cached_tm_mday = wlc.cached_tm_mday;
   memset(&wlc, 0, sizeof(wlc));
   wlc_set_log_file(f);
   wlc.cached_tm_mday = cached_tm_mday;
}
Example #3
0
void
wlc_cleanup(void)
{
   if (wlc.display) {
      wlc_log(WLC_LOG_INFO, "Cleanup wlc");

      // fd process never allocates display
      wlc_compositor_release(&wlc.compositor);
      wl_list_remove(&compositor_listener.link);
      wlc_xwayland_terminate();
      wlc_resources_terminate();
      wlc_input_terminate();
      wlc_udev_terminate();
      wlc_fd_terminate();
   }

   // however if main process crashed, fd process does
   // know enough about tty to reset it.
   wlc_tty_terminate();

   if (wlc.display)
      wl_display_destroy(wlc.display);

   memset(&wlc, 0, sizeof(wlc));
}
Example #4
0
QWaylandDisplay::~QWaylandDisplay(void)
{
    close(mFd);
#ifdef QT_WAYLAND_GL_SUPPORT
    delete mEglIntegration;
#endif
    wl_display_destroy(mDisplay);
}
Example #5
0
JNIEXPORT jlong JNICALL
Java_net_jlekstrand_wheatley_wayland_Compositor_createNative(JNIEnv *env,
        jclass cls)
{
    struct wheatley_compositor *wc;

    wc = malloc(sizeof *wc);
    if (wc == NULL) {
        jni_util_throw_by_name(env, "java/lang/OutOfMemoryError", NULL);
        return 0;
    }
    memset(wc, 0, sizeof *wc);

    /* Pass libwlb and libwayland logging through to Android. */
    wlb_log_set_func(wlb_log_android_func);
    wl_debug_set_handler_server(wl_debug_android_func);

    /* XXX: This should be removed at some point */
    setenv("WAYLAND_DEBUG", "server", 1);

    /* XXX: This is hard-coded merely for testing purposes */
    setenv("XDG_RUNTIME_DIR", "/data/data/net.jlekstrand.wheatley/", 1);

    wc->display = wl_display_create();
    if (!wc->display) {
        ALOGD("Failed to create display: %s", strerror(errno));
        goto err_alloc;
    }

    wc->compositor = wlb_compositor_create(wc->display);
    if (!wc->compositor) {
        ALOGD("Failed to create compositor: %s", strerror(errno));
        goto err_display;
    }

    if (wl_display_init_shm(wc->display) < 0) {
        ALOGD("Failed to initialize wl_shm: %s", strerror(errno));
        goto err_compositor;
    }

    wc->wlegl = wlegl_create(wc->compositor);
    if (!wc->wlegl) {
        ALOGD("Failed to initialize android_wlegl: %s", strerror(errno));
        goto err_compositor;
    }

    return (long)(intptr_t)wc;

err_compositor:
    wlb_compositor_destroy(wc->compositor);
err_display:
    wl_display_destroy(wc->display);
err_alloc:
    free(wc);
    jni_util_throw_by_name(env, "java/lang/RuntimeException", NULL);

    return 0;
}
Example #6
0
JNIEXPORT void JNICALL
Java_net_jlekstrand_wheatley_wayland_Compositor_destroyNative(JNIEnv *env,
        jclass cls, jlong nativeHandle)
{
    struct wheatley_compositor *wc =
        (struct wheatley_compositor *)(intptr_t)nativeHandle;

    wlegl_destroy(wc->wlegl);
    wlb_compositor_destroy(wc->compositor);
    wl_display_destroy(wc->display);
    free(wc);
}
Example #7
0
static void
destroy_display(struct display *display)
{
	if (display->shm)
		wl_shm_destroy(display->shm);

	if (display->shell)
		wl_shell_destroy(display->shell);

	if (display->compositor)
		wl_compositor_destroy(display->compositor);

	wl_display_flush(display->display);
	wl_display_destroy(display->display);
	free(display);
}
Example #8
0
static void 
wayland_drm_display_destroy(struct native_display *ndpy)
{
   struct wayland_drm_display *drmdpy = wayland_drm_display(ndpy);

   if (drmdpy->fd)
      close(drmdpy->fd);
   if (drmdpy->wl_drm)
      wl_drm_destroy(drmdpy->wl_drm);
   if (drmdpy->device_name)
      FREE(drmdpy->device_name);
   if (drmdpy->base.configs)
      FREE(drmdpy->base.configs);
   if (drmdpy->base.own_dpy)
      wl_display_destroy(drmdpy->base.dpy);

   ndpy_uninit(ndpy);

   FREE(drmdpy);
}
Example #9
0
/**
 * Called via eglTerminate(), drv->API.Terminate().
 */
static EGLBoolean
dri2_terminate(_EGLDriver *drv, _EGLDisplay *disp)
{
   struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);

   _eglReleaseDisplayResources(drv, disp);
   _eglCleanupDisplay(disp);

   dri2_dpy->core->destroyScreen(dri2_dpy->dri_screen);
   close(dri2_dpy->fd);
   dlclose(dri2_dpy->driver);
   free(dri2_dpy->driver_name);
   free(dri2_dpy->device_name);
   wl_drm_destroy(dri2_dpy->wl_drm);
   if (dri2_dpy->own_device)
      wl_display_destroy(dri2_dpy->wl_dpy);
   free(dri2_dpy);
   disp->DriverData = NULL;

   return EGL_TRUE;
}
Example #10
0
Compositor::~Compositor()
{
    wl_display_destroy(m_display);
}