Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Checking connection to X Server  (Read 1276 times)

0 Members and 1 Guest are viewing this topic.

EvilSakray

  • Newbie
  • *
  • Posts: 2
    • View Profile
Checking connection to X Server
« on: March 18, 2012, 05:59:35 pm »
Hello,

I'd like to know if SFML (1.6) offers any way of checking if DISPLAY environnement of execution shell is properly setted before trying opening a Window.

(env -u DISPLAY / env -i or any invalid value result in an instant segfault.)

Thanks  :wink:

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Checking connection to X Server
« Reply #1 on: March 18, 2012, 06:07:39 pm »
No, but since it's platform specific you can use platform specific code. Include <Xlib.h> and check whether XOpenDisplay returns NULL or a valid result.
Laurent Gomila - SFML developer

EvilSakray

  • Newbie
  • *
  • Posts: 2
    • View Profile
Checking connection to X Server
« Reply #2 on: March 18, 2012, 11:29:04 pm »
Thanks, worked like a charm  :wink: