how to send data to Xorg.log and XQueryPointer crash
First Last
begre1929 at yahoo.com
Tue May 21 08:09:24 PDT 2013
Hi,
I try to get the position of my pointer, I tried whit this code :
#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);
// where is my mouse ?
int mousex, mousey;
XQueryPointer(dpy,rootwin,None,None,&mousex,&mousey,None,None,None); // problem...
while(stop==0) {
XNextEvent(dpy, &e);
if(e.type==Expose && e.xexpose.count<1) {
XFlush(dpy);
}
switch(e.type){
case KeyRelease : stop=1;break;
}
}
XFreeCursor(dpy,theCursor);
XCloseDisplay(dpy);
return 0;
}
but, when I'm running it, X exits without complains.
also, there is a function like fprintf to write directly to xorg.log through xlib ?
-Nicoo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg/attachments/20130521/4df1a356/attachment.html>
More information about the xorg
mailing list