summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorAnatoly Spektor2012-10-17 13:50:06 (EDT)
committer Alexander Kurtakov2012-10-17 14:51:35 (EDT)
commit35f130070627930dae79842022c951694c5a3dfa (patch)
tree2dbb544349562d0c5e42d0e19dd7deaece497962
parented640c3e8cb9e6f5b49b8c43cbe44d558e655cc7 (diff)
downloadeclipse.platform.swt-35f130070627930dae79842022c951694c5a3dfa.zip
eclipse.platform.swt-35f130070627930dae79842022c951694c5a3dfa.tar.gz
eclipse.platform.swt-35f130070627930dae79842022c951694c5a3dfa.tar.bz2
Use gtk_widget_get_preferred_size() instead gtk_widget_size_request ()
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c33
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java8
20 files changed, 84 insertions, 19 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 78b14ec..4ca1b92 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
@@ -16997,6 +16997,31 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1widget_1get_1parent_1window)
}
#endif
+#ifndef NO__1gtk_1widget_1get_1preferred_1size
+JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1widget_1get_1preferred_1size)
+ (JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jobject arg2)
+{
+ GtkRequisition _arg1, *lparg1=NULL;
+ GtkRequisition _arg2, *lparg2=NULL;
+ OS_NATIVE_ENTER(env, that, _1gtk_1widget_1get_1preferred_1size_FUNC);
+ if (arg1) if ((lparg1 = getGtkRequisitionFields(env, arg1, &_arg1)) == NULL) goto fail;
+ if (arg2) if ((lparg2 = getGtkRequisitionFields(env, arg2, &_arg2)) == NULL) goto fail;
+/*
+ gtk_widget_get_preferred_size((GtkWidget *)arg0, (GtkRequisition *)lparg1, (GtkRequisition *)lparg2);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_widget_get_preferred_size)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(GtkWidget *, GtkRequisition *, GtkRequisition *))fp)((GtkWidget *)arg0, (GtkRequisition *)lparg1, (GtkRequisition *)lparg2);
+ }
+ }
+fail:
+ if (arg2 && lparg2) setGtkRequisitionFields(env, arg2, lparg2);
+ if (arg1 && lparg1) setGtkRequisitionFields(env, arg1, lparg1);
+ OS_NATIVE_EXIT(env, that, _1gtk_1widget_1get_1preferred_1size_FUNC);
+}
+#endif
+
#ifndef NO__1gtk_1widget_1get_1realized
JNIEXPORT jboolean JNICALL OS_NATIVE(_1gtk_1widget_1get_1realized)
(JNIEnv *env, jclass that, jintLong arg0)
@@ -17695,7 +17720,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1widget_1size_1request)
GtkRequisition _arg1, *lparg1=NULL;
OS_NATIVE_ENTER(env, that, _1gtk_1widget_1size_1request_FUNC);
if (arg1) if ((lparg1 = &_arg1) == NULL) goto fail;
+/*
gtk_widget_size_request((GtkWidget *)arg0, (GtkRequisition *)lparg1);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_widget_size_request)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(GtkWidget *, GtkRequisition *))fp)((GtkWidget *)arg0, (GtkRequisition *)lparg1);
+ }
+ }
fail:
if (arg1 && lparg1) setGtkRequisitionFields(env, arg1, lparg1);
OS_NATIVE_EXIT(env, that, _1gtk_1widget_1size_1request_FUNC);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
index d00f784..9ac3a47 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
@@ -274,6 +274,8 @@
#define gtk_window_set_skip_taskbar_hint_LIB LIB_GTK
#define gtk_widget_is_composited_LIB LIB_GTK
#define gtk_widget_get_allocation_LIB LIB_GTK
+#define gtk_widget_size_request_LIB LIB_GTK
+#define gtk_widget_get_preferred_size_LIB LIB_GTK
#define gtk_widget_get_style_context_LIB LIB_GTK
#define gtk_widget_get_tooltip_text_LIB LIB_GTK
#define gtk_widget_get_visible_LIB LIB_GTK
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 b45502c..32b9b0c 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
@@ -1276,6 +1276,7 @@ char * OS_nativeFunctionNames[] = {
"_1gtk_1widget_1get_1pango_1context",
"_1gtk_1widget_1get_1parent",
"_1gtk_1widget_1get_1parent_1window",
+ "_1gtk_1widget_1get_1preferred_1size",
"_1gtk_1widget_1get_1realized",
"_1gtk_1widget_1get_1sensitive",
"_1gtk_1widget_1get_1size_1request",
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 ee99321..5bcc0ee 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
@@ -1286,6 +1286,7 @@ typedef enum {
_1gtk_1widget_1get_1pango_1context_FUNC,
_1gtk_1widget_1get_1parent_FUNC,
_1gtk_1widget_1get_1parent_1window_FUNC,
+ _1gtk_1widget_1get_1preferred_1size_FUNC,
_1gtk_1widget_1get_1realized_FUNC,
_1gtk_1widget_1get_1sensitive_FUNC,
_1gtk_1widget_1get_1size_1request_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 8bda706..db9af02 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
@@ -6046,6 +6046,21 @@ public static final void gtk_cell_renderer_get_preferred_size(long /*int*/ cell,
lock.unlock();
}
}
+/**
+ * @method flags=dynamic
+ * @param widget cast=(GtkWidget *)
+ * @param minimum_size cast=(GtkRequisition *)
+ * @param natural_size cast=(GtkRequisition *)
+ */
+public static final native void _gtk_widget_get_preferred_size(long /*int*/ widget, GtkRequisition minimum_size, GtkRequisition natural_size);
+public static final void gtk_widget_get_preferred_size(long /*int*/ widget, GtkRequisition minimum_size, GtkRequisition natural_size) {
+ lock.lock();
+ try {
+ _gtk_widget_get_preferred_size(widget, minimum_size, natural_size);
+ } finally {
+ lock.unlock();
+ }
+}
public static final native long /*int*/ _gtk_cell_renderer_pixbuf_new();
public static final long /*int*/ gtk_cell_renderer_pixbuf_new() {
lock.lock();
@@ -13422,6 +13437,7 @@ public static final void gtk_widget_size_allocate(long /*int*/ widget, GtkAlloca
}
}
/**
+ * @method flags=dynamic
* @param widget cast=(GtkWidget *)
* @param requisition cast=(GtkRequisition *),flags=no_in
*/
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
index 7591b74..d894c84 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
@@ -216,7 +216,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
int imageWidth = 0, imageHeight = 0;
if (gtk_widget_get_visible (imageHandle)) {
GtkRequisition requisition = new GtkRequisition ();
- OS.gtk_widget_size_request (imageHandle, requisition);
+ gtk_widget_get_preferred_size (imageHandle, requisition);
imageWidth = requisition.width;
imageHeight = requisition.height;
int [] spacing = new int [1];
@@ -765,7 +765,7 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize
int imageWidth = 0;
if (gtk_widget_get_visible (imageHandle)) {
GtkRequisition requisition = new GtkRequisition ();
- OS.gtk_widget_size_request (imageHandle, requisition);
+ gtk_widget_get_preferred_size (imageHandle, requisition);
imageWidth = requisition.width;
int [] spacing = new int [1];
OS.g_object_get (boxHandle, OS.spacing, spacing, 0);
@@ -777,7 +777,7 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize
* layout, but it does not. The fix is to resize the label directly.
*/
GtkRequisition requisition = new GtkRequisition ();
- OS.gtk_widget_size_request (boxHandle, requisition);
+ gtk_widget_get_preferred_size (boxHandle, requisition);
allocation.width = boxWidth;
allocation.height = boxHeight;
OS.gtk_widget_size_allocate (boxHandle, allocation);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
index ca4938d..a81cc6b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
@@ -364,10 +364,10 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
int width = OS.PANGO_PIXELS (w [0]) + xborder * 2;
int height = OS.PANGO_PIXELS (h [0]) + yborder * 2;
GtkRequisition arrowRequesition = new GtkRequisition ();
- OS.gtk_widget_size_request (buttonHandle, arrowRequesition);
+ gtk_widget_get_preferred_size (buttonHandle, arrowRequesition);
GtkRequisition listRequesition = new GtkRequisition ();
long /*int*/ listParent = OS.gtk_bin_get_child(popupHandle);
- OS.gtk_widget_size_request (listParent, listRequesition);
+ gtk_widget_get_preferred_size (listParent, listRequesition);
width = Math.max (listRequesition.width, width) + arrowRequesition.width;
width = wHint == SWT.DEFAULT ? width : wHint;
height = hHint == SWT.DEFAULT ? height : hHint;
@@ -439,7 +439,7 @@ void createHandle (int index) {
* for those versions of GTK that defer the creation.
*/
if (OS.GTK_VERSION < OS.VERSION (2, 8, 0)) {
- OS.gtk_widget_size_request(handle, new GtkRequisition());
+ gtk_widget_get_preferred_size (handle, new GtkRequisition());
}
menuHandle = findMenuHandle ();
if (menuHandle != 0) OS.g_object_ref (menuHandle);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
index 3c25d67..97eb586 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
@@ -3246,7 +3246,7 @@ void gtk_widget_set_has_window (long /*int*/ fixedHandle, boolean value) {
}
void gtk_widget_size_request (long /*int*/ widget, GtkRequisition requisition) {
- OS.gtk_widget_size_request (widget, requisition);
+ gtk_widget_get_preferred_size (widget, requisition);
}
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
index dbd2050..68e93c7 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
@@ -3978,7 +3978,11 @@ void showIMWindow (Control control) {
Point point = control.toDisplay (control.getIMCaretPos ());
OS.gtk_window_move (preeditWindow, point.x, point.y);
GtkRequisition requisition = new GtkRequisition ();
- OS.gtk_widget_size_request (preeditLabel, requisition);
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ OS.gtk_widget_get_preferred_size (preeditLabel, requisition, null);
+ } else {
+ OS.gtk_widget_size_request (preeditLabel, requisition);
+ }
OS.gtk_window_resize (preeditWindow, requisition.width, requisition.height);
OS.gtk_widget_show (preeditWindow);
} else {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java
index 8f4b923..7179ae3 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandBar.java
@@ -464,7 +464,7 @@ void setScrollbar () {
vHandle = OS.gtk_scrolled_window_get_vscrollbar (scrolledHandle);
}
GtkRequisition requisition = new GtkRequisition ();
- OS.gtk_widget_size_request (vHandle, requisition);
+ gtk_widget_get_preferred_size (vHandle, requisition);
width -= requisition.width;
}
width = Math.max (0, width);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
index c75b7d6..5ecf918 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
@@ -475,7 +475,7 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize
* layout, but it does not. The fix is to resize the label directly.
*/
GtkRequisition requisition = new GtkRequisition ();
- OS.gtk_widget_size_request (labelHandle, requisition);
+ gtk_widget_get_preferred_size (labelHandle, requisition);
gtk_widget_get_allocation(labelHandle, allocation);
allocation.width = labelWidth;
allocation.height = labelHeight;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java
index caa548b..5162d1d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java
@@ -783,7 +783,7 @@ long /*int*/ menuPositionProc (long /*int*/ menu, long /*int*/ x, long /*int*/ y
* NOTE: This code doesn't work for multiple monitors.
*/
GtkRequisition requisition = new GtkRequisition ();
- OS.gtk_widget_size_request (menu, requisition);
+ gtk_widget_get_preferred_size (menu, requisition);
int screenHeight = OS.gdk_screen_height ();
int reqy = this.y;
if (reqy + requisition.height > screenHeight) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java
index 2d282c4..4f73492 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java
@@ -301,7 +301,7 @@ public Point getSize () {
checkWidget ();
if (handle == 0) return new Point (0,0);
GtkRequisition requisition = new GtkRequisition ();
- OS.gtk_widget_size_request (handle, requisition);
+ gtk_widget_get_preferred_size (handle, requisition);
return new Point (requisition.width, requisition.height);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java
index 9d6d313..72846b2 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java
@@ -311,7 +311,7 @@ int hScrollBarWidth() {
}
if (hBarHandle==0) return 0;
GtkRequisition requisition = new GtkRequisition();
- OS.gtk_widget_size_request(hBarHandle, requisition);
+ gtk_widget_get_preferred_size (hBarHandle, requisition);
int spacing = OS.GTK_SCROLLED_WINDOW_SCROLLBAR_SPACING(scrolledHandle);
return requisition.height + spacing;
}
@@ -433,7 +433,7 @@ int vScrollBarWidth() {
}
if (vBarHandle == 0) return 0;
GtkRequisition requisition = new GtkRequisition();
- OS.gtk_widget_size_request (vBarHandle, requisition);
+ gtk_widget_get_preferred_size (vBarHandle, requisition);
int spacing = OS.GTK_SCROLLED_WINDOW_SCROLLBAR_SPACING(scrolledHandle);
return requisition.width + spacing;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
index f7f436b..b71470f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
@@ -931,7 +931,7 @@ void forceResize () {
void forceResize (int width, int height) {
GtkRequisition requisition = new GtkRequisition ();
- OS.gtk_widget_size_request (vboxHandle, requisition);
+ gtk_widget_get_preferred_size (vboxHandle, requisition);
GtkAllocation allocation = new GtkAllocation ();
int border = OS.gtk_container_get_border_width (shellHandle);
allocation.x = border;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
index a02b2ed..0a8886e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
@@ -1362,7 +1362,7 @@ public int getHeaderHeight () {
for (int i=0; i<columnCount; i++) {
long /*int*/ buttonHandle = columns [i].buttonHandle;
if (buttonHandle != 0) {
- OS.gtk_widget_size_request (buttonHandle, requisition);
+ gtk_widget_get_preferred_size (buttonHandle, requisition);
height = Math.max (height, requisition.height);
}
}
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 1062f41..be55f8a 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
@@ -429,7 +429,7 @@ public void pack () {
int width = 0;
if (buttonHandle != 0) {
GtkRequisition requisition = new GtkRequisition ();
- OS.gtk_widget_size_request (buttonHandle, requisition);
+ gtk_widget_get_preferred_size (buttonHandle, requisition);
width = requisition.width;
}
if ((parent.style & SWT.VIRTUAL) != 0) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
index ef6005a..7f3ab5d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
@@ -1367,7 +1367,7 @@ public int getHeaderHeight () {
for (int i=0; i<columnCount; i++) {
long /*int*/ buttonHandle = columns [i].buttonHandle;
if (buttonHandle != 0) {
- OS.gtk_widget_size_request (buttonHandle, requisition);
+ gtk_widget_get_preferred_size (buttonHandle, requisition);
height = Math.max (height, requisition.height);
}
}
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 23e0956..70145a4 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
@@ -431,7 +431,7 @@ public void pack () {
int width = 0;
if (buttonHandle != 0) {
GtkRequisition requisition = new GtkRequisition ();
- OS.gtk_widget_size_request (buttonHandle, requisition);
+ gtk_widget_get_preferred_size (buttonHandle, requisition);
width = requisition.width;
}
if ((parent.style & SWT.VIRTUAL) != 0) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
index 0d8f47d..5cbb6dc 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
@@ -2053,4 +2053,12 @@ void gtk_cell_renderer_get_preferred_size (long /*int*/ cell, long /*int*/ widge
OS.gtk_cell_renderer_get_size (cell, widget, null, null, null, width, height);
}
}
+
+void gtk_widget_get_preferred_size (long /*int*/ widget, GtkRequisition requisition){
+ if (OS.GTK_VERSION >= OS.VERSION(3, 0, 0)) {
+ OS.gtk_widget_get_preferred_size (widget, requisition, null);
+ } else {
+ OS.gtk_widget_size_request (widget, requisition);
+ }
+}
}