Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLakshmi Shanmugam2020-01-30 10:49:01 +0000
committerLakshmi Shanmugam2020-02-03 05:31:17 +0000
commitf5258910d1290329a1a4d5781e5a2ee8d222a13b (patch)
tree7a2f736b41cbc6b5ea26bb970105cf14637e2ddf
parent205d9e04cd805a08501f0f37898a4c202f672021 (diff)
downloadeclipse.platform.swt-f5258910d1290329a1a4d5781e5a2ee8d222a13b.tar.gz
eclipse.platform.swt-f5258910d1290329a1a4d5781e5a2ee8d222a13b.tar.xz
eclipse.platform.swt-f5258910d1290329a1a4d5781e5a2ee8d222a13b.zip
Bug 558584 - [10.15] Tree scrolls hiding items on macOS 10.15
On macOS 10.15, scrollRowToVisible() doesn't work properly if contentView's bounds are not set. Fix is to set bounds to the contentView Change-Id: Ib1777273cb284e6f2fef17aaa2fc5b84e4109a1a Signed-off-by: Lakshmi Shanmugam <lshanmug@in.ibm.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/AppKitFull.bridgesupport.extras4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSView.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/OS.java1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/Selector.java1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java25
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java25
6 files changed, 59 insertions, 3 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 83a6a749ec..d044e9f208 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
@@ -3766,6 +3766,10 @@
<arg swt_gen="true"></arg>
<retval swt_gen="true"></retval>
</method>
+ <method selector="setBoundsSize:" swt_gen="true">
+ <arg swt_gen="true"></arg>
+ <retval swt_gen="true"></retval>
+ </method>
<method selector="setFocusRingType:" 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/NSView.java b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSView.java
index d76fc2bcfd..ded4f58ea1 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSView.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/cocoa/org/eclipse/swt/internal/cocoa/NSView.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -235,6 +235,10 @@ public void setBoundsRotation(double boundsRotation) {
OS.objc_msgSend(this.id, OS.sel_setBoundsRotation_, boundsRotation);
}
+public void setBoundsSize(NSSize newSize) {
+ OS.objc_msgSend(this.id, OS.sel_setBoundsSize_, newSize);
+}
+
public void setFocusRingType(long focusRingType) {
OS.objc_msgSend(this.id, OS.sel_setFocusRingType_, focusRingType);
}
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 5969261bb3..02a437d64c 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
@@ -1680,6 +1680,7 @@ public static final long sel_setBorderType_ = Selector.sel_setBorderType_.value;
public static final long sel_setBorderWidth_ = Selector.sel_setBorderWidth_.value;
public static final long sel_setBordered_ = Selector.sel_setBordered_.value;
public static final long sel_setBoundsRotation_ = Selector.sel_setBoundsRotation_.value;
+public static final long sel_setBoundsSize_ = Selector.sel_setBoundsSize_.value;
public static final long sel_setBoxType_ = Selector.sel_setBoxType_.value;
public static final long sel_setButtonType_ = Selector.sel_setButtonType_.value;
public static final long sel_setCacheMode_ = Selector.sel_setCacheMode_.value;
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 da7586e234..c34b0edd3e 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
@@ -946,6 +946,7 @@ public enum Selector {
, sel_setBorderWidth_("setBorderWidth:")
, sel_setBordered_("setBordered:")
, sel_setBoundsRotation_("setBoundsRotation:")
+ , sel_setBoundsSize_("setBoundsSize:")
, sel_setBoxType_("setBoxType:")
, sel_setButtonType_("setButtonType:")
, sel_setCacheMode_("setCacheMode:")
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java
index 25a83b8856..0c7521e819 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Table.java
@@ -3187,7 +3187,30 @@ public void showColumn (TableColumn column) {
void showIndex (int index) {
if (0 <= index && index < itemCount) {
- ((NSTableView)view).scrollRowToVisible(index);
+ NSTableView tableView = (NSTableView)view;
+ if (tableView.headerView () == null) {
+ /**
+ * On macOS 10.15, scrollRowToVisible doesn't work properly if
+ * contentView's bounds is not set (i.e, width or height is 0).
+ * The contentView's bounds is set when the Table's header view is set.
+ * So don't call this code if Table has a header already.
+ */
+ NSClipView contentView = scrollView.contentView ();
+ if (contentView != null) {
+ NSRect contentViewBounds = contentView.bounds ();
+ if (contentViewBounds.height == 0 || contentViewBounds.width == 0) {
+ NSView documentView = scrollView.documentView ();
+ if (documentView != null) {
+ NSRect documentViewBounds = documentView.bounds ();
+ NSSize size = new NSSize ();
+ size.width = documentViewBounds.width;
+ size.height = documentViewBounds.height;
+ contentView.setBoundsSize (size);
+ }
+ }
+ }
+ }
+ tableView.scrollRowToVisible(index);
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java
index d2a01e8f07..40f9ca52f7 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Tree.java
@@ -3455,7 +3455,30 @@ void showItem (TreeItem item, boolean scroll) {
}
if (scroll) {
NSOutlineView outlineView = (NSOutlineView) view;
- outlineView.scrollRowToVisible (outlineView.rowForItem (item.handle));
+ if (outlineView.headerView () == null) {
+ /**
+ * On macOS 10.15, scrollRowToVisible doesn't work properly if
+ * contentView's bounds is not set (i.e, width or height is 0).
+ * The contentView's bounds is set when the Tree's header view is set.
+ * So don't call this code if Tree has a header already.
+ */
+ NSClipView contentView = scrollView.contentView ();
+ if (contentView != null) {
+ NSRect contentViewBounds = contentView.bounds ();
+ if (contentViewBounds.height == 0 || contentViewBounds.width == 0) {
+ NSView documentView = scrollView.documentView ();
+ if (documentView != null) {
+ NSRect documentViewBounds = documentView.bounds ();
+ NSSize size = new NSSize ();
+ size.width = documentViewBounds.width;
+ size.height = documentViewBounds.height;
+ contentView.setBoundsSize (size);
+ }
+ }
+ }
+ }
+ long rowForItem = outlineView.rowForItem (item.handle);
+ outlineView.scrollRowToVisible (rowForItem);
}
}

Back to the top