[changeset] Missing ScreenSize & ScreenPixelsPerInch properties

Ben Abbott bpabbott at mac.com
Thu Jan 22 08:29:57 CST 2009


On Wednesday, January 21, 2009, at 09:56PM, "John W. Eaton" <jwe at octave.org> wrote:
>On 13-Nov-2008, Ben Abbott wrote:
>
>| This changeset adds the properties "screensize" and  
>| "screenpixelsperinch" to the root object.
>| 
>| To set the property values local to my machine I've added the lines  
>| below to my ~/.octaverc
>| 
>| 	set (0, "screensize", [1 1 1440 900])
>| 	set (0, "screenpixelsperinch", 74.951])
>| 
>| Those value correspond to my Mac PowerBook. The defaults should  
>| probably be;
>| 
>| 	set (0, "screensize", [1 1 1024 768])
>| 	set (0, "screenpixelsperinch", 72])
>
>I checked in the two patches
>
>  http://hg.savannah.gnu.org/hgweb/octave/rev/66165de2cc42
>  http://hg.savannah.gnu.org/hgweb/octave/rev/5cc594679cdc
>
>so that Octave will now get values for these properties from the
>system if it is using X11.  But I don't know how to do the same for
>Windows or OS X (without X11).  So it would be helpful if someone who
>does know could submit a changeset to add the appropriate code in the
>new display_info::init function.

On Mac OSX there is a compressed XML file ...

        /Library/Preferences/com.apple.windowserver.plist

... which contains the screen width/height/depth (supports several displays as well). It does not contain dpi info though.

In any event, would it be acceptable to parse the info via a system call? For example, ...

$ /usr/libexec/PlistBuddy -c "Print :DisplaySets:0:0:Depth" /Library/Preferences/com.apple.windowserver.plist
4

$ /usr/libexec/PlistBuddy -c "Print :DisplaySets:0:0:Width" /Library/Preferences/com.apple.windowserver.plist
1280

$ /usr/libexec/PlistBuddy -c "Print :DisplaySets:0:0:Height" /Library/Preferences/com.apple.windowserver.plist
1024

Better yet, if octave is able to parse compressed XML files, the information can be read directly.

Ben




More information about the Octave-maintainers mailing list