On Tue, 28 Oct 2003 15:53:39 +0100, Robert Woerle <[EMAIL PROTECTED]> wrote:
>it should work with XSendEvent shoudlnt it ?? I don't know. From what you told me I looked agina in the manuals and it sounds like it should, but it doesn't. Below is the code that I use in my small test programm. It grabs the pointer events andthis works, as I recive all events no matter where I click, but I played around with all settings of XSendEvent and I found no way where the desktop resumed normal operation, as it should. My desktop runs at 1600x1200 this is why I have the if x = 1599. ------------------------------------------- #include <stdio.h> #include <Xlib.h> #include <unistd.h> static int * null_X_error (Display * d, XErrorEvent * e) { static int already = 0; /* The warning is displayed only once */ if (already != 0) return (NULL); already = 1; printf ("\n*** Warning ***\n"); printf ("Please, verify that there is not another program which grabs the mouse\n"); return (NULL); } int main (int argc, char *argv[]) { Display *d; XEvent e; char *dn; long mask; dn = XDisplayName(NULL); if(dn == NULL) printf("Error getting display name\n"); d = XOpenDisplay(dn); if(d == NULL) printf("Error!\n"); XAllowEvents(d, AsyncBoth, CurrentTime); XSelectInput(d, DefaultRootWindow(d), ButtonPressMask | ButtonReleaseMask); XGrabButton (d, AnyButton, AnyModifier, DefaultRootWindow(d), False, ButtonPressMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None); XSetErrorHandler ((XErrorHandler) null_X_error); while(1) { printf("Waiting\n"); XNextEvent(d, &e); printf("Type: %u\n", e.type); mask = NoEventMask; switch (e.type) { case ButtonPress: { if(e.xbutton.x != 1599) { printf("ButtonPress: %u %u/%u\n", e.xbutton.button, e.xbutton.x, e.xbutton.y); printf("Display: %08lX Window: %lu Root: %lu Sub: %lu\n", e.xbutton.display, e.xbutton.window, e.xbutton.root, e.xbutton.subwindow); mask = ButtonPressMask; } } break; case ButtonRelease: { if(e.xbutton.x != 1599) { printf("ButtonRelease: %u %u/%u\n", e.xbutton.button, e.xbutton.x, e.xbutton.y); printf("Display: %08lX Window: %lu Root: %lu Sub: %lu\n", e.xbutton.display, e.xbutton.window, e.xbutton.root, e.xbutton.subwindow); mask = ButtonReleaseMask; } } break; } // if(mask != NoEventMask) XSendEvent(e.xbutton.display, InputFocus, False, mask, &e); } return 0; } -- Gerhard Gruber Für jedes menschliche Problem gibt es immer eine einfache Lösung: Klar, einleuchtend und falsch. (Henry Louis Mencken) _______________________________________________ Devel mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/devel