# dmxconsole.c File Reference

`#include "dmxinputinit.h"`
`#include "dmxevents.h"`
`#include "dmxconsole.h"`
`#include "dmxcommon.h"`
`#include "dmxscrinit.h"`
`#include "dmxcb.h"`
`#include "dmxsync.h"`
`#include "inputstr.h"`
`#include "input.h"`
`#include "mipointer.h"`
`#include "windowstr.h"`

## Data Structures

struct | _myPrivate

## Defines

#define | DMX_CONSOLE_DEBUG 0
#define | DMX_WINDOW_DEBUG 0
#define | CONSOLE_NUM 3
#define | CONSOLE_DEN 4
#define | DMX_CONSOLE_NAME "DMX Console"
#define | DMX_RES_NAME "Xdmx"
#define | DMX_RES_CLASS "XDmx"
#define | CONSOLE_BG_COLOR "gray75"
#define | CONSOLE_FG_COLOR "black"
#define | CONSOLE_SCREEN_BG_COLOR "white"
#define | CONSOLE_SCREEN_FG_COLOR "black"
#define | CONSOLE_SCREEN_DET_COLOR "gray75"
#define | CONSOLE_SCREEN_CUR_COLOR "red"
#define | DMXDBG0(f)
#define | DMXDBG1(f, a)
#define | DMXDBG2(f, a, b)
#define | DMXDBG3(f, a, b, c)
#define | DMXDBG4(f, a, b, c, d)
#define | DMXDBG5(f, a, b, c, d, e)
#define | DMXDBG6(f, a, b, c, d, e, g)
#define | DMXDBG7(f, a, b, c, d, e, g, h)

## Typedefs

typedef struct _myPrivate | myPrivate

## Functions

static int | scalex (myPrivate *priv, int x)
static int | scaley (myPrivate *priv, int y)
static int | unscalex (myPrivate *priv, int x)
static int | unscaley (myPrivate *priv, int y)
pointer | dmxConsoleCreatePrivate (DeviceIntPtr pDevice)
void | dmxConsoleDestroyPrivate (pointer private)
static void | dmxConsoleDrawFineCursor (myPrivate *priv, XRectangle *rect)
static void | dmxConsoleDrawWindows (pointer private)
static void | dmxConsoleDraw (myPrivate *priv, int updateCursor, int update)
static void | dmxConsoleClearCursor (myPrivate *priv, int x, int y, XRectangle *rect)
static void | dmxConsoleUpdateFineCursor (myPrivate *priv)
void | dmxConsoleUpdateInfo (pointer private, DMXUpdateType type, WindowPtr pWindow)
static void | dmxConsoleMoveAbsolute (myPrivate *priv, int x, int y, DevicePtr pDev, dmxMotionProcPtr motion, DMXBlockType block)
static void | dmxConsoleMoveRelative (myPrivate *priv, int x, int y, DevicePtr pDev, dmxMotionProcPtr motion, DMXBlockType block)
void | dmxConsoleUpdatePosition (pointer private, int x, int y)
void | dmxConsoleCollectEvents (DevicePtr pDev, dmxMotionProcPtr motion, dmxEnqueueProcPtr enqueue, dmxCheckSpecialProcPtr checkspecial, DMXBlockType block)
static void | dmxCloseConsole (myPrivate *priv)
static Bool | dmxCloseConsoleScreen (int idx, ScreenPtr pScreen)
static Cursor | dmxConsoleCreateEmptyCursor (myPrivate *priv)
static void | dmxConsoleComputeWidthHeight (myPrivate *priv, int *width, int *height, double *xScale, double *yScale, int *consWidth, int *consHeight)
void | dmxConsoleReInit (DevicePtr pDev)
void | dmxConsoleInit (DevicePtr pDev)
void | dmxConsoleMouGetInfo (DevicePtr pDev, DMXLocalInitInfoPtr info)
void | dmxConsoleKbdGetInfo (DevicePtr pDev, DMXLocalInitInfoPtr info)
int | dmxConsoleFunctions (pointer private, DMXFunctionType function)
static void | dmxDump (void)
void | dmxConsoleCapture (DMXInputInfo *dmxInput)
void | dmxConsoleUncapture (DMXInputInfo *dmxInput)

