Lines Matching refs:priv
107 myPrivate *priv = calloc(1, sizeof(*priv));
108 priv->dmxLocal = dmxLocal;
109 return priv;
128 /* Return non-zero if screen and priv->myScreen are on the same physical
131 * are cached. The cache is invalidated if \a priv is NULL (this should
133 static int dmxBackendSameDisplay(myPrivate *priv, long screen)
139 if (priv == oldpriv && screen == oldscreen) return retcode;
140 if (!priv) { /* Invalidate cache */
147 if (screen == priv->myScreen) retcode = 1;
149 else if (dmxPropertyIterate(priv->be,
154 oldpriv = priv;
177 static DMXScreenInfo *dmxBackendGetEvent(myPrivate *priv, XEvent *X)
181 if ((dmxScreen = dmxPropertyIterate(priv->be, dmxBackendTestEvents, X)))
186 static DMXScreenInfo *dmxBackendPendingMotionEvent(myPrivate *priv, int save)
191 if ((dmxScreen = dmxPropertyIterate(priv->be,
206 static DMXScreenInfo *dmxBackendFindWindow(myPrivate *priv, Window win)
208 return dmxPropertyIterate(priv->be, dmxBackendTestWindow,
215 static int dmxBackendFindOverlapping(myPrivate *priv, int screen, int x, int y)
223 if (pt->index == priv->myScreen
244 DMXScreenInfo *dmxScreen = &dmxScreens[priv->myScreen];
245 int oldRelative = priv->relative;
246 int topscreen = dmxBackendFindOverlapping(priv, screen, x, y);
247 int same = dmxBackendSameDisplay(priv, topscreen);
248 int offscreen = dmxBackendOffscreen(priv->myScreen, x, y);
253 x, y, priv->myScreen, screen, priv->relative,
261 if (priv->relative) {
263 priv->relative = 0;
266 if (!priv->relative) {
268 priv->relative = 1;
277 if (priv->relative) {
279 priv->relative = 0;
282 if (!priv->relative) {
284 priv->relative = 1;
289 if (oldRelative != priv->relative) {
291 priv->relative, same);
294 while (dmxBackendPendingMotionEvent(priv, FALSE));
302 if (priv->grabbedScreen) {
304 priv->grabbedScreen->name,
305 priv->grabbedScreen->beDisplay);
306 XUngrabPointer(priv->grabbedScreen->beDisplay, CurrentTime);
307 dmxSync(priv->grabbedScreen, TRUE);
308 priv->grabbedScreen = NULL;
313 priv->newscreen = 1;
314 if (priv->relative && !dmxInput->console) {
316 priv->lastX, priv->lastY, priv->centerX, priv->centerY,
317 priv->myScreen);
320 priv->lastX = priv->centerX;
321 priv->lastY = priv->centerY;
322 XWarpPointer(priv->display, None, priv->window,
323 0, 0, 0, 0, priv->lastX, priv->lastY);
346 int entered = priv->entered;
351 while ((dmxScreen = dmxBackendGetEvent(priv, &X))) {
354 dmxCommonSaveState(priv);
357 priv->entered = 1;
363 priv->grabbedScreen = dmxScreen;
379 dmxCommonRestoreState(priv);
385 priv->grabbedScreen ? "UNGRAB" : "",
387 if (priv->grabbedScreen) {
388 XUngrabPointer(priv->grabbedScreen->beDisplay, CurrentTime);
389 dmxSync(priv->grabbedScreen, TRUE);
390 priv->grabbedScreen = NULL;
396 dmxScreen->index, priv->myScreen,
398 priv->newscreen,
400 entered, priv->lastX, priv->lastY);
401 if (dmxBackendPendingMotionEvent(priv, TRUE))
403 if (!(dmxScreen = dmxBackendFindWindow(priv, X.xmotion.window)))
407 if (!priv->relative || dmxInput->console) {
411 if (!priv->newscreen) {
419 priv->newscreen = 0;
424 priv->be->rootWidth, priv->be->rootHeight,
425 priv->be->rootX, priv->be->rootY,
426 priv->be->scrnWidth, priv->be->scrnHeight);
427 motion(priv->mou, v, 0, 2, DMX_ABSOLUTE, block);
428 priv->entered = 0;
430 int newX = priv->lastX - X.xmotion.x;
431 int newY = priv->lastY - X.xmotion.y;
432 priv->lastX = X.xmotion.x;
433 priv->lastY = X.xmotion.y;
437 motion(priv->mou, v, 0, 2, DMX_RELATIVE, block);
439 if (entered && priv->relative) {
451 enqueue(priv->kbd, X.type, X.xkey.keycode, 0, NULL, block);
459 enqueue(priv->mou, X.type, X.xbutton.button, 0, &X, block);
474 priv->myScreen, priv->relative,
475 priv->lastX, priv->lastY,
476 priv->centerX, priv->centerY);
478 if (priv->relative
480 && (priv->lastX != priv->centerX || priv->lastY != priv->centerY)) {
482 priv->lastX, priv->lastY, priv->centerX, priv->centerY);
483 priv->lastX = priv->centerX;
484 priv->lastY = priv->centerY;
485 XWarpPointer(priv->display, None, priv->window,
486 0, 0, 0, 0, priv->lastX, priv->lastY);
487 dmxSync(&dmxScreens[priv->myScreen], TRUE);
491 static void dmxBackendComputeCenter(myPrivate *priv)
496 centerX = priv->be->rootWidth / 2 + priv->be->rootX;
497 centerY = priv->be->rootHeight / 2 + priv->be->rootY;
499 if (centerX > priv->be->rootWidth) centerX = priv->be->rootWidth - 1;
500 if (centerY > priv->be->rootHeight) centerY = priv->be->rootHeight - 1;
504 priv->centerX = centerX;
505 priv->centerY = centerY;
518 priv->display = dmxScreen->beDisplay;
519 priv->window = dmxScreen->scrnWin;
520 priv->be = dmxScreen;
545 dmxBackendComputeCenter(priv);
548 dmxBackendUpdatePosition(priv, x, y);
559 if (dmxLocal->type == DMX_LOCAL_MOUSE) priv->mou = pDev;
560 if (dmxLocal->type == DMX_LOCAL_KEYBOARD) priv->kbd = pDev;
561 if (priv->initialized++) return; /* Only do once for mouse/keyboard pair */
566 dmxBackendComputeCenter(priv);
567 priv->eventMask = (EnterWindowMask|LeaveWindowMask);
568 priv->myScreen = dmxScreen->index;
569 priv->lastX = priv->centerX;
570 priv->lastY = priv->centerY;
571 priv->relative = 0;
572 priv->newscreen = 0;