Example #1
0
NativeStateWayland::~NativeStateWayland()
{
    if (window_) {
        if (window_->shell_surface)
            wl_shell_surface_destroy(window_->shell_surface);
        if (window_->opaque_reqion)
            wl_region_destroy(window_->opaque_reqion);
        if (window_->surface)
            wl_surface_destroy(window_->surface);
        if (window_->native)
            wl_egl_window_destroy(window_->native);
        delete window_;
    }

    if (display_) {
        if (display_->shell)
            wl_shell_destroy(display_->shell);

        for (OutputsVector::iterator it = display_->outputs.begin();
             it != display_->outputs.end(); ++it) {

            wl_output_destroy((*it)->output);
            delete *it;
        }
        if (display_->compositor)
            wl_compositor_destroy(display_->compositor);
        if (display_->registry)
            wl_registry_destroy(display_->registry);
        if (display_->display) {
            wl_display_flush(display_->display);
            wl_display_disconnect(display_->display);
        }
        delete display_;
    }
}
CompositorOutput::~CompositorOutput()
{
  if( mOutput )
  {
    wl_output_destroy( mOutput );
  }
}
Example #3
0
/** Process wl_output global removal
 *
 * \param o The output that was removed from wl_registry.
 */
void
output_remove(struct output *o)
{
	wl_output_destroy(o->proxy);
	o->proxy = NULL;
	output_unref(o);
}
Example #4
0
File: util.cpp Project: nyorain/ny
Output::~Output()
{
    if(wlOutput_)
	{
		if(wl_output_get_version(wlOutput_) > 3) wl_output_release(wlOutput_);
		else wl_output_destroy(wlOutput_);
	}
}
Example #5
0
void 
_ecore_wl_output_del(Ecore_Wl_Output *output) 
{
   if (!output) return;
   if (output->destroy) (*output->destroy)(output, output->data);
   if (output->output) wl_output_destroy(output->output);
   wl_list_remove(&output->link);
   free(output);
}
Example #6
0
static void
gdk_wayland_monitor_finalize (GObject *object)
{
    GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)object;

    wl_output_destroy (monitor->output);

    G_OBJECT_CLASS (gdk_wayland_monitor_parent_class)->finalize (object);
}
Example #7
0
void
Wayland_VideoQuit(_THIS)
{
    SDL_VideoData *data = _this->driverdata;
    int i;

    Wayland_FiniMouse ();

    for (i = 0; i < _this->num_displays; ++i) {
        SDL_VideoDisplay *display = &_this->displays[i];
        wl_output_destroy(display->driverdata);
        display->driverdata = NULL;
    }

    Wayland_display_destroy_input(data);
    Wayland_display_destroy_pointer_constraints(data);
    Wayland_display_destroy_relative_pointer_manager(data);

    if (data->xkb_context) {
        WAYLAND_xkb_context_unref(data->xkb_context);
        data->xkb_context = NULL;
    }
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
    if (data->windowmanager)
        qt_windowmanager_destroy(data->windowmanager);

    if (data->surface_extension)
        qt_surface_extension_destroy(data->surface_extension);

    Wayland_touch_destroy(data);
#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */

    if (data->shm)
        wl_shm_destroy(data->shm);

    if (data->cursor_theme)
        WAYLAND_wl_cursor_theme_destroy(data->cursor_theme);

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

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

    if (data->registry)
        wl_registry_destroy(data->registry);

    if (data->display) {
        WAYLAND_wl_display_flush(data->display);
        WAYLAND_wl_display_disconnect(data->display);
    }

    SDL_free(data->classname);
    free(data);
    _this->driverdata = NULL;
}
static void
mech_monitor_wayland_finalize (GObject *object)
{
  MechMonitorWaylandPriv *priv = ((MechMonitorWayland *) object)->_priv;

  if (priv->wl_output)
    wl_output_destroy (priv->wl_output);

  G_OBJECT_CLASS (mech_monitor_wayland_parent_class)->finalize (object);
}
Example #9
0
static void Close(vlc_object_t *obj)
{
    demux_t *demux = (demux_t *)obj;
    demux_sys_t *sys = demux->p_sys;

    vlc_cancel(sys->thread);
    vlc_join(sys->thread, NULL);

    screenshooter_destroy(sys->screenshooter);
    wl_shm_destroy(sys->shm);
    wl_output_destroy(sys->output);
    wl_display_disconnect(sys->display);
    free(sys);
}
Example #10
0
/**
 * Destroys a Wayland shell surface.
 */
static void Close(vout_window_t *wnd)
{
    vout_window_sys_t *sys = wnd->sys;

    vlc_cancel(sys->thread);
    vlc_join(sys->thread, NULL);

    wl_shell_surface_destroy(sys->shell_surface);
    wl_surface_destroy(wnd->handle.wl);
    wl_shell_destroy(sys->shell);
    if (sys->output != NULL)
        wl_output_destroy(sys->output);
    wl_compositor_destroy(sys->compositor);
    wl_display_disconnect(wnd->display.wl);
    vlc_mutex_destroy(&sys->lock);
    free(sys);
}
Example #11
0
static void
output_destroy(struct output *o)
{
	struct vidmode *v;

	wl_list_remove(&o->link);
	free(o->make);
	free(o->model);

	while (!wl_list_empty(&o->mode_list)) {
		v = wl_container_of(o->mode_list.next, v, link);
		wl_list_remove(&v->link);
		free(v);
	}

	if (o->proxy)
		wl_output_destroy(o->proxy);

	free(o);
}
Example #12
0
/**
 * Creates a Wayland shell surface.
 */
static int Open(vout_window_t *wnd, const vout_window_cfg_t *cfg)
{
    if (cfg->type != VOUT_WINDOW_TYPE_INVALID
     && cfg->type != VOUT_WINDOW_TYPE_WAYLAND)
        return VLC_EGENERIC;

    vout_window_sys_t *sys = malloc(sizeof (*sys));
    if (unlikely(sys == NULL))
        return VLC_ENOMEM;

    sys->compositor = NULL;
    sys->output = NULL;
    sys->shell = NULL;
    sys->shell_surface = NULL;
    sys->top_width = cfg->width;
    sys->top_height = cfg->height;
    sys->fs_width = cfg->width;
    sys->fs_height = cfg->height;
    sys->fullscreen = false;
    vlc_mutex_init(&sys->lock);
    wnd->sys = sys;

    /* Connect to the display server */
    char *dpy_name = var_InheritString(wnd, "wl-display");
    struct wl_display *display = wl_display_connect(dpy_name);

    free(dpy_name);

    if (display == NULL)
    {
        vlc_mutex_destroy(&sys->lock);
        free(sys);
        return VLC_EGENERIC;
    }

    /* Find the interesting singleton(s) */
    struct wl_registry *registry = wl_display_get_registry(display);
    if (registry == NULL)
        goto error;

    wl_registry_add_listener(registry, &registry_cbs, wnd);
    wl_display_roundtrip(display);
    wl_registry_destroy(registry);

    if (sys->compositor == NULL || sys->shell == NULL)
        goto error;

    if (sys->output != NULL)
        wl_output_add_listener(sys->output, &output_cbs, wnd);

    /* Create a surface */
    struct wl_surface *surface = wl_compositor_create_surface(sys->compositor);
    if (surface == NULL)
        goto error;

    struct wl_shell_surface *shell_surface =
        wl_shell_get_shell_surface(sys->shell, surface);
    if (shell_surface == NULL)
        goto error;

    sys->shell_surface = shell_surface;

    wl_shell_surface_add_listener(shell_surface, &shell_surface_cbs, wnd);
    wl_shell_surface_set_class(shell_surface, PACKAGE_NAME);
    wl_shell_surface_set_toplevel(shell_surface);

    char *title = var_InheritString(wnd, "video-title");
    wl_shell_surface_set_title(shell_surface, title ? title
                                                    : _("VLC media player"));
    free(title);

    //if (var_InheritBool (wnd, "keyboard-events"))
    //    do_something();

    wl_display_flush(display);

    wnd->type = VOUT_WINDOW_TYPE_WAYLAND;
    wnd->handle.wl = surface;
    wnd->display.wl = display;
    wnd->control = Control;

    if (vlc_clone (&sys->thread, Thread, wnd, VLC_THREAD_PRIORITY_LOW))
        goto error;

    vout_window_ReportSize(wnd, cfg->width, cfg->height);
    return VLC_SUCCESS;

error:
    if (sys->shell_surface != NULL)
        wl_shell_surface_destroy(sys->shell_surface);
    if (sys->shell != NULL)
        wl_shell_destroy(sys->shell);
    if (sys->output != NULL)
        wl_output_destroy(sys->output);
    if (sys->compositor != NULL)
        wl_compositor_destroy(sys->compositor);
    wl_display_disconnect(display);
    vlc_mutex_destroy(&sys->lock);
    free(sys);
    return VLC_EGENERIC;
}
Example #13
0
static int Open(vlc_object_t *obj)
{
    demux_t *demux = (demux_t *)obj;
    if (demux->out == NULL)
        return VLC_EGENERIC;

    demux_sys_t *sys = malloc(sizeof (*sys));
    if (unlikely(sys == NULL))
        return VLC_ENOMEM;

    /* Connect to the display server */
    char *dpy_name = var_InheritString(demux, "wl-display");
    sys->display = wl_display_connect(dpy_name);
    free(dpy_name);

    if (sys->display == NULL)
    {
        free(sys);
        return VLC_EGENERIC;
    }

    sys->output = NULL;
    sys->shm = NULL;
    sys->screenshooter = NULL;
    sys->es = NULL;
    sys->pagemask = sysconf(_SC_PAGE_SIZE) - 1;
    sys->rate = var_InheritFloat(demux, "screen-fps");
    sys->x = var_InheritInteger(demux, "screen-left");
    sys->y = var_InheritInteger(demux, "screen-top");
    sys->w = var_InheritInteger(demux, "screen-width");
    sys->h = var_InheritInteger(demux, "screen-height");

    if (1000.f * sys->rate <= 0x1.p-30)
        goto error;

    demux->p_sys = sys;

    /* Find the interesting singleton(s) */
    struct wl_registry *registry = wl_display_get_registry(sys->display);
    if (registry == NULL)
        goto error;

    wl_registry_add_listener(registry, &registry_cbs, demux);
    wl_display_roundtrip(sys->display);
    wl_registry_destroy(registry);

    if (sys->output == NULL || sys->shm == NULL || sys->screenshooter == NULL)
    {
        msg_Err(demux, "screenshooter extension not supported");
        goto error;
    }

    wl_output_add_listener(sys->output, &output_cbs, demux);
    screenshooter_add_listener(sys->screenshooter, &screenshooter_cbs,
                               &sys->done);
    wl_display_roundtrip(sys->display);

    if (DisplayError(demux, sys->display))
        goto error;

    /* Initializes demux */
    sys->start = vlc_tick_now();

    if (vlc_clone(&sys->thread, Thread, demux, VLC_THREAD_PRIORITY_INPUT))
        goto error;

    demux->pf_demux = NULL;
    demux->pf_control = Control;
    return VLC_SUCCESS;

error:
    if (sys->screenshooter != NULL)
        screenshooter_destroy(sys->screenshooter);
    if (sys->shm != NULL)
        wl_shm_destroy(sys->shm);
    if (sys->output != NULL)
        wl_output_destroy(sys->output);
    wl_display_disconnect(sys->display);
    free(sys);
    return VLC_EGENERIC;
}
Example #14
0
void _glfwPlatformFreeMonitor(_GLFWmonitor* monitor)
{
    if (monitor->wl.output)
        wl_output_destroy(monitor->wl.output);
}