Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXi Yan2019-04-01 13:17:47 -0400
committerXi Yan2019-04-01 13:17:47 -0400
commit5cd547013e057edf020e3f048738eda50818fdb3 (patch)
tree3e213e548f4dc95dda1c3f01951b45d955562c7e
parent5db172a429a6c933259f091ef7e4ddb493a01f31 (diff)
downloadeclipse.platform.swt-5cd547013e057edf020e3f048738eda50818fdb3.tar.gz
eclipse.platform.swt-5cd547013e057edf020e3f048738eda50818fdb3.tar.xz
eclipse.platform.swt-5cd547013e057edf020e3f048738eda50818fdb3.zip
Bug 545994 - [GTK3][Tree] Visible area moved when only expanding element
Fix tree jump regression from bug 489751. Do not set Tree selection to first item. Keep track of TreeItem parent and deselect GtkTreeSelection after item is disposed. Remove /*int*/ cast. Tested with Bug489751_TreeItemDisposeSelect, Eclipse on X11 and Wayland. Change-Id: Ice0fbe7d4e656ce63a89cddf2fba5c990c26e085 Signed-off-by: Xi Yan <xixiyan@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java5
3 files changed, 12 insertions, 11 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
index c0b33d73db..f2ba212bac 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
@@ -11404,17 +11404,17 @@ JNIEXPORT jlong JNICALL GTK_NATIVE(_1gtk_1tree_1view_1get_1columns)
#ifndef NO__1gtk_1tree_1view_1get_1cursor
JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1tree_1view_1get_1cursor)
- (JNIEnv *env, jclass that, jlong arg0, jintLongArray arg1, jintLongArray arg2)
+ (JNIEnv *env, jclass that, jlong arg0, jlongArray arg1, jlongArray arg2)
{
- jintLong *lparg1=NULL;
- jintLong *lparg2=NULL;
+ jlong *lparg1=NULL;
+ jlong *lparg2=NULL;
GTK_NATIVE_ENTER(env, that, _1gtk_1tree_1view_1get_1cursor_FUNC);
- if (arg1) if ((lparg1 = (*env)->GetIntLongArrayElements(env, arg1, NULL)) == NULL) goto fail;
- if (arg2) if ((lparg2 = (*env)->GetIntLongArrayElements(env, arg2, NULL)) == NULL) goto fail;
+ if (arg1) if ((lparg1 = (*env)->GetLongArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ if (arg2) if ((lparg2 = (*env)->GetLongArrayElements(env, arg2, NULL)) == NULL) goto fail;
gtk_tree_view_get_cursor((GtkTreeView *)arg0, (GtkTreePath **)lparg1, (GtkTreeViewColumn **)lparg2);
fail:
- if (arg2 && lparg2) (*env)->ReleaseIntLongArrayElements(env, arg2, lparg2, 0);
- if (arg1 && lparg1) (*env)->ReleaseIntLongArrayElements(env, arg1, lparg1, 0);
+ if (arg2 && lparg2) (*env)->ReleaseLongArrayElements(env, arg2, lparg2, 0);
+ if (arg1 && lparg1) (*env)->ReleaseLongArrayElements(env, arg1, lparg1, 0);
GTK_NATIVE_EXIT(env, that, _1gtk_1tree_1view_1get_1cursor_FUNC);
}
#endif
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java
index 250785978c..e45bcb2fc7 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java
@@ -8076,8 +8076,8 @@ public class GTK extends OS {
* @param path cast=(GtkTreePath **)
* @param focus_column cast=(GtkTreeViewColumn **)
*/
- public static final native void _gtk_tree_view_get_cursor(long tree_view, long /*int*/[] path, long /*int*/[] focus_column);
- public static final void gtk_tree_view_get_cursor(long tree_view, long /*int*/[] path, long /*int*/[] focus_column) {
+ public static final native void _gtk_tree_view_get_cursor(long tree_view, long [] path, long [] focus_column);
+ public static final void gtk_tree_view_get_cursor(long tree_view, long [] path, long [] focus_column) {
lock.lock();
try {
_gtk_tree_view_get_cursor(tree_view, path, focus_column);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java
index fd6199efa9..273436bfb3 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java
@@ -1094,11 +1094,12 @@ void releaseWidget () {
@Override
public void dispose () {
// Workaround to Bug489751, avoid selecting next node when selected node is disposed.
+ Tree tmpParent = null;
if (parent != null && parent.getItemCount() > 0 && parent.getSelectionCount() == 0) {
- parent.setSelection(parent.getItem(0));
- parent.deselectAll();
+ tmpParent = parent;
}
super.dispose();
+ if (tmpParent != null) tmpParent.deselectAll();
}
/**

Back to the top