## Detailed Description

This file implements the console input devices.

## Define Documentation

#define CONSOLE_BG_COLOR "gray75"

Referenced by dmxConsoleInit().

#define CONSOLE_DEN 4

#define CONSOLE_FG_COLOR "black"

#define CONSOLE_NUM 3

Referenced by dmxConsoleComputeWidthHeight().

#define CONSOLE_SCREEN_BG_COLOR "white"

Referenced by dmxConsoleInit().

#define CONSOLE_SCREEN_CUR_COLOR "red"

Referenced by dmxConsoleInit().

#define CONSOLE_SCREEN_DET_COLOR "gray75"

Referenced by dmxConsoleInit().

#define CONSOLE_SCREEN_FG_COLOR "black"

Referenced by dmxConsoleInit().

#define DMX_CONSOLE_DEBUG 0

#define DMX_CONSOLE_NAME "DMX Console"

Referenced by dmxConsoleInit().

#define DMX_RES_CLASS "XDmx"

#define DMX_RES_NAME "Xdmx"

#define DMX_WINDOW_DEBUG 0

#define DMXDBG0 | ( |  | f | ) |

Referenced by dmxConsoleCapture(), and dmxConsoleUncapture().

#define DMXDBG1 | ( |  | f,
|  |  | a |
| ) |  |  |

#define DMXDBG2 | ( |  | f,
|  |  | a,
|  |  | b |
| ) |  |  |

Referenced by dmxConsoleCollectEvents(), dmxConsoleUpdateFineCursor(), and dmxConsoleUpdatePosition().

#define DMXDBG3 | ( |  | f,
|  |  | a,
|  |  | b,
|  |  | c |
| ) |  |  |

Referenced by dmxConsoleCapture().

#define DMXDBG4 | ( |  | f,
|  |  | a,
|  |  | b,
|  |  | c,
|  |  | d |
| ) |  |  |

Referenced by dmxConsoleCollectEvents(), dmxConsoleUpdateFineCursor(), and dmxDump().

#define DMXDBG5 | ( |  | f,
|  |  | a,
|  |  | b,
|  |  | c,
|  |  | d,
|  |  | e |
| ) |  |  |

Referenced by dmxConsoleCollectEvents().

#define DMXDBG6 | ( |  | f,
|  |  | a,
|  |  | b,
|  |  | c,
|  |  | d,
|  |  | e,
|  |  | g |
| ) |  |  |

Referenced by dmxConsoleCollectEvents(), dmxConsoleMoveAbsolute(), dmxConsoleUpdateFineCursor(), and dmxConsoleUpdatePosition().

#define DMXDBG7 | ( |  | f,
|  |  | a,
|  |  | b,
|  |  | c,
|  |  | d,
|  |  | e,
|  |  | g,
|  |  | h |
| ) |  |  |

## Typedef Documentation

typedef struct _myPrivate myPrivate

## Function Documentation

static void dmxCloseConsole | ( | myPrivate * | priv | ) | `[static]`

References _DMXInputInfo::console, dmxCommonRestoreState(), _myPrivate::dmxInput, _myPrivate::gc, _myPrivate::gcCur, _myPrivate::gcDet, and _myPrivate::gcRev.

Referenced by dmxCloseConsoleScreen().

static Bool dmxCloseConsoleScreen | ( | int | idx,
|  | ScreenPtr | pScreen |
| ) |  |  | `[static]`

References _myPrivate::CloseScreen, DMX_UNWRAP, dmxCloseConsole(), dmxScreenPrivateKey, and _myPrivate::next.

Referenced by dmxConsoleInit().

void dmxConsoleCapture | ( | DMXInputInfo * | dmxInput | ) |

This routine is used to warp the pointer into the console window from anywhere on the screen. It is used when backend and console input are both being taken from the same X display.

