Skip to content

Commit

Permalink
Merge pull request #53 from dreua/handle_xdisplay_null
Browse files Browse the repository at this point in the history
Handle xdisplay null
  • Loading branch information
cnlohr authored Feb 7, 2019
2 parents f50885b + ed1f85a commit afcc565
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
10 changes: 7 additions & 3 deletions CNFGXDriver.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,8 @@ void CNFGSetupFullscreen( const char * WindowName, int screen_no )
int screen = XDefaultScreen(CNFGDisplay);
int xpos, ypos;

if (!XShapeQueryExtension(CNFGDisplay, &event_basep, &error_basep))
{
fprintf( stderr, "X-Server does not support shape extension" );
if (!XShapeQueryExtension(CNFGDisplay, &event_basep, &error_basep)) {
fprintf( stderr, "X-Server does not support shape extension\n" );
exit( 1 );
}

Expand Down Expand Up @@ -164,6 +163,11 @@ void CNFGTearDown()
void CNFGSetup( const char * WindowName, int w, int h )
{
CNFGDisplay = XOpenDisplay(NULL);
if ( !CNFGDisplay ) {
fprintf( stderr, "Could not get an X Display.\n%s",
"Are you in text mode or using SSH without X11-Forwarding?\n" );
exit( 1 );
}
atexit( CNFGTearDown );
XGetWindowAttributes( CNFGDisplay, RootWindow(CNFGDisplay, 0), &CNFGWinAtt );

Expand Down
6 changes: 0 additions & 6 deletions cnping.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ uint64_t globalrx;
uint64_t globallost;
uint8_t pattern[8];

int runargc;
char ** runargv;

#define PINGCYCLEWIDTH 8192
#define TIMEOUT 4

Expand Down Expand Up @@ -636,9 +633,6 @@ int main( int argc, const char ** argv )
}
#endif

runargc = argc;
runargv = argv;

pingperiodseconds = 0.02;
ExtraPingSize = 0;
title[0] = 0;
Expand Down

0 comments on commit afcc565

Please sign in to comment.