How to disable automatic sync to beam in Quartz ?

Quartz Debug resets the mode to "automatic" when it quits.
The Window Server debug state is global for the session, not per-process or per-window. If your app disables it, it should re-enable it upon quit; you should present a warning dialog to the user and let them make the decision.Here is an example code:
extern void CGSSetDebugOptions(int);
extern void CGSDeferredUpdates(int);

typedef enum {
disableBeamSync = 0,
automaticBeamSync = 1,
forcedBeamSyncMode = 2
} beamSyncMode;

beamSyncOption mode = disableBeamSync;

CGSSetDebugOptions(mode ? 0 : 0x08000000);