dmxcursor_8c.html   [plain text]


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
    <title>File Index</title>
    <link href="doxygen.css" rel="stylesheet" type="text/css">
  </head>
  <body>
<!-- Generated by Doxygen 1.3.4 -->
<div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
<h1>dmxcursor.c File Reference</h1><code>#include "<a class="el" href="dmx_8h-source.html">dmx.h</a>"</code><br>
<code>#include "<a class="el" href="dmxsync_8h-source.html">dmxsync.h</a>"</code><br>
<code>#include "<a class="el" href="dmxcursor_8h-source.html">dmxcursor.h</a>"</code><br>
<code>#include "<a class="el" href="dmxlog_8h-source.html">dmxlog.h</a>"</code><br>
<code>#include "<a class="el" href="dmxprop_8h-source.html">dmxprop.h</a>"</code><br>
<code>#include "<a class="el" href="dmxinput_8h-source.html">dmxinput.h</a>"</code><br>
<code>#include "mipointer.h"</code><br>
<code>#include "windowstr.h"</code><br>
<code>#include "globals.h"</code><br>
<code>#include "cursorstr.h"</code><br>
<code>#include "dixevents.h"</code><br>
<table border=0 cellpadding=0 cellspacing=0>
<tr><td></td></tr>
<tr><td colspan=2><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8c.html#a12">dmxCursorNoMulti</a> (void)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8c.html#a21">dmxReInitOrigins</a> (void)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8c.html#a22">dmxInitOrigins</a> (void)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8c.html#a23">dmxOnScreen</a> (int x, int y, <a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8c.html#a28">dmxInitOverlap</a> (void)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8c.html#a29">dmxBECreateCursor</a> (ScreenPtr pScreen, CursorPtr pCursor)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>Bool&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8c.html#a31">dmxBEFreeCursor</a> (ScreenPtr pScreen, CursorPtr pCursor)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8c.html#a38">dmxMoveCursor</a> (ScreenPtr pScreen, int x, int y)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8c.html#a40">dmxHideCursor</a> (<a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *dmxScreen)</td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8c.html#a41">dmxCheckCursor</a> (void)</td></tr>

<tr><td colspan=2><br><h2>Variables</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>miPointerScreenFuncRec&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8c.html#a10">dmxPointerCursorFuncs</a></td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>miPointerSpriteFuncRec&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dmxcursor_8c.html#a11">dmxPointerSpriteFuncs</a></td></tr>

</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
This file contains code than supports cursor movement, including the code that initializes and reinitializes the screen positions and computes screen overlap.<p>
"This code is based very closely on the XFree86 equivalent (xfree86/common/xf86Cursor.c)." --David Dawes.<p>
"This code was then extensively re-written, as explained here." --Rik Faith<p>
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.<p>
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.<hr><h2>Function Documentation</h2>
<a class="anchor" name="a29" doxytag="dmxcursor.c::dmxBECreateCursor" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void dmxBECreateCursor </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
          <td class="mdname" nowrap> <em>pScreen</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>CursorPtr&nbsp;</td>
          <td class="mdname" nowrap> <em>pCursor</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Create <em>pCursor</em> on the back-end associated with <em>pScreen</em>.     </td>
  </tr>
</table>
<a class="anchor" name="a31" doxytag="dmxcursor.c::dmxBEFreeCursor" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> Bool dmxBEFreeCursor </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
          <td class="mdname" nowrap> <em>pScreen</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>CursorPtr&nbsp;</td>
          <td class="mdname" nowrap> <em>pCursor</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Free <em>pCursor</em> on the back-end associated with <em>pScreen</em>.     </td>
  </tr>
</table>
<a class="anchor" name="a41" doxytag="dmxcursor.c::dmxCheckCursor" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void dmxCheckCursor </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
This routine is called during reconfiguration to make sure the cursor is visible.     </td>
  </tr>
</table>
<a class="anchor" name="a12" doxytag="dmxcursor.c::dmxCursorNoMulti" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void dmxCursorNoMulti </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Turn off support for displaying multiple cursors on overlapped back-end displays. See #dmxCursorDoMultiCursors.     </td>
  </tr>
</table>
<a class="anchor" name="a40" doxytag="dmxcursor.c::dmxHideCursor" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void dmxHideCursor </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>dmxScreen</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
This routine is used by the backend input routines to hide the cursor on a screen that is being used for relative input. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxbackend_8c.html">dmxbackend.c</a> </dd></dl>
    </td>
  </tr>
