Fatal IO Error: 11 (resource temporarily unavailable)
First Last
begre1929 at yahoo.com
Mon May 20 09:04:50 PDT 2013
I still don't know why the "hello world" code does not working as I expect. But I write a piece of code who works as expected. I'm not sure that's well written, (if someone want to take a look). Mouse pointer is rendered, when a button is pressed or when a key is release the while loop is stoped.
#include<X11/Xlib.h>
#include<X11/cursorfont.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define DPYW DisplayWidth(dpy,scr)
#define DPYH DisplayHeight(dpy,scr)
int main(int argc, char *argv[]){
Display *dpy;
int scr, stop=0;
Window rootwin;
Window wbg;
XEvent e;
Cursor theCursor;
dpy = XOpenDisplay(NULL);
scr=DefaultScreen(dpy);
rootwin=RootWindow(dpy, scr);
wbg=XCreateSimpleWindow(dpy,rootwin,0,0,
DPYW,DPYH,0,
BlackPixel(dpy,
scr),
BlackPixel(dpy, scr) );
XStoreName(dpy, wbg, "background");
XSelectInput(dpy, wbg, ExposureMask|KeyPressMask|KeyReleaseMask|ButtonPressMask|ButtonReleaseMask);
XMapWindow(dpy, wbg);
theCursor = XCreateFontCursor(dpy, XC_left_ptr);
XDefineCursor(dpy,wbg,theCursor);
while(stop==0) {
XNextEvent(dpy, &e);
if(e.type==Expose
&& e.xexpose.count<1) {
XFlush(dpy);
}
switch(e.type){
case KeyRelease : stop=1;break;
case ButtonPress : stop=1;break;
}
}
XFreeCursor(dpy,theCursor);
XCloseDisplay(dpy);
return 0;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg/attachments/20130520/58248fb8/attachment.html>
More information about the xorg
mailing list