--- mcore-src/trunk/mcore-tools/src/xinfo.c 2013/09/27 08:40:17 2100 +++ mcore-src/trunk/mcore-tools/src/xinfo.c 2013/09/27 10:34:07 2101 @@ -1,4 +1,4 @@ -// code grabbed from: +// original code grabbed from: // http://surfingtroves.blogspot.de/2011/01/how-to-get-screen-resolution-in-linux-c.html // ----------------------------------------------------------- @@ -12,11 +12,15 @@ { Display* pdsp = XOpenDisplay(NULL); + if (! pdsp) { + printf("No display found!\n"); + return 1; + } Window wid = DefaultRootWindow(pdsp); Screen* pwnd = DefaultScreenOfDisplay(pdsp); int sid = DefaultScreen(pdsp); - + XWindowAttributes xwAttr; XGetWindowAttributes(pdsp,wid,&xwAttr); @@ -26,16 +30,13 @@ xwAttr.x, xwAttr.y, xwAttr.width, xwAttr.height); */ - //printf("%dx%d\n", xwAttr.width, xwAttr.height); - printf("xorg_witdh=%d\n", xwAttr.width); + printf("xorg_width=%d\n", xwAttr.width); printf("xorg_height=%d\n", xwAttr.height); XCloseDisplay( pdsp ); - - return 1; -} + return 0; +} /* gcc -o $@ $< -lX11 */ /* set ts=4 sts=4 tw=100 sw=4 */ -