References _myPrivate::captured, _myPrivate::curX, _myPrivate::curY, _DMXInputInfo::devs, DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_CONSOLE, dmxConsoleUpdateFineCursor(), DMXDBG0, DMXDBG3, dmxDump(), dmxSync(), _DMXLocalInputInfo::extType, _myPrivate::fine, _DMXInputInfo::name, _DMXInputInfo::numDevs, _DMXLocalInputInfo::private, and _DMXLocalInputInfo::type.

Referenced by dmxBackendUpdatePosition().

static void dmxConsoleClearCursor | ( | myPrivate * | priv,
|  | int | x,
|  | int | y,
|  | XRectangle * | rect |
| ) |  |  | `[static]`

References dmxConsoleDraw(), _myPrivate::gc, _myPrivate::gcDet, _myPrivate::gcRev, scalex(), and scaley().

Referenced by dmxConsoleFunctions(), and dmxConsoleUpdateFineCursor().

void dmxConsoleCollectEvents | ( | DevicePtr | pDev,
|  | dmxMotionProcPtr | motion,
|  | dmxEnqueueProcPtr | enqueue,
|  | dmxCheckSpecialProcPtr | checkspecial,
|  | DMXBlockType | block |
| ) |  |  |

Collect all pending events from the console's display. Plase these events on the server event queue using the motion and enqueue routines. The checkspecial routine is used to check for special keys that need handling. block tells if signals should be blocked when updating the event queue.

References dmxCommonRestoreState(), dmxCommonSaveState(), dmxConsoleDraw(), dmxConsoleMoveAbsolute(), dmxConsoleMoveRelative(), dmxConsoleUncapture(), DMXDBG2, DMXDBG4, DMXDBG5, DMXDBG6, _myPrivate::dmxInput, _myPrivate::height, and _myPrivate::width.

static void dmxConsoleComputeWidthHeight | ( | myPrivate * | priv,
|  | int * | width,
|  | int * | height,
|  | double * | xScale,
|  | double * | yScale,
|  | int * | consWidth,
|  | int * | consHeight |
| ) |  |  | `[static]`

References CONSOLE_NUM, dmxGlobalHeight, dmxGlobalWidth, dmxNumScreens, scalex(), and scaley().

Referenced by dmxConsoleInit(), and dmxConsoleReInit().

static Cursor dmxConsoleCreateEmptyCursor | ( | myPrivate * | priv | ) | `[static]`

References dmxFatal, dmxLog(), and _myPrivate::pixmap.

Referenced by dmxConsoleInit().

pointer dmxConsoleCreatePrivate | ( | DeviceIntPtr | pDevice | ) |

Create the private area for pDevice.

void dmxConsoleDestroyPrivate | ( | pointer | private | ) |

If private is non-NULL, free its associated memory.

static void dmxConsoleDraw | ( | myPrivate * | priv,
|  | int | updateCursor,
|  | int | update |
| ) |  |  | `[static]`

References _DMXScreenInfo::beDisplay, _myPrivate::consHeight, _myPrivate::consWidth, dmxConsoleDrawFineCursor(), dmxConsoleDrawWindows(), _myPrivate::dmxInput, dmxNumScreens, dmxScreens, _myPrivate::fine, _myPrivate::gc, _myPrivate::gcDet, _myPrivate::gcRev, _myPrivate::height, _myPrivate::pixmap, scalex(), scaley(), _myPrivate::width, and _DMXInputInfo::windows.

Referenced by dmxConsoleClearCursor(), dmxConsoleCollectEvents(), dmxConsoleInit(), dmxConsoleReInit(), dmxConsoleUpdateInfo(), and dmxConsoleUpdatePosition().

static void dmxConsoleDrawFineCursor | ( | myPrivate * | priv,
|  | XRectangle * | rect |
| ) |  |  | `[static]`

References _myPrivate::gcCur, _myPrivate::globalX, _myPrivate::globalY, _myPrivate::grabbed, _myPrivate::pixmap, scalex(), and scaley().

Referenced by dmxConsoleDraw(), and dmxConsoleUpdateFineCursor().

static void dmxConsoleDrawWindows | ( | pointer | private | ) | `[static]`

References dmxDebug, dmxLog(), dmxNumScreens, scalex(), and scaley().

Referenced by dmxConsoleDraw().

int dmxConsoleFunctions | ( | pointer | private,
|  | DMXFunctionType | function |
| ) |  |  |

Handle special console-only keys.

References DMX_FUNCTION_FINE, DMX_FUNCTION_GRAB, DMX_FUNCTION_TERMINATE, dmxConsoleClearCursor(), dmxConsoleUpdateFineCursor(), dmxError, dmxLog(), scalex(), and scaley().

void dmxConsoleInit | ( | DevicePtr | pDev | ) |

Initialized the console device described by pDev.

References _myPrivate::CloseScreen, CONSOLE_BG_COLOR, CONSOLE_SCREEN_BG_COLOR, CONSOLE_SCREEN_CUR_COLOR, CONSOLE_SCREEN_DET_COLOR, CONSOLE_SCREEN_FG_COLOR, DMX_CONSOLE_NAME, DMX_LOCAL_KEYBOARD, DMX_LOCAL_MOUSE, DMX_WRAP, dmxCloseConsoleScreen(), dmxConsoleComputeWidthHeight(), dmxConsoleCreateEmptyCursor(), dmxConsoleDraw(), dmxFatal, _myPrivate::dmxInput, dmxInputs, dmxLog(), dmxScreenPrivateKey, _myPrivate::mask, _DMXInputInfo::name, scalex(), and scaley().

void dmxConsoleKbdGetInfo | ( | DevicePtr | pDev,
|  | DMXLocalInitInfoPtr | info |
| ) |  |  |

Fill in the info structure for the specified pDev. Only used for keyboard.

References dmxCommonKbdGetInfo(), dmxCommonKbdGetMap(), _DMXLocalInitInfo::focusClass, _DMXLocalInitInfo::freemap, _DMXLocalInitInfo::kbdFeedbackClass, _DMXLocalInitInfo::keyboard, _DMXLocalInitInfo::keyClass, _DMXLocalInitInfo::keySyms, and _DMXLocalInitInfo::modMap.

void dmxConsoleMouGetInfo | ( | DevicePtr | pDev,
|  | DMXLocalInitInfoPtr | info |
| ) |  |  |

Fill in the info structure for the specified pDev. Only used for pointers.

References _DMXLocalInitInfo::buttonClass, dmxCommonMouGetMap(), _DMXLocalInitInfo::map, _DMXLocalInitInfo::maxres, _DMXLocalInitInfo::maxval, _DMXLocalInitInfo::minres, _DMXLocalInitInfo::minval, _DMXLocalInitInfo::numButtons, _DMXLocalInitInfo::numRelAxes, _DMXLocalInitInfo::ptrFeedbackClass, _DMXLocalInitInfo::res, and _DMXLocalInitInfo::valuatorClass.

static void dmxConsoleMoveAbsolute | ( | myPrivate * | priv,
|  | int | x,
|  | int | y,
|  | DevicePtr | pDev,
|  | dmxMotionProcPtr | motion,
|  | DMXBlockType | block |
| ) |  |  | `[static]`

References _myPrivate::curX, _myPrivate::curY, DMX_ABSOLUTE_CONFINED, DMXDBG6, unscalex(), and unscaley().

Referenced by dmxConsoleCollectEvents().

static void dmxConsoleMoveRelative | ( | myPrivate * | priv,
|  | int | x,
|  | int | y,
|  | DevicePtr | pDev,
|  | dmxMotionProcPtr | motion,
|  | DMXBlockType | block |
| ) |  |  | `[static]`

References DMX_RELATIVE, _myPrivate::lastX, and _myPrivate::lastY.

Referenced by dmxConsoleCollectEvents().

void dmxConsoleReInit | ( | DevicePtr | pDev | ) |

Re-initialized the console device described by pDev (after a reconfig).

