Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Williams2018-09-14 18:37:51 +0000
committerEric Williams2018-09-14 19:15:42 +0000
commitd9fc7137fdc0db75c6c373bd5e42c34bbc8f391b (patch)
tree46bbd63be3c7b655edc9d8dbc989248f57918076
parent82ab310bd12826f56ac6fa06c2c1fe6745c1c5a6 (diff)
downloadeclipse.platform.swt-d9fc7137fdc0db75c6c373bd5e42c34bbc8f391b.tar.gz
eclipse.platform.swt-d9fc7137fdc0db75c6c373bd5e42c34bbc8f391b.tar.xz
eclipse.platform.swt-d9fc7137fdc0db75c6c373bd5e42c34bbc8f391b.zip
Bug 530841: [GTK2] Remove GTK 2.x support
Remove GTK2 sizing logic. Change-Id: Ibd2807153ee3274659686d77d60960f8512ff3b8 Signed-off-by: Eric Williams <ericwill@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c100
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java53
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java19
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java40
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java8
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java10
-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/Group.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java37
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java18
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java19
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java58
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java30
22 files changed, 79 insertions, 376 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 f1bd830a65..404a708246 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
@@ -3512,30 +3512,6 @@ JNIEXPORT jintLong JNICALL GTK_NATIVE(GTK_1WIDGET_1GET_1CLASS)
}
#endif
-#ifndef NO_GTK_1WIDGET_1REQUISITION_1HEIGHT
-JNIEXPORT jint JNICALL GTK_NATIVE(GTK_1WIDGET_1REQUISITION_1HEIGHT)
- (JNIEnv *env, jclass that, jintLong arg0)
-{
- jint rc = 0;
- GTK_NATIVE_ENTER(env, that, GTK_1WIDGET_1REQUISITION_1HEIGHT_FUNC);
- rc = (jint)GTK_WIDGET_REQUISITION_HEIGHT((GtkWidget *)arg0);
- GTK_NATIVE_EXIT(env, that, GTK_1WIDGET_1REQUISITION_1HEIGHT_FUNC);
- return rc;
-}
-#endif
-
-#ifndef NO_GTK_1WIDGET_1REQUISITION_1WIDTH
-JNIEXPORT jint JNICALL GTK_NATIVE(GTK_1WIDGET_1REQUISITION_1WIDTH)
- (JNIEnv *env, jclass that, jintLong arg0)
-{
- jint rc = 0;
- GTK_NATIVE_ENTER(env, that, GTK_1WIDGET_1REQUISITION_1WIDTH_FUNC);
- rc = (jint)GTK_WIDGET_REQUISITION_WIDTH((GtkWidget *)arg0);
- GTK_NATIVE_EXIT(env, that, GTK_1WIDGET_1REQUISITION_1WIDTH_FUNC);
- return rc;
-}
-#endif
-
#ifndef NO_GtkAllocation_1sizeof
JNIEXPORT jint JNICALL GTK_NATIVE(GtkAllocation_1sizeof)
(JNIEnv *env, jclass that)
@@ -4589,40 +4565,6 @@ fail:
}
#endif
-#ifndef NO__1gtk_1cell_1renderer_1get_1size
-JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1cell_1renderer_1get_1size)
- (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jobject arg2, jintArray arg3, jintArray arg4, jintArray arg5, jintArray arg6)
-{
- GdkRectangle _arg2, *lparg2=NULL;
- jint *lparg3=NULL;
- jint *lparg4=NULL;
- jint *lparg5=NULL;
- jint *lparg6=NULL;
- GTK_NATIVE_ENTER(env, that, _1gtk_1cell_1renderer_1get_1size_FUNC);
- if (arg2) if ((lparg2 = &_arg2) == NULL) goto fail;
- if (arg3) if ((lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL)) == NULL) goto fail;
- if (arg4) if ((lparg4 = (*env)->GetIntArrayElements(env, arg4, NULL)) == NULL) goto fail;
- if (arg5) if ((lparg5 = (*env)->GetIntArrayElements(env, arg5, NULL)) == NULL) goto fail;
- if (arg6) if ((lparg6 = (*env)->GetIntArrayElements(env, arg6, NULL)) == NULL) goto fail;
-/*
- gtk_cell_renderer_get_size((GtkCellRenderer *)arg0, (GtkWidget *)arg1, (GdkRectangle *)lparg2, (gint *)lparg3, (gint *)lparg4, (gint *)lparg5, (gint *)lparg6);
-*/
- {
- GTK_LOAD_FUNCTION(fp, gtk_cell_renderer_get_size)
- if (fp) {
- ((void (CALLING_CONVENTION*)(GtkCellRenderer *, GtkWidget *, GdkRectangle *, gint *, gint *, gint *, gint *))fp)((GtkCellRenderer *)arg0, (GtkWidget *)arg1, (GdkRectangle *)lparg2, (gint *)lparg3, (gint *)lparg4, (gint *)lparg5, (gint *)lparg6);
- }
- }
-fail:
- if (arg6 && lparg6) (*env)->ReleaseIntArrayElements(env, arg6, lparg6, 0);
- if (arg5 && lparg5) (*env)->ReleaseIntArrayElements(env, arg5, lparg5, 0);
- if (arg4 && lparg4) (*env)->ReleaseIntArrayElements(env, arg4, lparg4, 0);
- if (arg3 && lparg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0);
- if (arg2 && lparg2) setGdkRectangleFields(env, arg2, lparg2);
- GTK_NATIVE_EXIT(env, that, _1gtk_1cell_1renderer_1get_1size_FUNC);
-}
-#endif
-
#ifndef NO__1gtk_1cell_1renderer_1pixbuf_1new
JNIEXPORT jintLong JNICALL GTK_NATIVE(_1gtk_1cell_1renderer_1pixbuf_1new)
(JNIEnv *env, jclass that)
@@ -12167,26 +12109,6 @@ JNIEXPORT jintLong JNICALL GTK_NATIVE(_1gtk_1tree_1view_1get_1selection)
}
#endif
-#ifndef NO__1gtk_1tree_1view_1get_1vadjustment
-JNIEXPORT jintLong JNICALL GTK_NATIVE(_1gtk_1tree_1view_1get_1vadjustment)
- (JNIEnv *env, jclass that, jintLong arg0)
-{
- jintLong rc = 0;
- GTK_NATIVE_ENTER(env, that, _1gtk_1tree_1view_1get_1vadjustment_FUNC);
-/*
- rc = (jintLong)gtk_tree_view_get_vadjustment((GtkTreeView *)arg0);
-*/
- {
- GTK_LOAD_FUNCTION(fp, gtk_tree_view_get_vadjustment)
- if (fp) {
- rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GtkTreeView *))fp)((GtkTreeView *)arg0);
- }
- }
- GTK_NATIVE_EXIT(env, that, _1gtk_1tree_1view_1get_1vadjustment_FUNC);
- return rc;
-}
-#endif
-
#ifndef NO__1gtk_1tree_1view_1get_1visible_1rect
JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1tree_1view_1get_1visible_1rect)
(JNIEnv *env, jclass that, jintLong arg0, jobject arg1)
@@ -13674,28 +13596,6 @@ fail:
}
#endif
-#ifndef NO__1gtk_1widget_1size_1request
-JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1widget_1size_1request)
- (JNIEnv *env, jclass that, jintLong arg0, jobject arg1)
-{
- GtkRequisition _arg1, *lparg1=NULL;
- GTK_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);
-*/
- {
- GTK_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);
- GTK_NATIVE_EXIT(env, that, _1gtk_1widget_1size_1request_FUNC);
-}
-#endif
-
#if (!defined(NO__1gtk_1widget_1style_1get__I_3B_3II) && !defined(JNI64)) || (!defined(NO__1gtk_1widget_1style_1get__J_3B_3IJ) && defined(JNI64))
#ifndef JNI64
JNIEXPORT void JNICALL GTK_NATIVE(_1gtk_1widget_1style_1get__I_3B_3II)(JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jintArray arg2, jintLong arg3)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h
index 529677b877..7888fb75fa 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h
@@ -217,9 +217,6 @@ X#define NO__1XWarpPointer
#define NO_memmove__ILorg_eclipse_swt_internal_gtk_GtkFixed_2
#define NO_memmove__JLorg_eclipse_swt_internal_gtk_GtkFixed_2
-#define NO_GTK_1WIDGET_1REQUISITION_1HEIGHT
-#define NO_GTK_1WIDGET_1REQUISITION_1WIDTH
-
#else
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 284477ee85..658bb5aa09 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
@@ -272,8 +272,6 @@ char * GTK_nativeFunctionNames[] = {
"GTK_1TEXTVIEW_1IM_1CONTEXT",
"GTK_1TYPE_1TEXT_1VIEW_1ACCESSIBLE",
"GTK_1WIDGET_1GET_1CLASS",
- "GTK_1WIDGET_1REQUISITION_1HEIGHT",
- "GTK_1WIDGET_1REQUISITION_1WIDTH",
"GtkAllocation_1sizeof",
"GtkBorder_1sizeof",
"GtkCellRendererPixbufClass_1sizeof",
@@ -358,7 +356,6 @@ char * GTK_nativeFunctionNames[] = {
"_1gtk_1cell_1renderer_1get_1padding",
"_1gtk_1cell_1renderer_1get_1preferred_1height_1for_1width",
"_1gtk_1cell_1renderer_1get_1preferred_1size",
- "_1gtk_1cell_1renderer_1get_1size",
"_1gtk_1cell_1renderer_1pixbuf_1new",
"_1gtk_1cell_1renderer_1set_1fixed_1size",
"_1gtk_1cell_1renderer_1text_1new",
@@ -978,7 +975,6 @@ char * GTK_nativeFunctionNames[] = {
"_1gtk_1tree_1view_1get_1headers_1visible",
"_1gtk_1tree_1view_1get_1path_1at_1pos",
"_1gtk_1tree_1view_1get_1selection",
- "_1gtk_1tree_1view_1get_1vadjustment",
"_1gtk_1tree_1view_1get_1visible_1rect",
"_1gtk_1tree_1view_1insert_1column",
"_1gtk_1tree_1view_1move_1column_1after",
@@ -1091,7 +1087,6 @@ char * GTK_nativeFunctionNames[] = {
"_1gtk_1widget_1shape_1combine_1region",
"_1gtk_1widget_1show",
"_1gtk_1widget_1size_1allocate",
- "_1gtk_1widget_1size_1request",
#ifndef JNI64
"_1gtk_1widget_1style_1get__I_3B_3II",
#else
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 8994725ef3..0d88b1ee88 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
@@ -270,8 +270,6 @@ typedef enum {
GTK_1TEXTVIEW_1IM_1CONTEXT_FUNC,
GTK_1TYPE_1TEXT_1VIEW_1ACCESSIBLE_FUNC,
GTK_1WIDGET_1GET_1CLASS_FUNC,
- GTK_1WIDGET_1REQUISITION_1HEIGHT_FUNC,
- GTK_1WIDGET_1REQUISITION_1WIDTH_FUNC,
GtkAllocation_1sizeof_FUNC,
GtkBorder_1sizeof_FUNC,
GtkCellRendererPixbufClass_1sizeof_FUNC,
@@ -356,7 +354,6 @@ typedef enum {
_1gtk_1cell_1renderer_1get_1padding_FUNC,
_1gtk_1cell_1renderer_1get_1preferred_1height_1for_1width_FUNC,
_1gtk_1cell_1renderer_1get_1preferred_1size_FUNC,
- _1gtk_1cell_1renderer_1get_1size_FUNC,
_1gtk_1cell_1renderer_1pixbuf_1new_FUNC,
_1gtk_1cell_1renderer_1set_1fixed_1size_FUNC,
_1gtk_1cell_1renderer_1text_1new_FUNC,
@@ -976,7 +973,6 @@ typedef enum {
_1gtk_1tree_1view_1get_1headers_1visible_FUNC,
_1gtk_1tree_1view_1get_1path_1at_1pos_FUNC,
_1gtk_1tree_1view_1get_1selection_FUNC,
- _1gtk_1tree_1view_1get_1vadjustment_FUNC,
_1gtk_1tree_1view_1get_1visible_1rect_FUNC,
_1gtk_1tree_1view_1insert_1column_FUNC,
_1gtk_1tree_1view_1move_1column_1after_FUNC,
@@ -1089,7 +1085,6 @@ typedef enum {
_1gtk_1widget_1shape_1combine_1region_FUNC,
_1gtk_1widget_1show_FUNC,
_1gtk_1widget_1size_1allocate_FUNC,
- _1gtk_1widget_1size_1request_FUNC,
#ifndef JNI64
_1gtk_1widget_1style_1get__I_3B_3II_FUNC,
#else
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 890a2fe0d9..f959970b8a 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
@@ -272,10 +272,6 @@ public class GTK extends OS {
public static final native long /*int*/ GTK_ENTRY_IM_CONTEXT(long /*int*/ widget);
/** @param widget cast=(GtkTextView *) */
public static final native long /*int*/ GTK_TEXTVIEW_IM_CONTEXT(long /*int*/ widget);
- /** @param widget cast=(GtkWidget *) */
- public static final native int GTK_WIDGET_REQUISITION_WIDTH(long /*int*/ widget);
- /** @param widget cast=(GtkWidget *) */
- public static final native int GTK_WIDGET_REQUISITION_HEIGHT(long /*int*/ widget);
/** @method flags=const */
public static final native long /*int*/ GTK_TYPE_TEXT_VIEW_ACCESSIBLE ();
public static final native long /*int*/ _GTK_ACCESSIBLE (long /*int*/ handle);
@@ -1038,26 +1034,6 @@ public class GTK extends OS {
* @method flags=dynamic
* @param cell cast=(GtkCellRenderer *)
* @param widget cast=(GtkWidget *)
- * @param area cast=(GdkRectangle *),flags=no_in
- * @param x_offset cast=(gint *)
- * @param y_offset cast=(gint *)
- * @param width cast=(gint *)
- * @param height cast=(gint *)
- */
- public static final native void _gtk_cell_renderer_get_size(long /*int*/ cell, long /*int*/ widget, GdkRectangle area, int[] x_offset, int[] y_offset, int[] width, int[] height);
- /** [GTK2/GTK3; 3.0 deprecated] */
- public static final void gtk_cell_renderer_get_size(long /*int*/ cell, long /*int*/ widget, GdkRectangle area, int[] x_offset, int[] y_offset, int[] width, int[] height) {
- lock.lock();
- try {
- _gtk_cell_renderer_get_size(cell, widget, area, x_offset, y_offset, width, height);
- } finally {
- lock.unlock();
- }
- }
- /**
- * @method flags=dynamic
- * @param cell cast=(GtkCellRenderer *)
- * @param widget cast=(GtkWidget *)
* @param minimum_size cast=(GtkRequisition *)
* @param natural_size cast=(GtkRequisition *)
*/
@@ -7886,20 +7862,6 @@ public class GTK extends OS {
}
}
/**
- * @method flags=dynamic
- * @param tree_view cast=(GtkTreeView *)
- */
- public static final native long /*int*/ _gtk_tree_view_get_vadjustment(long /*int*/ tree_view);
- /** [GTK2/GTK3; 3.0 deprecated] */
- public static final long /*int*/ gtk_tree_view_get_vadjustment(long /*int*/ tree_view) {
- lock.lock();
- try {
- return _gtk_tree_view_get_vadjustment(tree_view);
- } finally {
- lock.unlock();
- }
- }
- /**
* @param tree_view cast=(GtkTreeView *)
* @param x cast=(gint)
* @param y cast=(gint)
@@ -9016,21 +8978,6 @@ public class GTK extends OS {
}
}
/**
- * @method flags=dynamic
- * @param widget cast=(GtkWidget *)
- * @param requisition cast=(GtkRequisition *),flags=no_in
- */
- public static final native void _gtk_widget_size_request(long /*int*/ widget, GtkRequisition requisition);
- /** [GTK2/GTK3; 2.x/3.0 deprecated] */
- public static final void gtk_widget_size_request(long /*int*/ widget, GtkRequisition requisition) {
- lock.lock();
- try {
- _gtk_widget_size_request(widget, requisition);
- } finally {
- lock.unlock();
- }
- }
- /**
* @param widget cast=(GtkWidget *)
* @param allocation cast=(GtkAllocation *),flags=no_out
*/
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 665ffc7947..23e5c1672e 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
@@ -644,23 +644,10 @@ public void removeSelectionListener (SelectionListener listener) {
@Override
void resizeHandle (int width, int height) {
- if (GTK.GTK3) {
- if ((style & (SWT.CHECK | SWT.RADIO)) != 0 && (style & SWT.WRAP) == 0) {
- OS.swt_fixed_resize (GTK.gtk_widget_get_parent (topHandle()), topHandle(), width, height);
- } else {
- super.resizeHandle(width, height);
- }
+ if ((style & (SWT.CHECK | SWT.RADIO)) != 0 && (style & SWT.WRAP) == 0) {
+ OS.swt_fixed_resize (GTK.gtk_widget_get_parent (topHandle()), topHandle(), width, height);
} else {
- super.resizeHandle (width, height);
- /*
- * Feature in GTK, GtkCheckButton and GtkRadioButton allocate
- * only the minimum size necessary for its child. This causes the child
- * alignment to fail. The fix is to set the child size to the size
- * of the button.
- */
- if ((style & (SWT.CHECK | SWT.RADIO)) != 0) {
- GTK.gtk_widget_set_size_request (boxHandle, width, -1);
- }
+ super.resizeHandle(width, height);
}
}
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 06ed4fff62..80d28d2ebb 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
@@ -466,37 +466,7 @@ void clearText () {
@Override
Point computeSizeInPixels (int wHint, int hHint, boolean changed) {
checkWidget ();
- if ((style & SWT.READ_ONLY) != 0 || GTK.GTK3) {
- return computeNativeSize (handle, wHint, hHint, changed);
- }
- if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0;
- if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0;
- int[] w = new int [1], h = new int [1];
- GTK.gtk_widget_realize (entryHandle);
- long /*int*/ layout = GTK.gtk_entry_get_layout (entryHandle);
- OS.pango_layout_get_pixel_size (layout, w, h);
- int xborder = Display.INNER_BORDER, yborder = Display.INNER_BORDER;
- Point thickness = getThickness (entryHandle);
- xborder += thickness.x;
- yborder += thickness.y;
- int [] property = new int [1];
- GTK.gtk_widget_style_get (entryHandle, OS.interior_focus, property, 0);
- if (property [0] == 0) {
- GTK.gtk_widget_style_get (entryHandle, OS.focus_line_width, property, 0);
- xborder += property [0];
- yborder += property [0];
- }
- int width = w [0] + xborder * 2;
- int height = h [0] + yborder * 2;
- GtkRequisition arrowRequesition = new GtkRequisition ();
- gtk_widget_get_preferred_size (buttonHandle, arrowRequesition);
- GtkRequisition listRequesition = new GtkRequisition ();
- long /*int*/ listParent = GTK.gtk_bin_get_child(popupHandle);
- 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;
- return new Point (width, height);
+ return computeNativeSize (handle, wHint, hHint, changed);
}
/**
@@ -1243,12 +1213,8 @@ public int getTextHeight () {
int getTextHeightInPixels () {
checkWidget();
GtkRequisition requisition = new GtkRequisition ();
- gtk_widget_size_request (handle, requisition);
- if (GTK.GTK3) {
- return requisition.height;
- } else {
- return GTK.GTK_WIDGET_REQUISITION_HEIGHT (handle);
- }
+ gtk_widget_get_preferred_size (handle, requisition);
+ return requisition.height;
}
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
index 0fb7138913..36c9cccdbc 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
@@ -1393,7 +1393,7 @@ void moveChildren(int oldWidth) {
* a call to gtk_widget_size_request().
*/
GtkRequisition requisition = new GtkRequisition ();
- gtk_widget_size_request (topHandle, requisition);
+ gtk_widget_get_preferred_size (topHandle, requisition);
allocation.x = x;
allocation.y = y;
GTK.gtk_widget_size_allocate (topHandle, allocation);
@@ -1563,11 +1563,7 @@ void reskinChildren (int flags) {
void resizeHandle (int width, int height) {
super.resizeHandle (width, height);
if (socketHandle != 0) {
- if (GTK.GTK3) {
- OS.swt_fixed_resize (handle, socketHandle, width, height);
- } else {
- GTK.gtk_widget_set_size_request (socketHandle, width, height);
- }
+ OS.swt_fixed_resize (handle, socketHandle, width, height);
}
}
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 fade9b81eb..5ab14cb37e 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
@@ -831,7 +831,7 @@ void forceResize () {
*/
long /*int*/ topHandle = topHandle ();
GtkRequisition requisition = new GtkRequisition ();
- gtk_widget_size_request (topHandle, requisition);
+ gtk_widget_get_preferred_size (topHandle, requisition);
GtkAllocation allocation = new GtkAllocation ();
GTK.gtk_widget_get_allocation(topHandle, allocation);
GTK.gtk_widget_size_allocate (topHandle, allocation);
@@ -1089,7 +1089,7 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize
* a call to gtk_widget_size_request().
*/
GtkRequisition requisition = new GtkRequisition ();
- gtk_widget_size_request (topHandle, requisition);
+ gtk_widget_get_preferred_size (topHandle, requisition);
if (move) {
allocation.x = x;
allocation.y = y;
@@ -3812,10 +3812,6 @@ long /*int*/ gtk_unrealize (long /*int*/ widget) {
return 0;
}
-void gtk_widget_size_request (long /*int*/ widget, GtkRequisition requisition) {
- gtk_widget_get_preferred_size (widget, requisition);
-}
-
/**
* Invokes platform specific functionality to allocate a new GC handle.
* <p>
@@ -5302,7 +5298,7 @@ public boolean setParent (Composite parent) {
* a call to gtk_widget_size_request().
*/
GtkRequisition requisition = new GtkRequisition ();
- gtk_widget_size_request (topHandle, requisition);
+ gtk_widget_get_preferred_size (topHandle, requisition);
allocation.x = x;
allocation.y = y;
allocation.width = width;
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 363c70d74f..7334383b7e 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
@@ -5346,11 +5346,7 @@ void showIMWindow (Control control) {
Point point = control.toDisplayInPixels (control.getIMCaretPos ());
GTK.gtk_window_move (preeditWindow, point.x, point.y);
GtkRequisition requisition = new GtkRequisition ();
- if (GTK.GTK3) {
- GTK.gtk_widget_get_preferred_size (preeditLabel, requisition, null);
- } else {
- GTK.gtk_widget_size_request (preeditLabel, requisition);
- }
+ GTK.gtk_widget_get_preferred_size (preeditLabel, requisition, null);
GTK.gtk_window_resize (preeditWindow, requisition.width, requisition.height);
GTK.gtk_widget_show (preeditWindow);
} else {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java
index a5a4371815..41b8eae10d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java
@@ -110,17 +110,7 @@ long /*int*/ clientHandle () {
@Override
Point computeSizeInPixels (int wHint, int hHint, boolean changed) {
Point size = super.computeSizeInPixels(wHint, hHint, changed);
- int width;
- if(GTK.GTK3){
- width = computeNativeSize (handle, SWT.DEFAULT, SWT.DEFAULT, false).x;
- }
- else{
- int x_thickness = GTK.gtk_style_get_xthickness (GTK.gtk_widget_get_style (handle));
- // GTK adds a LABEL_PAD and LABEL_SIDE_PAD to the label width, we also need to add
- // the thickness of the frame border
- int minimalSizeAroundLabel = 2 * (GTK.GTK_FRAME_LABEL_PAD + GTK.GTK_FRAME_LABEL_SIDE_PAD + x_thickness);
- width = computeNativeSize (labelHandle, SWT.DEFAULT, SWT.DEFAULT, false) .x + minimalSizeAroundLabel;
- }
+ int width = computeNativeSize (handle, SWT.DEFAULT, SWT.DEFAULT, false).x;
size.x = Math.max (size.x, width);
return size;
}
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 843ed625da..17df2d36bc 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
@@ -125,8 +125,8 @@ Point computeNativeSize (long /*int*/ h, int wHint, int hHint, boolean changed)
* is to use the minimum width instead of the natural width when SWT.WRAP is specified.
* In all other cases, use the natural width. See bug 534768.
*/
- boolean wrapGTK3 = GTK.GTK3 && labelHandle != 0 && (style & SWT.WRAP) != 0 && GTK.gtk_widget_get_visible (labelHandle);
- if (wrapGTK3 && wHint == SWT.DEFAULT && hHint == SWT.DEFAULT) {
+ boolean wrap = labelHandle != 0 && (style & SWT.WRAP) != 0 && GTK.gtk_widget_get_visible (labelHandle);
+ if (wrap && wHint == SWT.DEFAULT && hHint == SWT.DEFAULT) {
GtkRequisition naturalSize = new GtkRequisition ();
GtkRequisition minimumSize = new GtkRequisition ();
GTK.gtk_widget_get_preferred_size(h, minimumSize, naturalSize);
@@ -211,17 +211,11 @@ Point computeSizeInPixels (int wHint, int hHint, boolean changed) {
int descent = OS.PANGO_PIXELS (OS.pango_font_metrics_get_descent (metrics));
OS.pango_font_metrics_unref (metrics);
int fontHeight = ascent + descent;
- if (GTK.GTK3) {
- int [] bufferBottom = new int [1];
- int [] bufferTop = new int [1];
- OS.g_object_get(labelHandle, OS.margin_bottom, bufferBottom, 0);
- OS.g_object_get(labelHandle, OS.margin_top, bufferTop, 0);
- fontHeight += bufferBottom [0] + bufferTop [0];
- } else {
- int [] bufferYpad = new int[1];
- OS.g_object_get (labelHandle, OS.ypad, bufferYpad, 0);
- fontHeight += 2 * bufferYpad [0];
- }
+ int [] bufferBottom = new int [1];
+ int [] bufferTop = new int [1];
+ OS.g_object_get(labelHandle, OS.margin_bottom, bufferBottom, 0);
+ OS.g_object_get(labelHandle, OS.margin_top, bufferTop, 0);
+ fontHeight += bufferBottom [0] + bufferTop [0];
if (frameHandle != 0) {
fontHeight += 2 * getThickness (frameHandle).y;
fontHeight += 2 * GTK.gtk_container_get_border_width (frameHandle);
@@ -454,17 +448,12 @@ void releaseWidget () {
@Override
void resizeHandle (int width, int height) {
- if (GTK.GTK3) {
- OS.swt_fixed_resize (GTK.gtk_widget_get_parent (fixedHandle), fixedHandle, width, height);
- long /*int*/ child = frameHandle != 0 ? frameHandle : handle;
- Point sizes = resizeCalculationsGTK3 (child, width, height);
- width = sizes.x;
- height = sizes.y;
- OS.swt_fixed_resize (GTK.gtk_widget_get_parent (child), child, width, height);
- } else {
- GTK.gtk_widget_set_size_request (fixedHandle, width, height);
- GTK.gtk_widget_set_size_request (frameHandle != 0 ? frameHandle : handle, width, height);
- }
+ OS.swt_fixed_resize (GTK.gtk_widget_get_parent (fixedHandle), fixedHandle, width, height);
+ long /*int*/ child = frameHandle != 0 ? frameHandle : handle;
+ Point sizes = resizeCalculationsGTK3 (child, width, height);
+ width = sizes.x;
+ height = sizes.y;
+ OS.swt_fixed_resize (GTK.gtk_widget_get_parent (child), child, width, height);
}
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
index ed7a8b1d85..cadd60f141 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
@@ -269,8 +269,8 @@ Point computeSizeInPixels (int wHint, int hHint, boolean changed) {
* So if the height is returned as zero calculate the table height
* based on the number of items in the table
*/
- if (GTK.GTK3 && size.y == 0 && hHint == SWT.DEFAULT) {
- size.y = getItemCount() * getItemHeightInPixels();
+ if (size.y == 0 && hHint == SWT.DEFAULT) {
+ size.y = getItemCount() * getItemHeightInPixels();
}
/*
@@ -765,12 +765,7 @@ public int getTopIndex () {
* if setTopIndex() has been called and the widget has not been scrolled
* using the UI. Otherwise, fetch topIndex using GtkTreeView API.
*/
- long /*int*/ vAdjustment;
- if (GTK.GTK3) {
- vAdjustment = GTK.gtk_scrollable_get_vadjustment (handle);
- } else {
- vAdjustment = GTK.gtk_tree_view_get_vadjustment (handle);
- }
+ long /*int*/ vAdjustment = GTK.gtk_scrollable_get_vadjustment (handle);
currentAdjustment = GTK.gtk_adjustment_get_value (vAdjustment);
if (cachedAdjustment == currentAdjustment) {
return topIndex;
@@ -1686,12 +1681,7 @@ public void setTopIndex (int index) {
* Use gtk_tree_view_get_view_get_vadjustment for GTK2, GtkScrollable
* doesn't exist on GTK2.
*/
- long /*int*/ vAdjustment;
- if (GTK.GTK3) {
- vAdjustment = GTK.gtk_scrollable_get_vadjustment (handle);
- } else {
- vAdjustment = GTK.gtk_tree_view_get_vadjustment (handle);
- }
+ long /*int*/ vAdjustment = GTK.gtk_scrollable_get_vadjustment (handle);
cachedAdjustment = GTK.gtk_adjustment_get_value (vAdjustment);
topIndex = index;
/*
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 4ec7b80530..885ebf9d07 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
@@ -469,19 +469,14 @@ void releaseChildren (boolean destroy) {
@Override
void resizeHandle (int width, int height) {
- if (GTK.GTK3) {
- if (fixedHandle != 0) {
- OS.swt_fixed_resize (GTK.gtk_widget_get_parent(fixedHandle), fixedHandle, width, height);
- }
- long /*int*/ child = scrolledHandle != 0 ? scrolledHandle : handle;
- Point sizes = resizeCalculationsGTK3 (child, width, height);
- width = sizes.x;
- height = sizes.y;
- OS.swt_fixed_resize (GTK.gtk_widget_get_parent(child), child, width, height);
- } else {
- if (fixedHandle != 0) GTK.gtk_widget_set_size_request (fixedHandle, width, height);
- GTK.gtk_widget_set_size_request (scrolledHandle != 0 ? scrolledHandle : handle, width, height);
+ if (fixedHandle != 0) {
+ OS.swt_fixed_resize (GTK.gtk_widget_get_parent(fixedHandle), fixedHandle, width, height);
}
+ long /*int*/ child = scrolledHandle != 0 ? scrolledHandle : handle;
+ Point sizes = resizeCalculationsGTK3 (child, width, height);
+ width = sizes.x;
+ height = sizes.y;
+ OS.swt_fixed_resize (GTK.gtk_widget_get_parent(child), child, width, height);
}
@Override
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 f590ed13ae..fa99831232 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
@@ -1018,9 +1018,7 @@ void forceResize () {
void forceResize (int width, int height) {
int clientWidth = 0;
- if (GTK.GTK3) {
- if ((style & SWT.MIRRORED) != 0) clientWidth = getClientWidth ();
- }
+ if ((style & SWT.MIRRORED) != 0) clientWidth = getClientWidth ();
GtkAllocation allocation = new GtkAllocation ();
int border = GTK.gtk_container_get_border_width (shellHandle);
allocation.x = border;
@@ -1035,9 +1033,7 @@ void forceResize (int width, int height) {
GTK.gtk_widget_get_preferred_size (vboxHandle, minimumSize, naturalSize);
}
GTK.gtk_widget_size_allocate (vboxHandle, allocation);
- if (GTK.GTK3) {
- if ((style & SWT.MIRRORED) != 0) moveChildren (clientWidth);
- }
+ if ((style & SWT.MIRRORED) != 0) moveChildren (clientWidth);
}
/**
@@ -1638,7 +1634,7 @@ long /*int*/ gtk_size_allocate (long /*int*/ widget, long /*int*/ allocation) {
// infinitely recursive resize call. This causes non-resizable Shells/Dialogs to
// crash. Fix: only call resizeBounds() on resizable Shells.
if ((!resized || oldWidth != width || oldHeight != height)
- && (GTK.GTK3 && !OS.isX11() ? ((style & SWT.RESIZE) != 0) : true)) { //Wayland
+ && (!OS.isX11() ? ((style & SWT.RESIZE) != 0) : true)) { //Wayland
oldWidth = width;
oldHeight = height;
resizeBounds (width, height, true); //this is called to resize child widgets when the shell is resized.
@@ -1950,7 +1946,7 @@ void resizeBounds (int width, int height, boolean notify) {
int border = GTK.gtk_container_get_border_width (shellHandle);
int boxWidth = width - 2*border;
int boxHeight = height - 2*border;
- if (!GTK.GTK3 || (style & SWT.RESIZE) == 0) {
+ if ((style & SWT.RESIZE) == 0) {
GTK.gtk_widget_set_size_request (vboxHandle, boxWidth, boxHeight);
}
forceResize (boxWidth, boxHeight);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java
index a1e395d38e..cd7583ffcf 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java
@@ -211,7 +211,6 @@ Point computeSizeInPixels (int wHint, int hHint, boolean changed) {
checkWidget ();
if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0;
if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0;
- int[] w = new int [1], h = new int [1];
GTK.gtk_widget_realize (handle);
long /*int*/ layout = GTK.gtk_entry_get_layout (handle);
long /*int*/ hAdjustment = GTK.gtk_spin_button_get_adjustment (handle);
@@ -238,17 +237,11 @@ Point computeSizeInPixels (int wHint, int hHint, boolean changed) {
OS.pango_layout_set_text (layout, buffer1, buffer1.length);
int width, height = 0 ;
GTK.gtk_widget_realize (handle);
- if (GTK.GTK3) {
- GTK.gtk_widget_set_size_request (handle, wHint, hHint);
- GtkRequisition requisition = new GtkRequisition ();
- GTK.gtk_widget_get_preferred_size (handle, requisition, null);
- width = wHint == SWT.DEFAULT ? requisition.width : Math.max(wHint, requisition.width);
- height = hHint == SWT.DEFAULT ? requisition.height : hHint;
- } else {
- OS.pango_layout_get_pixel_size (layout, w, h);
- width = wHint == SWT.DEFAULT ? w [0] : wHint;
- height = hHint == SWT.DEFAULT ? h [0] : hHint;
- }
+ GTK.gtk_widget_set_size_request (handle, wHint, hHint);
+ GtkRequisition requisition = new GtkRequisition ();
+ GTK.gtk_widget_get_preferred_size (handle, requisition, null);
+ width = wHint == SWT.DEFAULT ? requisition.width : Math.max(wHint, requisition.width);
+ height = hHint == SWT.DEFAULT ? requisition.height : hHint;
OS.pango_layout_set_text (layout, buffer2, buffer2.length);
Rectangle trim = computeTrimInPixels (0, 0, width, height);
return new Point (trim.width, trim.height);
@@ -259,36 +252,23 @@ Rectangle computeTrimInPixels (int x, int y, int width, int height) {
checkWidget ();
int xborder = 0, yborder = 0;
Rectangle trim = super.computeTrimInPixels (x, y, width, height);
- if (GTK.GTK3) {
- GtkBorder tmp = new GtkBorder();
- long /*int*/ context = GTK.gtk_widget_get_style_context (handle);
+ GtkBorder tmp = new GtkBorder();
+ long /*int*/ context = GTK.gtk_widget_get_style_context (handle);
+ if (GTK.GTK_VERSION < OS.VERSION(3, 18, 0)) {
+ GTK.gtk_style_context_get_padding (context, GTK.GTK_STATE_FLAG_NORMAL, tmp);
+ } else {
+ GTK.gtk_style_context_get_padding (context, GTK.gtk_widget_get_state_flags(handle), tmp);
+ }
+ if ((style & SWT.BORDER) != 0) {
if (GTK.GTK_VERSION < OS.VERSION(3, 18, 0)) {
- GTK.gtk_style_context_get_padding (context, GTK.GTK_STATE_FLAG_NORMAL, tmp);
+ GTK.gtk_style_context_get_border (context, GTK.GTK_STATE_FLAG_NORMAL, tmp);
} else {
- GTK.gtk_style_context_get_padding (context, GTK.gtk_widget_get_state_flags(handle), tmp);
- }
- if ((style & SWT.BORDER) != 0) {
- if (GTK.GTK_VERSION < OS.VERSION(3, 18, 0)) {
- GTK.gtk_style_context_get_border (context, GTK.GTK_STATE_FLAG_NORMAL, tmp);
- } else {
- GTK.gtk_style_context_get_border (context, GTK.gtk_widget_get_state_flags(handle), tmp);
- }
- trim.x -= tmp.left;
- trim.y -= tmp.top;
- trim.width += tmp.left + tmp.right;
- trim.height += tmp.top + tmp.bottom;
- }
- }else {
- Point thickness = getThickness (handle);
- if ((this.style & SWT.BORDER) != 0) {
- xborder += thickness.x;
- yborder += thickness.y;
+ GTK.gtk_style_context_get_border (context, GTK.gtk_widget_get_state_flags(handle), tmp);
}
- long /*int*/ fontDesc = getFontDescription ();
- int fontSize = OS.pango_font_description_get_size (fontDesc);
- int arrowSize = Math.max (OS.PANGO_PIXELS (fontSize), MIN_ARROW_WIDTH);
- arrowSize = arrowSize - arrowSize % 2;
- trim.width += arrowSize + (2 * thickness.x);
+ trim.x -= tmp.left;
+ trim.y -= tmp.top;
+ trim.width += tmp.left + tmp.right;
+ trim.height += tmp.top + tmp.bottom;
}
int [] property = new int [1];
GTK.gtk_widget_style_get (handle, OS.interior_focus, property, 0);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java
index 9858d4f9a6..13e389936a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java
@@ -201,7 +201,7 @@ Point computeSizeInPixels (int wHint, int hHint, boolean changed) {
GTK.gtk_notebook_set_scrollable (handle, false);
Point notebookSize = computeNativeSize (handle, wHint, hHint, changed);
GTK.gtk_notebook_set_scrollable (handle, scrollable);
- if (GTK.GTK_VERSION >= OS.VERSION (3, 2, 0)) {
+ if (GTK.GTK_VERSION >= OS.VERSION (3, 4, 0)) {
int[] initialGap = new int[1];
GTK.gtk_widget_style_get (handle, OS.initial_gap, initialGap, 0);
notebookSize.x += initialGap[0]*2;
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 c224fb7f4c..7ad12e5d1d 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
@@ -2283,7 +2283,7 @@ long /*int*/ gtk_toggled (long /*int*/ renderer, long /*int*/ pathStr) {
}
@Override
-void gtk_widget_size_request (long /*int*/ widget, GtkRequisition requisition) {
+void gtk_widget_get_preferred_size (long /*int*/ widget, GtkRequisition requisition) {
/*
* Bug in GTK. For some reason, gtk_widget_size_request() fails
* to include the height of the tree view items when there are
@@ -2291,7 +2291,7 @@ void gtk_widget_size_request (long /*int*/ widget, GtkRequisition requisition) {
* visible.
*/
if (columnCount == 0) {
- super.gtk_widget_size_request (widget, requisition);
+ super.gtk_widget_get_preferred_size (widget, requisition);
return;
}
long /*int*/ columns = GTK.gtk_tree_view_get_columns (handle), list = columns;
@@ -2309,7 +2309,7 @@ void gtk_widget_size_request (long /*int*/ widget, GtkRequisition requisition) {
columnHandle = OS.g_list_data (columns);
GTK.gtk_tree_view_column_set_visible (columnHandle, true);
}
- super.gtk_widget_size_request (widget, requisition);
+ super.gtk_widget_get_preferred_size (widget, requisition);
if (fixVisible) {
GTK.gtk_tree_view_column_set_visible (columnHandle, false);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
index 9ebb9ed2f5..78a48f6b00 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
@@ -878,7 +878,7 @@ void resizeHandle(int width, int height) {
* a call to gtk_widget_size_request().
*/
GtkRequisition requisition = new GtkRequisition ();
- parent.gtk_widget_size_request (handle, requisition);
+ parent.gtk_widget_get_preferred_size (handle, requisition);
GtkAllocation allocation = new GtkAllocation ();
GTK.gtk_widget_get_allocation (handle, allocation);
allocation.width = width;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java
index cbc3d142a3..52ea486881 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java
@@ -294,8 +294,8 @@ long /*int*/ gtk_size_allocate (long /*int*/ widget, long /*int*/ allocation) {
if (GDK.gdk_drawable_get_depth (image.mask) == 1) {
GtkAllocation widgetAllocation = new GtkAllocation ();
GTK.gtk_widget_get_allocation (widget, widgetAllocation);
- int xoffset = (int) Math.floor (widgetAllocation.x + ((widgetAllocation.width -GTK.GTK_WIDGET_REQUISITION_WIDTH (widget)) * 0.5) + 0.5);
- int yoffset = (int) Math.floor (widgetAllocation.y + ((widgetAllocation.height - GTK.GTK_WIDGET_REQUISITION_HEIGHT (widget)) * 0.5) + 0.5);
+ int xoffset = (int) Math.floor (widgetAllocation.x + ((widgetAllocation.width) * 0.5) + 0.5);
+ int yoffset = (int) Math.floor (widgetAllocation.y + ((widgetAllocation.height) * 0.5) + 0.5);
Rectangle b = image.getBoundsInPixels();
long /*int*/ gdkImagePtr = GDK.gdk_drawable_get_image (image.mask, 0, 0, b.width, b.height);
if (gdkImagePtr == 0) error(SWT.ERROR_NO_HANDLES);
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 cf3c3ab716..2063b68d6b 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
@@ -2476,7 +2476,7 @@ long /*int*/ gtk_toggled (long /*int*/ renderer, long /*int*/ pathStr) {
}
@Override
-void gtk_widget_size_request (long /*int*/ widget, GtkRequisition requisition) {
+void gtk_widget_get_preferred_size (long /*int*/ widget, GtkRequisition requisition) {
/*
* Bug in GTK. For some reason, gtk_widget_size_request() fails
* to include the height of the tree view items when there are
@@ -2484,7 +2484,7 @@ void gtk_widget_size_request (long /*int*/ widget, GtkRequisition requisition) {
* visible.
*/
if (columnCount == 0) {
- super.gtk_widget_size_request (widget, requisition);
+ super.gtk_widget_get_preferred_size (widget, requisition);
return;
}
long /*int*/ columns = GTK.gtk_tree_view_get_columns (handle), list = columns;
@@ -2502,7 +2502,7 @@ void gtk_widget_size_request (long /*int*/ widget, GtkRequisition requisition) {
columnHandle = OS.g_list_data (columns);
GTK.gtk_tree_view_column_set_visible (columnHandle, true);
}
- super.gtk_widget_size_request (widget, requisition);
+ super.gtk_widget_get_preferred_size (widget, requisition);
if (fixVisible) {
GTK.gtk_tree_view_column_set_visible (columnHandle, false);
}
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 ae93fa000e..8e967e994a 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
@@ -951,14 +951,10 @@ long /*int*/ gtk_toggled (long /*int*/ renderer, long /*int*/ pathStr) {
* prevents a stack overflow from occurring.
*/
boolean gtk_tree_view_column_cell_get_position (long /*int*/ column, long /*int*/ cell_renderer, int[] start_pos, int[] width) {
- if (GTK.GTK3) {
- Callback.setEnabled(false);
- boolean result = GTK.gtk_tree_view_column_cell_get_position (column, cell_renderer, start_pos, width);
- Callback.setEnabled(true);
- return result;
- } else {
- return GTK.gtk_tree_view_column_cell_get_position (column, cell_renderer, start_pos, width);
- }
+ Callback.setEnabled(false);
+ boolean result = GTK.gtk_tree_view_column_cell_get_position (column, cell_renderer, start_pos, width);
+ Callback.setEnabled(true);
+ return result;
}
long /*int*/ gtk_unmap (long /*int*/ widget) {
@@ -2020,22 +2016,14 @@ long /*int*/ gdk_window_get_device_position (long /*int*/ window, int[] x, int[]
}
void gtk_cell_renderer_get_preferred_size (long /*int*/ cell, long /*int*/ widget, int[] width, int[] height) {
- if (GTK.GTK3) {
- GtkRequisition minimum_size = new GtkRequisition ();
- GTK.gtk_cell_renderer_get_preferred_size (cell, widget, minimum_size, null);
- if (width != null) width [0] = minimum_size.width;
- if (height != null) height[0] = minimum_size.height;
- } else {
- GTK.gtk_cell_renderer_get_size (cell, widget, null, null, null, width, height);
- }
+ GtkRequisition minimum_size = new GtkRequisition ();
+ GTK.gtk_cell_renderer_get_preferred_size (cell, widget, minimum_size, null);
+ if (width != null) width [0] = minimum_size.width;
+ if (height != null) height[0] = minimum_size.height;
}
void gtk_widget_get_preferred_size (long /*int*/ widget, GtkRequisition requisition){
- if (GTK.GTK3) {
- GTK.gtk_widget_get_preferred_size (widget, requisition, null);
- } else {
- GTK.gtk_widget_size_request (widget, requisition);
- }
+ GTK.gtk_widget_get_preferred_size (widget, requisition, null);
}
void gtk_image_set_from_pixbuf (long /*int*/ imageHandle, long /*int*/ pixbuf){

Back to the top