Difference between revisions of "X11 locking"

From LinuxMCE
Jump to: navigation, search
m
Line 1: Line 1:
<table width="100%"> <tr><td bgcolor="#FFCFCF">This page was written by Pluto and imported with their permission when LinuxMCE branched off in February, 2007.  In general any information should apply to LinuxMCE.  However, this page should be edited to reflect changes to LinuxMCE and remove old references to Pluto.</td></tr> </table>
+
<table width="100%"> <tr><td bgcolor="#FFCFCF">This page was written by Pluto and imported with their permission when LinuxMCE branched off in February, 2007.  In general any information should apply to LinuxMCE.  However, this page should be edited to reflect changes to LinuxMCE and remove old references to Pluto.</td></tr> </table>== Using X11 locking in Orbiter ==
== Using X11 locking in Orbiter ==
+
  
    In OrbiterLinux there are 2 new functions:
+
In OrbiterLinux there are 2 new functions:
 
X_LockDisplay() and X_UnlockDisplay(); which should be used
 
X_LockDisplay() and X_UnlockDisplay(); which should be used
 
before and after calling X11/SDL functions which update the display, or change the mouse position
 
before and after calling X11/SDL functions which update the display, or change the mouse position
  
    Example:
+
Example:
class_name::some_drawing_function()
+
    class_name::some_drawing_function()
{
+
    {
    OrbiterLinux *pOrbiterLinux = dynamic_cast<OrbiterLinux *>(pOrbiter);
+
        OrbiterLinux *pOrbiterLinux = dynamic_cast<OrbiterLinux *>(pOrbiter);
    // or, better, make a member variable from pOrbiterLinux,
+
        // or, better, make a member variable from pOrbiterLinux,
    // and initialize it before this function would be called
+
        // and initialize it before this function would be called
 
+
       
    // non-critical code
+
        // non-critical code
 
+
       
    if (pOrbiterLinux)
+
        if (pOrbiterLinux)
        pOrbiterLinux->X_LockDisplay();
+
            pOrbiterLinux->X_LockDisplay();
 
+
       
    // critical code here
+
        // critical code here
 
+
       
    if (pOrbiterLinux)
+
        if (pOrbiterLinux)
        pOrbiterLinux->X_UnlockDisplay();
+
            pOrbiterLinux->X_UnlockDisplay();
 
+
       
    // non-critical code
+
        // non-critical code
}
+
    }
  
 
The dynamic_cast should return NULL only if you are not compiling the Linux version.
 
The dynamic_cast should return NULL only if you are not compiling the Linux version.
Line 30: Line 29:
 
== Links to documents ==
 
== Links to documents ==
 
http://svn.plutohome.com/pluto/trunk/src/docs/X11_PLUTO.txt
 
http://svn.plutohome.com/pluto/trunk/src/docs/X11_PLUTO.txt
 +
 
http://svn.plutohome.com/pluto/trunk/src/docs/X11_NOTES.txt
 
http://svn.plutohome.com/pluto/trunk/src/docs/X11_NOTES.txt

Revision as of 11:38, 3 May 2006

This page was written by Pluto and imported with their permission when LinuxMCE branched off in February, 2007. In general any information should apply to LinuxMCE. However, this page should be edited to reflect changes to LinuxMCE and remove old references to Pluto.
== Using X11 locking in Orbiter ==

In OrbiterLinux there are 2 new functions: X_LockDisplay() and X_UnlockDisplay(); which should be used before and after calling X11/SDL functions which update the display, or change the mouse position

Example:

   class_name::some_drawing_function()
   {
       OrbiterLinux *pOrbiterLinux = dynamic_cast<OrbiterLinux *>(pOrbiter);
       // or, better, make a member variable from pOrbiterLinux,
       // and initialize it before this function would be called
       
       // non-critical code
       
       if (pOrbiterLinux)
           pOrbiterLinux->X_LockDisplay();
       
       // critical code here
       
       if (pOrbiterLinux)
           pOrbiterLinux->X_UnlockDisplay();
       
       // non-critical code
   }

The dynamic_cast should return NULL only if you are not compiling the Linux version.

Links to documents

http://svn.plutohome.com/pluto/trunk/src/docs/X11_PLUTO.txt

http://svn.plutohome.com/pluto/trunk/src/docs/X11_NOTES.txt