Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Wouldnt that require us to migrate from the current 10.4 sdk which 
everything is built against to the latest 10.7 in regards to API's?

Not necessarily. This is not a technical list, so this will probably make the
eyes glaze over for most readers, but still:

As long as only calling new instance methods of existing classes, and adding new
instance methods to existing subclass implementations (hopefully I got the
Objective-C terminology right) is involved, it can be done quite nicely to be
optional at run-time and compiling fine against the 10.4 SDK.

Example, from my experimental patch to vcl/aqua/source/window/salframe.cxx:

// On 10.7 and later, If the window has a title bar and is
// resizable, we make it full-screenable. The ideal would be to do
// it only for document windows, but how to figure out that?
if (GetSalData()->mnSystemVersion >= 0x1070) {
  if ((mnStyleMask & NSTitledWindowMask) 
      && (mnStyleMask & NSResizableWindowMask)) {
    // If compiled against a SDK version earlier than 10.7
    // NSWindowCollectionBehaviorFullScreenPrimary won't be
    // defined so define it ourselves. Note that we can't use
    // MAC_OS_X_VERSION_10_7 in this #if as such a macro is
    // not defined in earlier SDKs...

#if MAC_OS_X_VERSION_MAX_ALLOWED < 1070
    enum {
      NSWindowCollectionBehaviorFullScreenPrimary = (1 << 7)
    };
#endif

    int behavior = (int) objc_msgSend(mpWindow, @selector(collectionBehavior));
    behavior |= NSWindowCollectionBehaviorFullScreenPrimary;

    objc_msgSend(mpWindow, @selector(setCollectionBehavior:), behavior);
  }
}

Note the use of objc_msgSend and @selector there. Using normal Objective-C
syntactic sugar and calling [mpWindow collectionBehavior] and [mpWindow
setCollectionBehavior: behavior] would not compile against the 10.4 SDK as
collectionBehavior is present only in the 10.5 SDK and later. 

Compiles fine against the 10.4 SDK, works as intended on 10.7. Should work fine
on earlier OSes, too, but I haven't verified that.

--tml



-- 
Unsubscribe instructions: E-mail to discuss+help@documentfoundation.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.documentfoundation.org/www/discuss/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.