Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikita Nemkin2019-04-22 09:47:03 -0400
committerLakshmi Shanmugam2019-06-14 02:41:35 -0400
commit143a750b606afcb9465d03b28724ea61c02d1f04 (patch)
treecf5348221c2ddcd88d62f4c5d2ce6cbf63ed7f05 /bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse
parenteee77d9544f575efd95665a23adbfed79e841cc9 (diff)
downloadeclipse.platform.swt-143a750b606afcb9465d03b28724ea61c02d1f04.tar.gz
eclipse.platform.swt-143a750b606afcb9465d03b28724ea61c02d1f04.tar.xz
eclipse.platform.swt-143a750b606afcb9465d03b28724ea61c02d1f04.zip
Bug 547192 - [Cocoa] Replace deprecated Carbon functions (Part 1)
Deprecated function | Modern equivalent ------------------------------------------------------------------- Gestalt | NSProcessInfo.operatingSystemVersion GetDblTime | NSEvent.doubleClickInterval GetCurrentEventButtonState | NSEvent.pressedMouseButtons ATSFontActivateFromFileReference | CTFontManagerRegisterFontsForURL Change-Id: I7ba3e3da6c73117bc7800d022b8eba9fb3cc907a Signed-off-by: Nikita Nemkin <nikita@nemkin.ru>
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/CoreTextFull.bridgesupport.extras7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/FoundationFull.bridgesupport.extras13
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSEvent.java8
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSOperatingSystemVersion.java24
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSProcessInfo.java41
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java27
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/Selector.java4
8 files changed, 123 insertions, 7 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras
index 90fa40ec2d..f970f78fe4 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras
@@ -1277,6 +1277,9 @@
<method selector="deltaY" swt_gen="true">
<retval swt_gen="true"></retval>
</method>
+ <method class_method="true" selector="doubleClickInterval" swt_gen="true">
+ <retval swt_gen="true"></retval>
+ </method>
<method class_method="true" selector="enterExitEventWithType:location:modifierFlags:timestamp:windowNumber:context:eventNumber:trackingNumber:userData:" swt_gen="true">
<arg swt_gen="true"></arg>
<arg swt_gen="true"></arg>
@@ -1316,6 +1319,9 @@
<arg swt_gen="true"></arg>
<retval swt_gen="true"></retval>
</method>
+ <method class_method="true" selector="pressedMouseButtons" swt_gen="true">
+ <retval swt_gen="true"></retval>
+ </method>
<method selector="rotation" swt_gen="true">
<retval swt_gen="true"></retval>
</method>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/CoreTextFull.bridgesupport.extras b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/CoreTextFull.bridgesupport.extras
index bd180d9230..6d614bbddf 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/CoreTextFull.bridgesupport.extras
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/CoreTextFull.bridgesupport.extras
@@ -3,6 +3,7 @@
<constant name="kCTFontAttributeName" swt_gen="true"></constant>
<constant name="kCTForegroundColorAttributeName" swt_gen="true"></constant>
<constant name="kCTParagraphStyleAttributeName" swt_gen="true"></constant>
+ <enum name="kCTFontManagerScopeProcess" swt_gen="true"></enum>
<enum name="kCTParagraphStyleSpecifierBaseWritingDirection" swt_gen="true"></enum>
<enum name="kCTWritingDirectionLeftToRight" swt_gen="true"></enum>
<enum name="kCTWritingDirectionNatural" swt_gen="true"></enum>
@@ -19,6 +20,12 @@
<arg swt_gen="true"></arg>
<retval swt_gen="true"></retval>
</function>
+ <function name="CTFontManagerRegisterFontsForURL" swt_gen="true">
+ <arg swt_gen="true"></arg>
+ <arg swt_gen="true"></arg>
+ <arg swt_gen="true"></arg>
+ <retval swt_gen="true"></retval>
+ </function>
<function name="CTLineCreateWithAttributedString" swt_gen="true">
<arg swt_gen="true"></arg>
<retval swt_gen="true"></retval>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/FoundationFull.bridgesupport.extras b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/FoundationFull.bridgesupport.extras
index 8617aa1c03..940e398314 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/FoundationFull.bridgesupport.extras
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/FoundationFull.bridgesupport.extras
@@ -826,6 +826,14 @@
</class>
<class name="NSPortCoder" swt_superclass="NSCoder">
</class>
+ <class name="NSProcessInfo" swt_gen="mixed">
+ <method selector="operatingSystemVersion" swt_gen="true">
+ <retval swt_gen="true"></retval>
+ </method>
+ <method class_method="true" selector="processInfo" swt_gen="true">
+ <retval swt_gen="true"></retval>
+ </method>
+ </class>
<class name="NSProtocolChecker" swt_superclass="NSProxy">
</class>
<class name="NSQuitCommand" swt_superclass="NSScriptCommand">
@@ -1227,6 +1235,11 @@
<field name="tX" swt_gen="true"></field>
<field name="tY" swt_gen="true"></field>
</struct>
+ <struct name="NSOperatingSystemVersion" swt_gen="true">
+ <field name="majorVersion" swt_gen="true"></field>
+ <field name="minorVersion" swt_gen="true"></field>
+ <field name="patchVersion" swt_gen="true"></field>
+ </struct>
<struct name="NSPoint" swt_gen="true" swt_gen_memmove="true" swt_gen_tostring="true">
<field name="x" swt_gen="true"></field>
<field name="y" swt_gen="true"></field>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSEvent.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSEvent.java
index 789b1ac266..f761e7f8db 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSEvent.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSEvent.java
@@ -57,6 +57,10 @@ public double deltaY() {
return OS.objc_msgSend_fpret(this.id, OS.sel_deltaY);
}
+public static double doubleClickInterval() {
+ return OS.objc_msgSend_fpret(OS.class_NSEvent, OS.sel_doubleClickInterval);
+}
+
public static NSEvent enterExitEventWithType(long type, NSPoint location, long flags, double time, long wNum, NSGraphicsContext context, long eNum, long tNum, long data) {
long result = OS.objc_msgSend(OS.class_NSEvent, OS.sel_enterExitEventWithType_location_modifierFlags_timestamp_windowNumber_context_eventNumber_trackingNumber_userData_, type, location, flags, time, wNum, context != null ? context.id : 0, eNum, tNum, data);
return result != 0 ? new NSEvent(result) : null;
@@ -91,6 +95,10 @@ public static NSEvent otherEventWithType(long type, NSPoint location, long flags
return result != 0 ? new NSEvent(result) : null;
}
+public static long pressedMouseButtons() {
+ return OS.objc_msgSend(OS.class_NSEvent, OS.sel_pressedMouseButtons);
+}
+
public float rotation() {
return OS.objc_msgSend_floatret(this.id, OS.sel_rotation);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSOperatingSystemVersion.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSOperatingSystemVersion.java
new file mode 100644
index 0000000000..6e30236790
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSOperatingSystemVersion.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.internal.cocoa;
+
+public class NSOperatingSystemVersion {
+ /** @field cast=(NSInteger) */
+ public long majorVersion;
+ /** @field cast=(NSInteger) */
+ public long minorVersion;
+ /** @field cast=(NSInteger) */
+ public long patchVersion;
+ public static final int sizeof = OS.NSOperatingSystemVersion_sizeof();
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSProcessInfo.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSProcessInfo.java
new file mode 100644
index 0000000000..70c58d8f0d
--- /dev/null
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSProcessInfo.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.internal.cocoa;
+
+public class NSProcessInfo extends NSObject {
+
+public NSProcessInfo() {
+ super();
+}
+
+public NSProcessInfo(long id) {
+ super(id);
+}
+
+public NSProcessInfo(id id) {
+ super(id);
+}
+
+public NSOperatingSystemVersion operatingSystemVersion() {
+ NSOperatingSystemVersion result = new NSOperatingSystemVersion();
+ OS.objc_msgSend_stret(result, this.id, OS.sel_operatingSystemVersion);
+ return result;
+}
+
+public static NSProcessInfo processInfo() {
+ long result = OS.objc_msgSend(OS.class_NSProcessInfo, OS.sel_processInfo);
+ return result != 0 ? new NSProcessInfo(result) : null;
+}
+
+}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java
index cd774929e0..e053462734 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java
@@ -22,13 +22,6 @@ public class OS extends C {
}
public static final int VERSION;
- static {
- int [] major = new int [1], minor = new int [1], bugfix = new int [1];
- OS.Gestalt (OS.gestaltSystemVersionMajor, major);
- OS.Gestalt (OS.gestaltSystemVersionMinor, minor);
- OS.Gestalt (OS.gestaltSystemVersionBugFix, bugfix);
- VERSION = VERSION (major [0], minor [0], bugfix [0]);
- }
public static int VERSION (int major, int minor, int bugfix) {
return (major << 16) + (minor << 8) + bugfix;
@@ -872,6 +865,7 @@ public static final long class_NSPrintInfo = objc_getClass("NSPrintInfo");
public static final long class_NSPrintOperation = objc_getClass("NSPrintOperation");
public static final long class_NSPrintPanel = objc_getClass("NSPrintPanel");
public static final long class_NSPrinter = objc_getClass("NSPrinter");
+public static final long class_NSProcessInfo = objc_getClass("NSProcessInfo");
public static final long class_NSProgressIndicator = objc_getClass("NSProgressIndicator");
public static final long class_NSResponder = objc_getClass("NSResponder");
public static final long class_NSRunLoop = objc_getClass("NSRunLoop");
@@ -1322,6 +1316,7 @@ public static final long sel_documentView = Selector.sel_documentView.value;
public static final long sel_documentViewShouldHandlePrint = Selector.sel_documentViewShouldHandlePrint.value;
public static final long sel_documentVisibleRect = Selector.sel_documentVisibleRect.value;
public static final long sel_doubleClickAtIndex_ = Selector.sel_doubleClickAtIndex_.value;
+public static final long sel_doubleClickInterval = Selector.sel_doubleClickInterval.value;
public static final long sel_doubleValue = Selector.sel_doubleValue.value;
public static final long sel_download = Selector.sel_download.value;
public static final long sel_download_decideDestinationWithSuggestedFilename_ = Selector.sel_download_decideDestinationWithSuggestedFilename_.value;
@@ -1678,6 +1673,7 @@ public static final long sel_openFile_withApplication_ = Selector.sel_openFile_w
public static final long sel_openPanel = Selector.sel_openPanel.value;
public static final long sel_openURL_ = Selector.sel_openURL_.value;
public static final long sel_openURLs_withAppBundleIdentifier_options_additionalEventParamDescriptor_launchIdentifiers_ = Selector.sel_openURLs_withAppBundleIdentifier_options_additionalEventParamDescriptor_launchIdentifiers_.value;
+public static final long sel_operatingSystemVersion = Selector.sel_operatingSystemVersion.value;
public static final long sel_operationNotAllowedCursor = Selector.sel_operationNotAllowedCursor.value;
public static final long sel_options = Selector.sel_options.value;
public static final long sel_orderBack_ = Selector.sel_orderBack_.value;
@@ -1747,6 +1743,7 @@ public static final long sel_port = Selector.sel_port.value;
public static final long sel_postEvent_atStart_ = Selector.sel_postEvent_atStart_.value;
public static final long sel_preparedCellAtColumn_row_ = Selector.sel_preparedCellAtColumn_row_.value;
public static final long sel_prependTransform_ = Selector.sel_prependTransform_.value;
+public static final long sel_pressedMouseButtons = Selector.sel_pressedMouseButtons.value;
public static final long sel_preventDefault = Selector.sel_preventDefault.value;
public static final long sel_previousFailureCount = Selector.sel_previousFailureCount.value;
public static final long sel_printDocumentView = Selector.sel_printDocumentView.value;
@@ -1757,6 +1754,7 @@ public static final long sel_printSettings = Selector.sel_printSettings.value;
public static final long sel_printer = Selector.sel_printer.value;
public static final long sel_printerNames = Selector.sel_printerNames.value;
public static final long sel_printerWithName_ = Selector.sel_printerWithName_.value;
+public static final long sel_processInfo = Selector.sel_processInfo.value;
public static final long sel_propertyListForType_ = Selector.sel_propertyListForType_.value;
public static final long sel_proposedCredential = Selector.sel_proposedCredential.value;
public static final long sel_protectionSpace = Selector.sel_protectionSpace.value;
@@ -2664,6 +2662,7 @@ public static final int kCGPathStroke = 2;
public static final int kCGScrollEventUnitLine = 1;
public static final int kCGScrollEventUnitPixel = 0;
public static final int kCGTextFillStroke = 2;
+public static final int kCTFontManagerScopeProcess = 1;
public static final int kCTParagraphStyleSpecifierBaseWritingDirection = 13;
public static final int kCTWritingDirectionLeftToRight = 0;
public static final int kCTWritingDirectionNatural = -1;
@@ -3739,6 +3738,12 @@ public static final native double CTFontGetDescent(long font);
*/
public static final native double CTFontGetLeading(long font);
/**
+ * @param fontURL cast=(CFURLRef)
+ * @param scope cast=(CTFontManagerScope)
+ * @param error cast=(CFErrorRef*)
+ */
+public static final native boolean CTFontManagerRegisterFontsForURL(long fontURL, int scope, long error);
+/**
* @param attrString cast=(CFAttributedStringRef)
*/
public static final native long CTLineCreateWithAttributedString(long attrString);
@@ -4235,6 +4240,8 @@ public static final native long objc_msgSend(long id, long sel, long[] arg0, lon
/** @method flags=cast */
public static final native void objc_msgSend_stret(NSAffineTransformStruct result, long id, long sel);
/** @method flags=cast */
+public static final native void objc_msgSend_stret(NSOperatingSystemVersion result, long id, long sel);
+/** @method flags=cast */
public static final native void objc_msgSend_stret(NSPoint result, long id, long sel);
/**
* @method flags=cast
@@ -4329,6 +4336,7 @@ public static final native int CGRect_sizeof();
public static final native int CGSize_sizeof();
public static final native int CTParagraphStyleSetting_sizeof();
public static final native int NSAffineTransformStruct_sizeof();
+public static final native int NSOperatingSystemVersion_sizeof();
public static final native int NSPoint_sizeof();
public static final native int NSRange_sizeof();
public static final native int NSRect_sizeof();
@@ -4389,4 +4397,9 @@ public static final native void memmove(NSSize dest, long src, long size);
/** This section is auto generated */
+static {
+ NSOperatingSystemVersion version = NSProcessInfo.processInfo().operatingSystemVersion();
+ VERSION = VERSION ((int)version.majorVersion, (int)version.minorVersion, (int)version.patchVersion);
+}
+
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/Selector.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/Selector.java
index ef483afb8e..6045f563fc 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/Selector.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/Selector.java
@@ -427,6 +427,7 @@ public enum Selector {
, sel_documentViewShouldHandlePrint("documentViewShouldHandlePrint")
, sel_documentVisibleRect("documentVisibleRect")
, sel_doubleClickAtIndex_("doubleClickAtIndex:")
+ , sel_doubleClickInterval("doubleClickInterval")
, sel_doubleValue("doubleValue")
, sel_download("download")
, sel_download_decideDestinationWithSuggestedFilename_("download:decideDestinationWithSuggestedFilename:")
@@ -783,6 +784,7 @@ public enum Selector {
, sel_openPanel("openPanel")
, sel_openURL_("openURL:")
, sel_openURLs_withAppBundleIdentifier_options_additionalEventParamDescriptor_launchIdentifiers_("openURLs:withAppBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifiers:")
+ , sel_operatingSystemVersion("operatingSystemVersion")
, sel_operationNotAllowedCursor("operationNotAllowedCursor")
, sel_options("options")
, sel_orderBack_("orderBack:")
@@ -852,6 +854,7 @@ public enum Selector {
, sel_postEvent_atStart_("postEvent:atStart:")
, sel_preparedCellAtColumn_row_("preparedCellAtColumn:row:")
, sel_prependTransform_("prependTransform:")
+ , sel_pressedMouseButtons("pressedMouseButtons")
, sel_preventDefault("preventDefault")
, sel_previousFailureCount("previousFailureCount")
, sel_printDocumentView("printDocumentView")
@@ -862,6 +865,7 @@ public enum Selector {
, sel_printer("printer")
, sel_printerNames("printerNames")
, sel_printerWithName_("printerWithName:")
+ , sel_processInfo("processInfo")
, sel_propertyListForType_("propertyListForType:")
, sel_proposedCredential("proposedCredential")
, sel_protectionSpace("protectionSpace")

Back to the top