Check for ENV: DISPLAY


#1

I think it’s a good idea to check on START_JUCE_APPLICATION that DISPLAY environment is set and show a error message “You must run this application in graphical mode or DISPLAY isn’t set up correctly” if it fails.


#2

At the moment it just uses a default if that setting isn’t found. What’s the problem that you’re hitting?


#3

Some user tried to start the application in the login prompt (with no X running by that time).
Usually X based application throw something like “DISPLAY is not set” so the user can figure this out (at least if proficient in Linux).
Juce based application don’t says anything but hit an assertion failure (in Desktop.cpp, with the monitorClipped something…).
So to the user point of view, the software is broken.


#4

But it can actually run without a display - have a look in juce_linux_Messaging.cpp, line 250ish. This sounds like the sort of check that might be best done in your app, rather than me making the assumption that it should just exit if it can’t open a display - that’d probably break some people’s apps.


#5

Yes I know this.
The fact is that I don’t have any place where I can currently can act before I get the assertion failure.
initialise_GUI abort as you said, but then setDefaultLookAndFeel create a Desktop instance, which in turns calls refreshMonitorSizes (where I get the jassert).

After this (if passing the assert), initialise is called.


#6

Ok, so if I just removed the assertion, you’d be able to check the env variable in your initialise routine?


#7

Yes. Let’s do it this way.