Skip to content

LV2: currently we need a X11 display since the Gtk Thread is unconditionally started #35

@swesterfeld

Description

@swesterfeld

Using AnklangSynthEngine with LV2 support currently fails without $DISPLAY. This is because LV2 host is a singleton variable that loads gtk2wrap and starts the Gtk thread as soon as its instantiated.

$ ( unset DISPLAY; out/lib/AnklangSynthEngine )
LISTEN: http://127.0.0.1:1777/
[...]

(AnklangSynthEngine:1602159): Gtk-WARNING **: 17:24:01.013: cannot open display: 

The question is of course if the no display case should block the merge? If so, here are two options of how to support no-display, but there may be better solutions:

Option 1

We could disable LV2 support altogether if the Gtk thread could not be started, this has the advantage that it is relatively simple to implement.

Option 2

One way to deal with this would be to try to auto detect whether we have a display. One could use something like gst123 does:

bool
GtkInterface::have_x11_display()
{
  static Display *display = NULL;

  if (!display)
    display = XOpenDisplay (NULL);   // this should work if and only if we do have an X11 server we can use

  return display != NULL;
}

and if that fails, start a thread that is not the Gtk thread in gtk2wrap. Then the LV2 plugins could run in that thread, but any custom UIs would have to be disabled.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions