summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java49
1 files changed, 13 insertions, 36 deletions
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 09e5150b5b..9f6c6ba29f 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
@@ -605,16 +605,12 @@ public Rectangle getClientArea () {
}
forceResize ();
int /*long*/ clientHandle = clientHandle ();
- int width = 0;
- int height = 0;
- GtkAllocation allocation = new GtkAllocation();
- if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) {
- OS.gtk_widget_get_allocation(clientHandle, allocation);
- width = (state & ZERO_WIDTH) != 0 ? 0 : allocation.width;
- height = (state & ZERO_HEIGHT) != 0 ? 0 : allocation.height;
- } else {
- width = (state & ZERO_WIDTH) != 0 ? 0 : OS.GTK_WIDGET_WIDTH (clientHandle);
- height = (state & ZERO_HEIGHT) != 0 ? 0 : OS.GTK_WIDGET_HEIGHT (clientHandle);
+ int width = 0, height = 0;
+ if ((state & ZERO_WIDTH) == 0) {
+ GtkAllocation allocation = new GtkAllocation();
+ gtk_widget_get_allocation (clientHandle, allocation);
+ width = allocation.width;
+ height = allocation.height;
}
return new Rectangle (0, 0, width, height);
}
@@ -622,14 +618,10 @@ public Rectangle getClientArea () {
}
int getClientWidth() {
+ if ((state & ZERO_WIDTH) != 0) return 0;
GtkAllocation allocation = new GtkAllocation();
- if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) {
- OS.gtk_widget_get_allocation(clientHandle (), allocation);
- return (state & ZERO_WIDTH) != 0 ? 0 : allocation.width;
- } else {
- return (state & ZERO_WIDTH) != 0 ? 0 : OS.GTK_WIDGET_WIDTH (clientHandle ());
- }
-
+ gtk_widget_get_allocation(clientHandle (), allocation);
+ return allocation.width;
}
/**
@@ -1217,20 +1209,11 @@ void moveChildren(int oldWidth) {
for (int i = 0; i < children.length; i++) {
Control child = children[i];
int /*long*/ topHandle = child.topHandle ();
- int x = 0;
- int y = 0;
- int controlWidth = 0;
GtkAllocation allocation = new GtkAllocation();
- if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) {
- OS.gtk_widget_get_allocation(topHandle, allocation);
- x = allocation.x;
- y = allocation.y;
- controlWidth = (child.state & ZERO_WIDTH) != 0 ? 0 : allocation.width;
- } else {
- x = OS.GTK_WIDGET_X (topHandle);
- y = OS.GTK_WIDGET_Y (topHandle);
- controlWidth = (child.state & ZERO_WIDTH) != 0 ? 0 : OS.GTK_WIDGET_WIDTH (topHandle);
- }
+ gtk_widget_get_allocation (topHandle, allocation);
+ int x = allocation.x;
+ int y = allocation.y;
+ int controlWidth = (child.state & ZERO_WIDTH) != 0 ? 0 : allocation.width;
if (oldWidth > 0) x = oldWidth - controlWidth - x;
int clientWidth = getClientWidth ();
x = clientWidth - controlWidth - x;
@@ -1247,12 +1230,6 @@ void moveChildren(int oldWidth) {
gtk_widget_size_request (topHandle, requisition);
allocation.x = x;
allocation.y = y;
- if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) {
- OS.gtk_widget_get_allocation(topHandle, allocation);
- } else {
- allocation.width = OS.GTK_WIDGET_WIDTH (topHandle);
- allocation.height = OS.GTK_WIDGET_HEIGHT (topHandle);
- }
OS.gtk_widget_size_allocate (topHandle, allocation);
Control control = child.findBackgroundControl ();
if (control != null && control.backgroundImage != null) {