Merge pull request #50 from Psychtoolbox-3/master

Resync with current master of official Psychtoolbox-3 repo.
Screen: Resync GLEW with moglcore's GLEW, ie., update to 1.11.0

No need to do it, Screen doesn't need a new GLEW, but do it for
consistency with moglcore to avoid confusion.

-> Screen.mex for 64-Bit Octave on Linux rebuilt.
OSX: Add modified version of mkoctfile-3.8.0 for OSX + Octave builds.

We need a slightly modified version of mkoctfile-3.8.0 for building
PTB on Octave 3.8.x on OSX, as it encodes a path and version of compiler
to use which is incompatible with both OSX 10.9 and 10.10, also stuff
related to maxosx-min-version and SDK root.

Document this by adding the file to our Source/ folder, so we won't
get confused next time we want to test building on Octave on a new
build machine.
Screen/Linux: Fix especially embarrassing compiler warnings.

Found when building against recent gcc’s with all warnings enabled.
These are real bugs, although all of them were dormant so far - not
actually triggered in the real world.
There are tons more spurious warnings, e.g., unused parameter warnings,
which i’ll leave alone for now. Not bored enough.
Update Xcode project file a bit for OS X 10.10.

Just so that there’s less whining from the IDE.
OSX: Upgrade to OSX 10.10 Yosemite SDK / Xcode 6.1.

Use the 10.10 SDK now, building for 10.8 - 10.10.
Use new Xcode 6.1 compiler toolchain.
Test rebuild of all mex files shows it working.
Bump version of officially supported OS X to 10.10.

-> Rebuilt Screen to display new support status.
-> From now on, only OS X 10.10 Yosemite will receive testing or bug
fixes or any other sympathy.
OSX: Remove use of Gestalt(), adapt M-Files...

The iPhone company deprecated Gestalt() for future removal. Thanks,
idiots of Cupertino!
Rewrite Screen() and PsychTimeGlue to do without it: On OS X 10.9+ we
use some equivalent but more painful to use NSProcess Cocoa API for
Screen(), and some sysctl for code outside Screen mex where we can’t
easily access Cocoa api’s.

PsychGetOSXMinorVersion() works in all mex files, but only reports the
OS X minor version - the x in 10.x.y. It derives it from the Darwin
kernel major version, hoping that the mapping OS X minor = darwin major
- 4 stays stable in the future.

PsychCocoaGetOSXVersion() is only accessible from within Screen mex,
but provides the full major.minor.patchlevel string as Gestalt() did.
On OS X 10.10 that is, and presumably on 10.9, although there this
wasn’t public api. On 10.8 the new method will not work. From failure
we conclude we are on OS X 10.8 and simply return a hard-coded 10.8.5
version spec, as that was the last 10.8 version before the iPhone
company lost interest in maintaining their product. If you are on a
different 10.8 version - bad luck.

Adapt MacModelName and IsMinimumOSXVersion m-files to use the output of
Screen(‘Computer’) instead of Gestalt. Add a deprecation warning to
AppleVersion.m, which can’t be fixed and will simply die in some future
OS X version.

Suppress deprecation warnings for Gestalt mex, as there isn’t anything
we could do about it. It will simply die in some future PTB + OS X
Combo with no replacement.

-> Screen and Gestalt mex files for OS X rebuilt.
OSX/TimeGlue: Replace deprecated functions, cleanup.

Replace deprecated UpTime() and some time conversion functions by their
mach_absolute_time() et al. counterparts. They return the same values
from the same timebase, just with a bit less hassle.

Throw away TickCount(), hard-code GetSecs time at tickCount zero to
zero. We don’t use this functionality anymore anyway.

-> Mex files compile now without such deprecation warnings, except for
some unrelated warnings in Screen().
Screen/OSX: Replace more deprecated functions.

CSCopyMachineName() and CSCopyUserName() got killed by the iPhone
company.
Replace them with more hacks and Objective-C convolutions.
Screen/OSX: Remove kernel driver compat wrappers.

Replace the old 32-Bit kernel compatibility wrappers by direct calls to
the new 64-Bit interfaces. Makes the code more simple to read and
maintain.
Remove unneeded leftover CGDisplayBeamposition() prototype.
Screen/OSX: Make ConserveVRAM setting 16384 less weird.

The only difference between regular and 16384 is that 16384 avoids
capturing the screen. Unfortunately this doesn’t make a difference in
performance at all.
There’s just no winning with this buggy piece of crap that Apple calls
an operating system.
All mex files for OSX rebuilt.

For PTB beta 3.0.12 SP2.

-> Only OS X 10.10 Yosemite is supported/tested from now on.
Screen: Remove old dead texture render swap code.

It was disabled and dead since may years and now got in the way. Remove
it.
Screen: Use windowRecord->VBL_Startline instead of recomputing.

No point recomputing at various places when we have the cached setting.
Also fixup ol’ Screen(‘WaitBlanking’) to handle non-fullscreen windows
better.
Screen: Add new screen glue function PsychGetScreenPixelSize()

Reports size of screens frame buffer in pixels, instead of logical size
units (points), as PsychGetScreenSize() / GetScreenRect() /
GetScreenGlobalRect() do.

In the past, size in points was equal to size in pixels, so no need for
this.
On OS X with Retina displays (HiDPI displays) the logical/virtual size
in points can be different from the “physical” size in pixels. E.g., on
a Retina panel in “best for Retina” scaled mode, 1 point == 2 pixels.
Sometimes we need the true size of the display in pixels, therefore
this new function.
On Linux and Windows, the new function is just an alias for
PsychGetScreenSize().
Screen/OSX: Fix misreporting of pixel color depth in PsychGetScreenDepths()

… ok, only for debug output, so this was irrelevant for production use.
Screen/OSX: Also report scaled HiDPI/Retina video modes.

So far these didn’t get enumerated, but some new optional parameter
kCGDisplayShowDuplicateLowResolutionModes for
CGDisplayCopyAllDisplayModes() now allows enumeration since OS X 10.8.

-> Fixes some whining of PTB about misdirected or omitted video modes
on Retina panels.
-> Allow video mode switching to and from Retina modes on OS X.
-> Our first hard requirement for OS X 10.8 as minimum operating system
version.
Screen/OSX: Move windowRecord->globalRect assignment where it belongs.
Screen/OSX: Assign windowRecord->VBL_Startline in Window glue.

Use new PsychGetScreenPixelSize() so it can cope with Retina scaled
modes and still report proper vblank startline.
Screen/OSX: Track windowRecord->globalRect and ->rect in glue code.

Cocoa glue now not only updates globalRect with virtual global display
coordinates in resolution independent unit of points, but also updates
the true backbuffer size of the window in pixels. Assignment is done at
OpenGL context assignment and for GUI windows at each move/resize.

This is needed because ‘rect’ must contain the true size of the windows
backbuffer in pixels, and this size can differ from the size in points
on HiDPI/Retina displays.