</table>
<a class="anchor" name="a22" doxytag="dmxcursor.c::dmxInitOrigins" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void dmxInitOrigins </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Initialize screen origins (and relative position). This is called for each server generation. For dynamic reconfiguration, use <a class="el" href="dmxcursor_8c.html#a21">dmxReInitOrigins()</a> instead.     </td>
  </tr>
</table>
<a class="anchor" name="a28" doxytag="dmxcursor.c::dmxInitOverlap" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void dmxInitOverlap </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Detects overlapping dmxScreens and creates circular lists. This uses an O(dmxNumScreens^2) algorithm, but dmxNumScreens is &lt; 100 and the computation only needs to be performed for every server generation or dynamic reconfiguration .     </td>
  </tr>
</table>
<a class="anchor" name="a38" doxytag="dmxcursor.c::dmxMoveCursor" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void dmxMoveCursor </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">ScreenPtr&nbsp;</td>
          <td class="mdname" nowrap> <em>pScreen</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>int&nbsp;</td>
          <td class="mdname" nowrap> <em>x</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>int&nbsp;</td>
          <td class="mdname" nowrap> <em>y</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Move the cursor to coordinates (<em>x</em>, <em>y</em>)on <em>pScreen</em>. This function is usually called via <a class="el" href="dmxcursor_8h.html#a4">dmxPointerSpriteFuncs</a>, except during reconfiguration when the cursor is repositioned to force an update on newley overlapping screens and on screens that no longer overlap.     </td>
  </tr>
</table>
<a class="anchor" name="a23" doxytag="dmxcursor.c::dmxOnScreen" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> int dmxOnScreen </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">int&nbsp;</td>
          <td class="mdname" nowrap> <em>x</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>int&nbsp;</td>
          <td class="mdname" nowrap> <em>y</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap><a class="el" href="struct__DMXScreenInfo.html">DMXScreenInfo</a> *&nbsp;</td>
          <td class="mdname" nowrap> <em>dmxScreen</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Returns non-zero if the global <em>x</em>, <em>y</em> coordinate is on the screen window of the <em>dmxScreen</em>.     </td>
  </tr>
</table>
<a class="anchor" name="a21" doxytag="dmxcursor.c::dmxReInitOrigins" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void dmxReInitOrigins </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">void&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Recompute origin information in the <a class="el" href="dmxinit_8c.html#a2">dmxScreens</a> list. This is either called from <a class="el" href="dmxcursor_8c.html#a22">dmxInitOrigins()</a> or from #dmxReconfig().     </td>
  </tr>
</table>
<hr><h2>Variable Documentation</h2>
<a class="anchor" name="a10" doxytag="dmxcursor.c::dmxPointerCursorFuncs" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> miPointerScreenFuncRec <a class="el" href="dmxcursor_8h.html#a3">dmxPointerCursorFuncs</a>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
<b>Initial value:</b><div class="fragment"><pre>
{
    dmxCursorOffScreen,
    dmxCrossScreen,
    dmxWarpCursor,
    <a class="code" href="dmxeq_8c.html#a13">dmxeqEnqueue</a>,
    <a class="code" href="dmxeq_8c.html#a14">dmxeqSwitchScreen</a>
}
</pre></div>Cursor functions for mi layer. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxcursor_8c.html">dmxcursor.c</a> <p>
<a class="el" href="dmxscrinit_8c.html">dmxscrinit.c</a> </dd></dl>
    </td>
  </tr>
</table>
<a class="anchor" name="a11" doxytag="dmxcursor.c::dmxPointerSpriteFuncs" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> miPointerSpriteFuncRec <a class="el" href="dmxcursor_8h.html#a4">dmxPointerSpriteFuncs</a>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
<b>Initial value:</b><div class="fragment"><pre>
{
    dmxRealizeCursor,
    dmxUnrealizeCursor,
    dmxSetCursor,
    <a class="code" href="dmxcursor_8c.html#a38">dmxMoveCursor</a>,
}
</pre></div>Sprite functions for mi layer. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="dmxcursor_8c.html">dmxcursor.c</a> <p>
<a class="el" href="dmxscrinit_8c.html">dmxscrinit.c</a> </dd></dl>
    </td>
  </tr>
</table>
    <hr>
    <address>
      <small>
        Generated June 29, 2004 for <a
        href="http://dmx.sourceforge.net">Distributed Multihead X</a> by
        <a href="http://www.doxygen.org/index.html">doxygen</a>
        1.3.4.
      </small>
    </addres>
    </hr>
  </body>
</html>