void g_retrievecursor(int store_id) { Widget wid; Window w; int x,y; if (store_id < 0 || store_id > G_MAX_STORE_CURSOR || SC[store_id].w == 0) return; wid = XtWindowToWidget(INTERNAL_display,SC[store_id].w); if (wid && XtIsManaged(wid) && XmGetVisibility(wid) != XmVISIBILITY_FULLY_OBSCURED) { w = SC[store_id].w; x = SC[store_id].x; y = SC[store_id].y; } else { w = INTERNAL_rootwin; x = SC[store_id].rootx; y = SC[store_id].rooty; } XWarpPointer(INTERNAL_display, None, w, 0, 0, 0, 0, x, y); XFlush(INTERNAL_display); }
int INTERNAL_cursorpos(float *x, float *y) { int rootx, rooty, wx, wy, ret; Window root, child; unsigned int mask; Widget wid; *x = *y = 0.0; if ((wid=XtWindowToWidget(INTERNAL_display,xwini[GD.win_id].xwin))==NULL) return FALSE; if (XtIsManaged(wid)==FALSE) return FALSE; if (XmGetVisibility(wid) == XmVISIBILITY_FULLY_OBSCURED) return FALSE; ret = (int) XQueryPointer(INTERNAL_display, xwini[GD.win_id].xwin, &root, &child, &rootx, &rooty, &wx, &wy, &mask); *x = usercoorx((float) wx); *y = usercoory((float) wy); return ret; }
boolean MotifUI::DoIsVisible() { boolean rc = true; if (_w) { if (UIClass() == APPLICATION) { if (XtIsRealized(_w)) { XWindowAttributes attributes; XGetWindowAttributes(display, XtWindow(_w), &attributes); if (attributes.map_state == IsUnmapped) rc = false; } } else if (XmGetVisibility(_w) == XmVISIBILITY_FULLY_OBSCURED) rc = false; } return rc; }
void INTERNAL_warpcursor(long x, long y) { int destx, desty; Widget wid; if ((wid=XtWindowToWidget(INTERNAL_display,xwini[GD.win_id].xwin))==NULL) return; if (XtIsManaged(wid)==FALSE) return; if (XmGetVisibility(wid) == XmVISIBILITY_FULLY_OBSCURED) return; destx = (int) x; desty = (int) y; XWarpPointer(INTERNAL_display, None, xwini[GD.win_id].xwin, 0, 0, 0, 0, destx, desty); xwini[GD.win_id].xlib_old_x = destx; xwini[GD.win_id].xlib_old_y = desty; }