MacBook Air 11 inch Display Scrambled

I had the same display issue and I started reading the code to fix the issue.

We were using the following lines of code in main.c to get the number of bytes used to for a single row

if (floor(NSAppKitVersionNumber) > floor(NSAppKitVersionNumber10_6)) {
  [i]  [b]rfbScreen.paddedWidthInBytes = rfbScreen.width*rfbScreen.bitsPerPixel/8;[/b][/i]
}
else {
    rfbScreen.paddedWidthInBytes = CGDisplayBytesPerRow(displayID);
}

E.g. If the screen width is not divisible by 16, I am getting the above mentioned issue. So I went and changed

if (floor(NSAppKitVersionNumber) > floor(NSAppKitVersionNumber10_6)) {
  [i]  [b]CGImageRef imageRef = CGDisplayCreateImage(displayID);	
    rfbScreen.paddedWidthInBytes = CGImageGetBytesPerRow(imageRef);
    if (imageRef != NULL)
    CGImageRelease(imageRef);[/b][/i]

}
else {
    rfbScreen.paddedWidthInBytes = CGDisplayBytesPerRow(displayID);
}

This looks working to me, but I have not tested in different resolutions.
Please let me know if anyone has any comments.