References dmxConsoleComputeWidthHeight(), and dmxConsoleDraw().

void dmxConsoleUncapture | ( | DMXInputInfo * | dmxInput | ) |

Undo the capture that was done by dmxConsoleCapture.

References _myPrivate::captured, _DMXInputInfo::devs, DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_CONSOLE, DMXDBG0, dmxSync(), _DMXLocalInputInfo::extType, _DMXInputInfo::numDevs, _DMXLocalInputInfo::private, and _DMXLocalInputInfo::type.

Referenced by dmxBackendUpdatePosition(), and dmxConsoleCollectEvents().

static void dmxConsoleUpdateFineCursor | ( | myPrivate * | priv | ) | `[static]`

References _myPrivate::consHeight, _myPrivate::consWidth, dmxConsoleClearCursor(), dmxConsoleDrawFineCursor(), DMXDBG2, DMXDBG4, DMXDBG6, dmxEventName(), dmxGetGlobalPosition(), dmxInfo, dmxLog(), _myPrivate::gc, _myPrivate::globalX, _myPrivate::globalY, _myPrivate::height, _myPrivate::lastX, _myPrivate::lastY, _myPrivate::pixmap, scalex(), scaley(), and _myPrivate::width.

Referenced by dmxConsoleCapture(), dmxConsoleFunctions(), and dmxConsoleUpdatePosition().

void dmxConsoleUpdateInfo | ( | pointer | private,
|  | DMXUpdateType | type,
|  | WindowPtr | pWindow |
| ) |  |  |

Whenever the window layout (size, position, stacking order) might be changed, this routine is called with the pWindow that changed and the type of change. This routine is called in a conservative fashion: the actual layout of the windows of the screen might not have had any human-visible changes.

References dmxConsoleDraw().

void dmxConsoleUpdatePosition | ( | pointer | private,
|  | int | x,
|  | int | y |
| ) |  |  |

This routine gets called from dmxCoreMotion for each motion. This allows the console's notion of the cursor postion to change when another input device actually caused the change.

References dmxConsoleDraw(), dmxConsoleUpdateFineCursor(), DMXDBG2, DMXDBG6, dmxGeneration, scalex(), and scaley().

static void dmxDump | ( | void |  | ) | `[static]`

References _DMXInputInfo::devs, DMXDBG4, dmxEventName(), _myPrivate::dmxInput, dmxInputs, dmxNumInputs, _DMXInputInfo::name, _DMXInputInfo::numDevs, and _DMXLocalInputInfo::private.

Referenced by dmxConsoleCapture().

static int scalex | ( | myPrivate * | priv,
|  | int | x |
| ) |  |  | `[static]`

References _myPrivate::xScale.

Referenced by dmxConsoleClearCursor(), dmxConsoleComputeWidthHeight(), dmxConsoleDraw(), dmxConsoleDrawFineCursor(), dmxConsoleDrawWindows(), dmxConsoleFunctions(), dmxConsoleInit(), dmxConsoleUpdateFineCursor(), and dmxConsoleUpdatePosition().

static int scaley | ( | myPrivate * | priv,
|  | int | y |
| ) |  |  | `[static]`

References _myPrivate::yScale.

Referenced by dmxConsoleClearCursor(), dmxConsoleComputeWidthHeight(), dmxConsoleDraw(), dmxConsoleDrawFineCursor(), dmxConsoleDrawWindows(), dmxConsoleFunctions(), dmxConsoleInit(), dmxConsoleUpdateFineCursor(), and dmxConsoleUpdatePosition().

static int unscalex | ( | myPrivate * | priv,
|  | int | x |
| ) |  |  | `[static]`

References _myPrivate::xScale.

Referenced by dmxConsoleMoveAbsolute().

static int unscaley | ( | myPrivate * | priv,
|  | int | y |
| ) |  |  | `[static]`

References _myPrivate::yScale.

Referenced by dmxConsoleMoveAbsolute().

Generated June 29, 2004 for Distributed Multihead X by doxygen 1.3.4. </addres>