X11 locking: Difference between revisions
Appearance
Rwilson131 (talk | contribs) mNo edit summary |
|||
| (3 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
[[Category: Programmer's Guide]] | |||
== 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 | ||
| Line 31: | Line 31: | ||
http://svn.plutohome.com/pluto/trunk/src/docs/X11_NOTES.txt | http://svn.plutohome.com/pluto/trunk/src/docs/X11_NOTES.txt | ||
Latest revision as of 18:51, 24 February 2008
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.