--- a/src/Fl_x.cxx
+++ b/src/Fl_x.cxx
@@ -2211,6 +2211,7 @@
   static int result = -1;

   if (result == -1) {
+    fl_open_display();
     result = 0;
     unsigned long nitems;
     unsigned long *words = 0;
