Use Extended Desktop - change with code.


I’m wondering if anyone has been able to change the,
“Use Extended Desktop” setting in GLUT preferences using code from inside the app.

I’m having to jump between apps quite often and would like the app to be able to set this setting when it first launches. Is this possible?



I do not really know, but i begin to search (intersting question ,indeed…)
It would have registry keys for windows to write…

Some googles results on extend monitor

VB script sendig keys :confused:

Good luck, nothing tested, just 15min search :slight_smile:

I would search for GLUT code to do this.

Also, If you exit the program with command+Q (not ESC) your glut preferences will be saved.

hey julapy! had some luck with this. can convert the plist file to xml and load it but get stuck with the limitations of ofxXmlSettings. Maybe tiny xml has some unwrapped functions that could help - will try that when I get a chance but in the meantime current code is:

    bool setGlutPreference(string _pref, string _val) {  
        //change plist from binary to xml  
        std::system( "plutil -convert xml1 ~/Library/Preferences/" );  
        //load XML  
        ofxXmlSettings XML;  
        if (!XML.loadFile("~/Library/Preferences/")) return false;//can't load prefs  
        //find pref  
        int which = -1;  
        int numKeys = XML.getNumTags("key");  
        for (int i=0; i<numKeys; i++)   
            string pref = XML.getValue("key","",i);  
            if (pref == _pref)   
                which = i;  
        if (which < 0) return false;//pref not found  
        //need to replace the tag after <key>_pref</key>  

if I could get the position of a tag within all tags at that level (rather than just tags of the same name) and replace a tag at that position+1 it would work.

alrighty, there’s a simpler method. can change it like so but changes only registered on app launch not on full screen toggle

std::system(“defaults write GLUTUseExtendedDesktopKey FALSE”);

nay, awesome find!

just to clear up,
you can changed the GLUTUseExtendedDesktopKey before the GLUT window is created.
so in your main.cpp you can do the below and it will work.

int main( )  
    bool bUseExtendedDesktop = true;  
    string cmd = "defaults write GLUTUseExtendedDesktopKey ";  
    cmd += bUseExtendedDesktop ? "TRUE" : "FALSE";   
    std::system( cmd.c_str() );  
    ofAppGlutWindow window;  
    ofSetupOpenGL( &window, 1024, 768, OF_FULLSCREEN ); // can be OF_WINDOW or OF_FULLSCREEN  
    ofRunApp( new testApp() );  

i am currently trying this in osx 10.8.5 with the new OF 0.8.0 and it does not work.
on the same computer with OF 0.7.3 it works.

we also lost the preference window for running apps.

in 0.8.0 we changed to use GLFW instead of GLUT so this won’t work anymore, if you need fullscreen across several monitors check this post: