From: Dana Jansens Date: Thu, 11 Jul 2002 02:17:47 +0000 (+0000) Subject: open an X display X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=426b1ea2b60d4fe1368d318730a0cd098559b896;p=chaz%2Fopenbox open an X display --- diff --git a/util/epist/main.cc b/util/epist/main.cc index 7c7d5840..c7c1a768 100644 --- a/util/epist/main.cc +++ b/util/epist/main.cc @@ -25,6 +25,8 @@ #endif // HAVE_CONFIG_H extern "C" { +#include + #ifdef HAVE_UNISTD_H # include # include @@ -50,6 +52,8 @@ using std::endl; bool _shutdown = false; char **_argv; +char *_display_name = 0; +Display *_display = 0; #ifdef HAVE_SIGACTION static void signalhandler(int sig) @@ -74,6 +78,7 @@ static RETSIGTYPE signalhandler(int sig) #endif // HAVE_SIGACTION } + int main(int, char **argv) { _argv = argv; @@ -98,9 +103,17 @@ int main(int, char **argv) { signal(SIGINT, (RETSIGTYPE (*)(int)) signalhandler); signal(SIGHUP, (RETSIGTYPE (*)(int)) signalhandler); #endif // HAVE_SIGACTION - + + _display = XOpenDisplay(_display_name); + if (! _display) { + cout << "Connection to X server '" << _display_name << "' failed.\n"; + return 1; + } + while (! _shutdown) { usleep(500); } + + XCloseDisplay(_display); return 0; }