Lines Matching +full:display +full:- +full:backend
2 * Copyright 2001-2003 Red Hat Inc., Durham, North Carolina.
21 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
36 * These routines support taking input from devices on the backend
40 #include <dmx-config.h>
63 /* Private area for backend devices. */
110 priv->dmxLocal = dmxLocal; in dmxBackendCreatePrivate()
128 if (dmxScreen->index == target) in dmxBackendTestScreen()
133 /* Return non-zero if screen and priv->myScreen are on the same physical
134 * backend display (1 if they are the same screen, 2 if they are
142 static int oldscreen = -1; in dmxBackendSameDisplay()
149 oldscreen = -1; in dmxBackendSameDisplay()
154 if (screen == priv->myScreen) in dmxBackendSameDisplay()
158 else if (dmxPropertyIterate(priv->be, in dmxBackendSameDisplay()
174 if (XCheckNotMaskEvent(dmxScreen->beDisplay, ExposureMask, X)) in dmxBackendTestEvents()
184 if (XCheckTypedEvent(dmxScreen->beDisplay, MotionNotify, X)) in dmxBackendTestMotionEvent()
194 if ((dmxScreen = dmxPropertyIterate(priv->be, dmxBackendTestEvents, X))) in dmxBackendGetEvent()
205 if ((dmxScreen = dmxPropertyIterate(priv->be, in dmxBackendPendingMotionEvent()
208 XPutBackEvent(dmxScreen->beDisplay, &N); in dmxBackendPendingMotionEvent()
219 if (dmxScreen->scrnWin == win) in dmxBackendTestWindow()
227 return dmxPropertyIterate(priv->be, dmxBackendTestWindow, in dmxBackendFindWindow()
232 * screens takes backend input, then we want that particular screen to
240 if (!start->over) in dmxBackendFindOverlapping()
243 for (pt = start->over; /* condition at end of loop */ ; pt = pt->over) { in dmxBackendFindOverlapping()
244 if (pt->index == priv->myScreen in dmxBackendFindOverlapping()
245 && dmxOnScreen(x, y, &dmxScreens[pt->index])) in dmxBackendFindOverlapping()
246 return pt->index; in dmxBackendFindOverlapping()
253 /* Return non-zero if \a x and \a y are off \a screen. */
268 int screen = miPointerGetScreen(inputInfo.pointer)->myNum; in dmxBackendUpdatePosition()
269 DMXScreenInfo *dmxScreen = &dmxScreens[priv->myScreen]; in dmxBackendUpdatePosition()
270 int oldRelative = priv->relative; in dmxBackendUpdatePosition()
273 int offscreen = dmxBackendOffscreen(priv->myScreen, x, y); in dmxBackendUpdatePosition()
278 x, y, priv->myScreen, screen, priv->relative, in dmxBackendUpdatePosition()
283 * relative unless it is visible on a screen of the same display in dmxBackendUpdatePosition()
286 if (priv->relative) { in dmxBackendUpdatePosition()
288 priv->relative = 0; in dmxBackendUpdatePosition()
292 if (!priv->relative) { in dmxBackendUpdatePosition()
294 priv->relative = 1; in dmxBackendUpdatePosition()
304 if (priv->relative) { in dmxBackendUpdatePosition()
306 priv->relative = 0; in dmxBackendUpdatePosition()
310 if (!priv->relative) { in dmxBackendUpdatePosition()
312 priv->relative = 1; in dmxBackendUpdatePosition()
317 if (oldRelative != priv->relative) { in dmxBackendUpdatePosition()
318 DMXDBG2(" Do switch, relative=%d same=%d\n", priv->relative, same); in dmxBackendUpdatePosition()
319 /* Discard all pre-switch events */ in dmxBackendUpdatePosition()
323 if (dmxInput->console && offscreen) { in dmxBackendUpdatePosition()
324 /* Our special case is a console window and a backend window in dmxBackendUpdatePosition()
325 * share a display. In this case, the cursor is either on in dmxBackendUpdatePosition()
326 * the backend window (taking absolute input), or not (in in dmxBackendUpdatePosition()
329 if (priv->grabbedScreen) { in dmxBackendUpdatePosition()
330 DMXDBG2(" *** force ungrab on %s, display=%p\n", in dmxBackendUpdatePosition()
331 priv->grabbedScreen->name, in dmxBackendUpdatePosition()
332 priv->grabbedScreen->beDisplay); in dmxBackendUpdatePosition()
333 XUngrabPointer(priv->grabbedScreen->beDisplay, CurrentTime); in dmxBackendUpdatePosition()
334 dmxSync(priv->grabbedScreen, TRUE); in dmxBackendUpdatePosition()
335 priv->grabbedScreen = NULL; in dmxBackendUpdatePosition()
341 priv->newscreen = 1; in dmxBackendUpdatePosition()
342 if (priv->relative && !dmxInput->console) { in dmxBackendUpdatePosition()
344 priv->lastX, priv->lastY, priv->centerX, priv->centerY, in dmxBackendUpdatePosition()
345 priv->myScreen); in dmxBackendUpdatePosition()
348 priv->lastX = priv->centerX; in dmxBackendUpdatePosition()
349 priv->lastY = priv->centerY; in dmxBackendUpdatePosition()
350 XWarpPointer(priv->display, None, priv->window, in dmxBackendUpdatePosition()
351 0, 0, 0, 0, priv->lastX, priv->lastY); in dmxBackendUpdatePosition()
362 /** Get events from the X queue on the backend servers and put the
375 int entered = priv->entered; in dmxBackendCollectEvents()
386 priv->entered = 1; in dmxBackendCollectEvents()
390 dmxScreen->name, dmxScreen->beDisplay); in dmxBackendCollectEvents()
391 XRaiseWindow(dmxScreen->beDisplay, dmxScreen->scrnWin); in dmxBackendCollectEvents()
392 priv->grabbedScreen = dmxScreen; in dmxBackendCollectEvents()
393 if ((retcode = XGrabPointer(dmxScreen->beDisplay, in dmxBackendCollectEvents()
394 dmxScreen->scrnWin, in dmxBackendCollectEvents()
399 "XGrabPointer failed during backend enter (%d)\n", in dmxBackendCollectEvents()
414 priv->grabbedScreen ? "UNGRAB" : "", dmxScreen->name); in dmxBackendCollectEvents()
415 if (priv->grabbedScreen) { in dmxBackendCollectEvents()
416 XUngrabPointer(priv->grabbedScreen->beDisplay, CurrentTime); in dmxBackendCollectEvents()
417 dmxSync(priv->grabbedScreen, TRUE); in dmxBackendCollectEvents()
418 priv->grabbedScreen = NULL; in dmxBackendCollectEvents()
424 dmxScreen->index, priv->myScreen, in dmxBackendCollectEvents()
425 priv->newscreen, in dmxBackendCollectEvents()
427 entered, priv->lastX, priv->lastY); in dmxBackendCollectEvents()
432 " Event on non-existant window %lu\n", in dmxBackendCollectEvents()
434 if (!priv->relative || dmxInput->console) { in dmxBackendCollectEvents()
435 int newX = X.xmotion.x - dmxScreen->rootX; in dmxBackendCollectEvents()
436 int newY = X.xmotion.y - dmxScreen->rootY; in dmxBackendCollectEvents()
438 if (!priv->newscreen) { in dmxBackendCollectEvents()
439 int width = dmxScreen->rootWidth; in dmxBackendCollectEvents()
440 int height = dmxScreen->rootHeight; in dmxBackendCollectEvents()
443 newX = -1; in dmxBackendCollectEvents()
444 if (newX == width - 1) in dmxBackendCollectEvents()
447 newY = -1; in dmxBackendCollectEvents()
448 if (newY == height - 1) in dmxBackendCollectEvents()
451 priv->newscreen = 0; in dmxBackendCollectEvents()
452 v[0] = dmxScreen->rootXOrigin + newX; in dmxBackendCollectEvents()
453 v[1] = dmxScreen->rootYOrigin + newY; in dmxBackendCollectEvents()
456 priv->be->rootWidth, priv->be->rootHeight, in dmxBackendCollectEvents()
457 priv->be->rootX, priv->be->rootY, in dmxBackendCollectEvents()
458 priv->be->scrnWidth, priv->be->scrnHeight); in dmxBackendCollectEvents()
459 motion(priv->mou, v, 0, 2, DMX_ABSOLUTE, block); in dmxBackendCollectEvents()
460 priv->entered = 0; in dmxBackendCollectEvents()
463 int newX = priv->lastX - X.xmotion.x; in dmxBackendCollectEvents()
464 int newY = priv->lastY - X.xmotion.y; in dmxBackendCollectEvents()
466 priv->lastX = X.xmotion.x; in dmxBackendCollectEvents()
467 priv->lastY = X.xmotion.y; in dmxBackendCollectEvents()
471 motion(priv->mou, v, 0, 2, DMX_RELATIVE, block); in dmxBackendCollectEvents()
473 if (entered && priv->relative) { in dmxBackendCollectEvents()
476 (dmxScreen->rootXOrigin + X.xmotion.x in dmxBackendCollectEvents()
477 - dmxScreen->rootX), in dmxBackendCollectEvents()
478 (dmxScreen->rootYOrigin + X.xmotion.y in dmxBackendCollectEvents()
479 - dmxScreen->rootY)); in dmxBackendCollectEvents()
485 enqueue(priv->kbd, X.type, X.xkey.keycode, 0, NULL, block); in dmxBackendCollectEvents()
489 /* fall-through */ in dmxBackendCollectEvents()
493 enqueue(priv->mou, X.type, X.xbutton.button, 0, &X, block); in dmxBackendCollectEvents()
509 priv->myScreen, priv->relative, in dmxBackendProcessInput()
510 priv->lastX, priv->lastY, priv->centerX, priv->centerY); in dmxBackendProcessInput()
512 if (priv->relative in dmxBackendProcessInput()
513 && !dmxInput->console in dmxBackendProcessInput()
514 && (priv->lastX != priv->centerX || priv->lastY != priv->centerY)) { in dmxBackendProcessInput()
516 priv->lastX, priv->lastY, priv->centerX, priv->centerY); in dmxBackendProcessInput()
517 priv->lastX = priv->centerX; in dmxBackendProcessInput()
518 priv->lastY = priv->centerY; in dmxBackendProcessInput()
519 XWarpPointer(priv->display, None, priv->window, in dmxBackendProcessInput()
520 0, 0, 0, 0, priv->lastX, priv->lastY); in dmxBackendProcessInput()
521 dmxSync(&dmxScreens[priv->myScreen], TRUE); in dmxBackendProcessInput()
531 centerX = priv->be->rootWidth / 2 + priv->be->rootX; in dmxBackendComputeCenter()
532 centerY = priv->be->rootHeight / 2 + priv->be->rootY; in dmxBackendComputeCenter()
534 if (centerX > priv->be->rootWidth) in dmxBackendComputeCenter()
535 centerX = priv->be->rootWidth - 1; in dmxBackendComputeCenter()
536 if (centerY > priv->be->rootHeight) in dmxBackendComputeCenter()
537 centerY = priv->be->rootHeight - 1; in dmxBackendComputeCenter()
543 priv->centerX = centerX; in dmxBackendComputeCenter()
544 priv->centerY = centerY; in dmxBackendComputeCenter()
551 DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx]; in dmxBackendInitPrivate()
557 if (dmxPropertySameDisplay(dmxScreen, dmxInput->name)) { in dmxBackendInitPrivate()
558 priv->display = dmxScreen->beDisplay; in dmxBackendInitPrivate()
559 priv->window = dmxScreen->scrnWin; in dmxBackendInitPrivate()
560 priv->be = dmxScreen; in dmxBackendInitPrivate()
567 "%s is not an existing backend display - cannot initialize\n", in dmxBackendInitPrivate()
568 dmxInput->name); in dmxBackendInitPrivate()
573 /** Re-initialized the backend device described by \a pDev (after a
589 /** Initialized the backend device described by \a pDev. */
598 if (dmxLocal->type == DMX_LOCAL_MOUSE) in dmxBackendInit()
599 priv->mou = pDev; in dmxBackendInit()
600 if (dmxLocal->type == DMX_LOCAL_KEYBOARD) in dmxBackendInit()
601 priv->kbd = pDev; in dmxBackendInit()
602 if (priv->initialized++) in dmxBackendInit()
609 priv->eventMask = (EnterWindowMask | LeaveWindowMask); in dmxBackendInit()
610 priv->myScreen = dmxScreen->index; in dmxBackendInit()
611 priv->lastX = priv->centerX; in dmxBackendInit()
612 priv->lastY = priv->centerY; in dmxBackendInit()
613 priv->relative = 0; in dmxBackendInit()
614 priv->newscreen = 0; in dmxBackendInit()
617 /** Get information about the backend pointer (for initialization). */
623 info->buttonClass = 1; in dmxBackendMouGetInfo()
624 dmxCommonMouGetMap(pDev, info->map, &info->numButtons); in dmxBackendMouGetInfo()
625 info->valuatorClass = 1; in dmxBackendMouGetInfo()
626 info->numRelAxes = 2; in dmxBackendMouGetInfo()
627 info->minval[0] = 0; in dmxBackendMouGetInfo()
628 info->minval[1] = 0; in dmxBackendMouGetInfo()
629 info->maxval[0] = dmxScreen->beWidth; in dmxBackendMouGetInfo()
630 info->maxval[1] = dmxScreen->beHeight; in dmxBackendMouGetInfo()
631 info->res[0] = 1; in dmxBackendMouGetInfo()
632 info->minres[0] = 0; in dmxBackendMouGetInfo()
633 info->maxres[0] = 1; in dmxBackendMouGetInfo()
634 info->ptrFeedbackClass = 1; in dmxBackendMouGetInfo()
637 /** Get information about the backend keyboard (for initialization). */
642 info->keyboard = 1; in dmxBackendKbdGetInfo()
643 info->keyClass = 1; in dmxBackendKbdGetInfo()
644 dmxCommonKbdGetMap(pDev, &info->keySyms, info->modMap); in dmxBackendKbdGetInfo()
645 info->freemap = 1; in dmxBackendKbdGetInfo()
646 info->focusClass = 1; in dmxBackendKbdGetInfo()
647 info->kbdFeedbackClass = 1; in dmxBackendKbdGetInfo()