static void show_cursor (Doppelganger *dg) { int current_pointer; XIEventMask mask = { dg->mpx, 0, "" }; #if 0 /* probably unnecessary */ XIGetClientPointer (gdk_x11_get_default_xdisplay (), None, ¤t_pointer); /* probably unnecessary */ XISetClientPointer (gdk_x11_get_default_xdisplay (), None, dg->mpx); if (XIGrabDevice (gdk_x11_get_default_xdisplay (), dg->mpx, GDK_ROOT_WINDOW(), CurrentTime, gdk_x11_cursor_get_xcursor (dg->cursor), GrabModeAsync, GrabModeAsync, True, &mask) != GrabSuccess) { g_warning ("Grab failed."); } /* probably unnecessary */ XISetClientPointer (gdk_x11_get_default_xdisplay (), None, current_pointer); #endif }
static void select_events(Display *dpy, Window win) { XIEventMask evmasks[1]; unsigned char mask1[XIMaskLen(XI_RawMotion)]; memset(mask1, 0, sizeof(mask1)); /* Select for motion from the default cursor */ XISetMask(mask1, XI_RawMotion); int pointer_dev_id; XIGetClientPointer(dpy, None, &pointer_dev_id); evmasks[0].deviceid = pointer_dev_id; evmasks[0].mask_len = sizeof(mask1); evmasks[0].mask = mask1; XISelectEvents(dpy, win, evmasks, 1); XFlush(dpy); }