Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

# dmxcursor.c File Reference

`#include "dmx.h"`
`#include "dmxsync.h"`
`#include "dmxcursor.h"`
`#include "dmxlog.h"`
`#include "dmxprop.h"`
`#include "dmxinput.h"`
`#include "mipointer.h"`
`#include "windowstr.h"`
`#include "globals.h"`
`#include "cursorstr.h"`
`#include "dixevents.h"`

## Functions
void | dmxCursorNoMulti (void)
void | dmxReInitOrigins (void)
void | dmxInitOrigins (void)
int | dmxOnScreen (int x, int y, DMXScreenInfo *dmxScreen)
void | dmxInitOverlap (void)
void | dmxBECreateCursor (ScreenPtr pScreen, CursorPtr pCursor)
Bool | dmxBEFreeCursor (ScreenPtr pScreen, CursorPtr pCursor)
void | dmxMoveCursor (ScreenPtr pScreen, int x, int y)
void | dmxHideCursor (DMXScreenInfo *dmxScreen)
void | dmxCheckCursor (void)
## Variables
miPointerScreenFuncRec | dmxPointerCursorFuncs
miPointerSpriteFuncRec | dmxPointerSpriteFuncs

## Detailed Description

This file contains code than supports cursor movement, including the code that initializes and reinitializes the screen positions and computes screen overlap.

"This code is based very closely on the XFree86 equivalent (xfree86/common/xf86Cursor.c)." --David Dawes.

"This code was then extensively re-written, as explained here." --Rik Faith

The code in xf86Cursor.c used edge lists to implement the CursorOffScreen function. The edge list computation was complex (especially in the face of arbitrarily overlapping screens) compared with the speed savings in the CursorOffScreen function. The new implementation has erred on the side of correctness, readability, and maintainability over efficiency. For the common (non-edge) case, the dmxCursorOffScreen function does avoid a loop over all the screens. When the cursor has left the screen, all the screens are searched, and the first screen (in dmxScreens order) containing the cursor will be returned. If run-time profiling shows that this routing is a performance bottle-neck, then an edge list may have to be reimplemented. An edge list algorithm is O(edges) whereas the new algorithm is O(dmxNumScreens). Since edges is usually 1-3 and dmxNumScreens may be 30-60 for large backend walls, this trade off may be compelling.

The xf86InitOrigins routine uses bit masks during the computation and is therefore limited to the length of a word (e.g., 32 or 64 bits) screens. Because Xdmx is expected to be used with a large number of backend displays, this limitation was removed. The new implementation has erred on the side of readability over efficiency, using the dmxSL* routines to manage a screen list instead of a bitmap, and a function call to decrease the length of the main routine. Both algorithms are of the same order, and both are called only at server generation time, so trading clarity and long-term maintainability for efficiency does not seem justified in this case.

## Function Documentation

void dmxBECreateCursor | ( | ScreenPtr | pScreen,
|  | CursorPtr | pCursor
| ) |

| Create pCursor on the back-end associated with pScreen.

Bool dmxBEFreeCursor | ( | ScreenPtr | pScreen,
|  | CursorPtr | pCursor
| ) |

| Free pCursor on the back-end associated with pScreen.

void dmxCheckCursor | ( | void |  | ) |

| This routine is called during reconfiguration to make sure the cursor is visible.

void dmxCursorNoMulti | ( | void |  | ) |

| Turn off support for displaying multiple cursors on overlapped back-end displays. See #dmxCursorDoMultiCursors.

void dmxHideCursor | ( | DMXScreenInfo * | dmxScreen | ) |

| This routine is used by the backend input routines to hide the cursor on a screen that is being used for relative input. See also: dmxbackend.c

void dmxInitOrigins | ( | void |  | ) |

| Initialize screen origins (and relative position). This is called for each server generation. For dynamic reconfiguration, use dmxReInitOrigins() instead.

void dmxInitOverlap | ( | void |  | ) |

| Detects overlapping dmxScreens and creates circular lists. This uses an O(dmxNumScreens^2) algorithm, but dmxNumScreens is < 100 and the computation only needs to be performed for every server generation or dynamic reconfiguration .

void dmxMoveCursor | ( | ScreenPtr | pScreen,
|  | int | x,
|  | int | y
| ) |

| Move the cursor to coordinates (x, y)on pScreen. This function is usually called via dmxPointerSpriteFuncs, except during reconfiguration when the cursor is repositioned to force an update on newley overlapping screens and on screens that no longer overlap.

int dmxOnScreen | ( | int | x,
|  | int | y,
|  | DMXScreenInfo * | dmxScreen
| ) |

| Returns non-zero if the global x, y coordinate is on the screen window of the dmxScreen.

void dmxReInitOrigins | ( | void |  | ) |

| Recompute origin information in the dmxScreens list. This is either called from dmxInitOrigins() or from #dmxReconfig().

## Variable Documentation

miPointerScreenFuncRec dmxPointerCursorFuncs

| Initial value:
    {
        dmxCursorOffScreen,
        dmxCrossScreen,
        dmxWarpCursor,
        dmxeqEnqueue,
        dmxeqSwitchScreen
    }
Cursor functions for mi layer. See also: dmxcursor.c dmxscrinit.c

miPointerSpriteFuncRec dmxPointerSpriteFuncs

| Initial value:
    {
        dmxRealizeCursor,
        dmxUnrealizeCursor,
        dmxSetCursor,
        dmxMoveCursor,
    }
Sprite functions for mi layer. See also: dmxcursor.c dmxscrinit.c