diff options
author | Felipe Heidrich <fheidric> | 2009-11-20 22:23:58 +0000 |
---|---|---|
committer | Felipe Heidrich <fheidric> | 2009-11-20 22:23:58 +0000 |
commit | d5f017a2e1351cda1ec08304c52846186e9dc7b5 (patch) | |
tree | fc3e1d4c002805a17ddab3a0337c23dca78d7cc1 | |
parent | 491ee4b96e01eebd57ff64561cf636dbd3beb626 (diff) | |
download | eclipse.platform.swt-d5f017a2e1351cda1ec08304c52846186e9dc7b5.tar.gz eclipse.platform.swt-d5f017a2e1351cda1ec08304c52846186e9dc7b5.tar.xz eclipse.platform.swt-d5f017a2e1351cda1ec08304c52846186e9dc7b5.zip |
Bug 274963 - Can't restore column widths
6 files changed, 84 insertions, 2 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 bdb4ea46e9..8e2bad70ad 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 @@ -15380,6 +15380,18 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1widget_1get_1parent) } #endif +#ifndef NO__1gtk_1widget_1get_1parent_1window +JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1widget_1get_1parent_1window) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1gtk_1widget_1get_1parent_1window_FUNC); + rc = (jintLong)gtk_widget_get_parent_window((GtkWidget *)arg0); + OS_NATIVE_EXIT(env, that, _1gtk_1widget_1get_1parent_1window_FUNC); + return rc; +} +#endif + #ifndef NO__1gtk_1widget_1get_1size_1request JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1widget_1get_1size_1request) (JNIEnv *env, jclass that, jintLong arg0, jintArray arg1, jintArray arg2) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c index 02037298d8..bbd3692eeb 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c @@ -18,8 +18,8 @@ #ifdef NATIVE_STATS -int OS_nativeFunctionCount = 1327; -int OS_nativeFunctionCallCount[1327]; +int OS_nativeFunctionCount = 1328; +int OS_nativeFunctionCallCount[1328]; char * OS_nativeFunctionNames[] = { #ifndef JNI64 "Call__IIII", @@ -1235,6 +1235,7 @@ char * OS_nativeFunctionNames[] = { "_1gtk_1widget_1get_1modifier_1style", "_1gtk_1widget_1get_1pango_1context", "_1gtk_1widget_1get_1parent", + "_1gtk_1widget_1get_1parent_1window", "_1gtk_1widget_1get_1size_1request", "_1gtk_1widget_1get_1style", "_1gtk_1widget_1get_1toplevel", diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h index fe0bc5e60a..7844db3ad2 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h @@ -1243,6 +1243,7 @@ typedef enum { _1gtk_1widget_1get_1modifier_1style_FUNC, _1gtk_1widget_1get_1pango_1context_FUNC, _1gtk_1widget_1get_1parent_FUNC, + _1gtk_1widget_1get_1parent_1window_FUNC, _1gtk_1widget_1get_1size_1request_FUNC, _1gtk_1widget_1get_1style_FUNC, _1gtk_1widget_1get_1toplevel_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java index fa474402ad..65890e7565 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java @@ -12390,6 +12390,16 @@ public static final int /*long*/ gtk_widget_get_parent(int /*long*/ widget) { } } /** @param widget cast=(GtkWidget *) */ +public static final native int /*long*/ _gtk_widget_get_parent_window(int /*long*/ widget); +public static final int /*long*/ gtk_widget_get_parent_window(int /*long*/ widget) { + lock.lock(); + try { + return _gtk_widget_get_parent_window(widget); + } finally { + lock.unlock(); + } +} +/** @param widget cast=(GtkWidget *) */ public static final native int /*long*/ _gtk_widget_get_style(int /*long*/ widget); public static final int /*long*/ gtk_widget_get_style(int /*long*/ widget) { lock.lock(); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java index 807c526499..e0ab44f873 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java @@ -696,6 +696,35 @@ public void setWidth (int width) { if (width != 0) OS.gtk_widget_realize (parent.handle); OS.gtk_tree_view_column_set_visible (handle, width != 0); lastWidth = width; + /* + * Bug in GTK. When the column is made visible the event window of column + * header is raised above the gripper window of the previous column. In + * some cases, this can cause the previous column to be not resizable by + * the mouse. The fix is to find the event window and lower it to bottom to + * the z-order stack. + */ + if (width != 0) { + if (buttonHandle != 0) { + int /*long*/ window = OS.gtk_widget_get_parent_window (buttonHandle); + if (window != 0) { + int /*long*/ windowList = OS.gdk_window_get_children (window); + if (windowList != 0) { + int /*long*/ windows = windowList; + int /*long*/ [] userData = new int /*long*/ [1]; + while (windows != 0) { + int /*long*/ child = OS.g_list_data (windows); + OS.gdk_window_get_user_data (child, userData); + if (userData[0] == buttonHandle) { + OS.gdk_window_lower (child); + break; + } + windows = OS.g_list_next (windows); + } + OS.g_list_free (windowList); + } + } + } + } sendEvent (SWT.Resize); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java index ea79cd0b57..115c7f8299 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java @@ -691,6 +691,35 @@ public void setWidth (int width) { if (width != 0) OS.gtk_widget_realize (parent.handle); OS.gtk_tree_view_column_set_visible (handle, width != 0); lastWidth = width; + /* + * Bug in GTK. When the column is made visible the event window of column + * header is raised above the gripper window of the previous column. In + * some cases, this can cause the previous column to be not resizable by + * the mouse. The fix is to find the event window and lower it to bottom to + * the z-order stack. + */ + if (width != 0) { + if (buttonHandle != 0) { + int /*long*/ window = OS.gtk_widget_get_parent_window (buttonHandle); + if (window != 0) { + int /*long*/ windowList = OS.gdk_window_get_children (window); + if (windowList != 0) { + int /*long*/ windows = windowList; + int /*long*/ [] userData = new int /*long*/ [1]; + while (windows != 0) { + int /*long*/ child = OS.g_list_data (windows); + OS.gdk_window_get_user_data (child, userData); + if (userData[0] == buttonHandle) { + OS.gdk_window_lower (child); + break; + } + windows = OS.g_list_next (windows); + } + OS.g_list_free (windowList); + } + } + } + } sendEvent (SWT.Resize); } |