From a1b263e4619b63f69d0fd681ac3cdcd7b459b1f0 Mon Sep 17 00:00:00 2001 From: dmitry Date: Thu, 4 Jul 2019 22:27:03 +0000 Subject: [PATCH] cocoa: fix the declaration of boolean use. #35792 git-svn-id: trunk@61529 - --- lcl/interfaces/cocoa/cocoa_extra.pas | 14 ++++++++++++++ lcl/interfaces/cocoa/cocoaprivate.pas | 10 ---------- lcl/interfaces/cocoa/cocoautils.pas | 4 ++-- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/lcl/interfaces/cocoa/cocoa_extra.pas b/lcl/interfaces/cocoa/cocoa_extra.pas index 9ad5096256..c0cc483d08 100644 --- a/lcl/interfaces/cocoa/cocoa_extra.pas +++ b/lcl/interfaces/cocoa/cocoa_extra.pas @@ -27,6 +27,16 @@ uses // Libs MacOSAll, CocoaAll; +type + // Due to backwards incompatible changes in FPC sources + // (switching from Boolean to Boolean8), LCL has to adopt + // either type, depending on FPC version + LCLObjCBoolean = {$ifdef HASBOOLEAN8} + Boolean8 // FPC 3.2.0 and earlier are using "boolean8" type + {$else} + Boolean // FPC 3.0.4 and earlier are using "boolean" type + {$endif}; + type NSImageScaling = NSUInteger; const // NSImageScaling values @@ -42,6 +52,10 @@ type {$ifdef BOOLFIX} ObjCBool = ShortInt; // Matches BOOL declaration in ObjC "signed char" + // Note that this is different than LCLObjCBoolean + // even though it's trying to resolve the same problem + // for FPC3.0.4. ObjCBool should be removed after the officail + // fpc3.2+ release NSMenuItemFix = objccategory external (NSMenuItem) procedure setEnabled_(aenabled: ObjCBool); message 'setEnabled:'; diff --git a/lcl/interfaces/cocoa/cocoaprivate.pas b/lcl/interfaces/cocoa/cocoaprivate.pas index a3b6bf7c9b..feee1bd7c8 100644 --- a/lcl/interfaces/cocoa/cocoaprivate.pas +++ b/lcl/interfaces/cocoa/cocoaprivate.pas @@ -46,16 +46,6 @@ const {$define HASBOOLEAN8} {$endif} -type - // Due to backwards incompatible changes in FPC sources - // (switching from Boolean to Boolean8), LCL has to adopt - // either type, depending on FPC version - LCLObjCBoolean = {$ifdef HASBOOLEAN8} - Boolean8 // FPC 3.2.0 and earlier are using "boolean8" type - {$else} - Boolean // FPC 3.0.4 and earlier are using "boolean" type - {$endif}; - type { ICommonCallback } diff --git a/lcl/interfaces/cocoa/cocoautils.pas b/lcl/interfaces/cocoa/cocoautils.pas index ba800351a8..57a43f3ab5 100644 --- a/lcl/interfaces/cocoa/cocoautils.pas +++ b/lcl/interfaces/cocoa/cocoautils.pas @@ -130,7 +130,7 @@ type procedure unmarkText; function selectedRange: NSRange; function markedRange: NSRange; - function hasMarkedText: Boolean; + function hasMarkedText: LCLObjCBoolean; function attributedSubstringForProposedRange_actualRange(aRange: NSRange; actualRange: NSRangePointer): NSAttributedString; function validAttributesForMarkedText: NSArray; function firstRectForCharacterRange_actualRange(aRange: NSRange; actualRange: NSRangePointer): NSRect; @@ -691,7 +691,7 @@ begin Result.length := 0; end; -function TCocoaInputClient.hasMarkedText: Boolean; +function TCocoaInputClient.hasMarkedText: LCLObjCBoolean; begin Result := false; end;