Skip to main content
aboutsummaryrefslogtreecommitdiffstats
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.java77
1 files changed, 41 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 fe9bd61d73..77255563f1 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
@@ -358,51 +358,23 @@ void createHandle (int index, boolean fixed, boolean scrolled) {
/**
* Iterates though the array of child widgets that need to have their clips
- * adjusted: if a child has a negative clip, adjust it. Also check if the child's
- * allocation is negative and adjust it as necessary.
+ * adjusted, and calls Control.adjustChildClipping() on it.
*
- * <p>If the array is empty this method just returns. See bug 500703.</p>
+ * The default implementation in Composite is: if a child has a negative clip, adjust it.
+ * Also check if the child's allocation is negative, and adjust it as necessary.
+ *
+ * <p>If the array is empty this method just returns. See bug 500703, and 539367.</p>
*/
-void fixChildClippings () {
+void fixClippings () {
if (fixClipHandle == 0 || fixClipMap.isEmpty()) {
return;
} else {
- GtkRequisition minimumSize = new GtkRequisition ();
- GtkRequisition naturalSize = new GtkRequisition ();
- GtkAllocation clip = new GtkAllocation ();
- GtkAllocation allocation = new GtkAllocation ();
Control [] children = _getChildren();
for (Control child : children) {
if (fixClipMap.containsKey(child)) {
long /*int*/ [] childHandles = fixClipMap.get(child);
for (long /*int*/ widget : childHandles) {
- GTK.gtk_widget_get_allocation(widget, allocation);
- GTK.gtk_widget_get_clip(widget, clip);
- /*
- * If the clip is negative, add the x coordinate to the width
- * and set the x coordinate to 0.
- */
- if (clip.x < 0) {
- clip.width = clip.width + clip.x;
- clip.x = 0;
- /*
- * Some "transient" widgets like menus get allocations of
- * {-1, -1, 1, 1}. Check to make sure this isn't the case
- * before proceeding.
- */
- if (allocation.x < -1 && (allocation.width > 1 || allocation.height > 1)) {
- // Adjust the allocation just like the clip, if it's negative
- allocation.width = allocation.width + allocation.x;
- allocation.x = 0;
- // Call gtk_widget_get_preferred_size() to prevent warnings
- GTK.gtk_widget_get_preferred_size(widget, minimumSize, naturalSize);
- // Allocate and queue a resize event
- GTK.gtk_widget_size_allocate(widget, allocation);
- GTK.gtk_widget_queue_resize(widget);
- }
- }
- // Adjust the clip
- GTK.gtk_widget_set_clip(widget, allocation);
+ child.adjustChildClipping(widget);
}
}
}
@@ -410,6 +382,39 @@ void fixChildClippings () {
}
@Override
+void adjustChildClipping (long /*int*/ widget) {
+ GtkRequisition minimumSize = new GtkRequisition ();
+ GtkRequisition naturalSize = new GtkRequisition ();
+ GtkAllocation clip = new GtkAllocation ();
+ GtkAllocation allocation = new GtkAllocation ();
+ GTK.gtk_widget_get_allocation(widget, allocation);
+ GTK.gtk_widget_get_clip(widget, clip);
+ /*
+ * If the clip is negative, add the x coordinate to the width
+ * and set the x coordinate to 0.
+ */
+ if (clip.x < 0) {
+ /*
+ * Some "transient" widgets like menus get allocations of
+ * {-1, -1, 1, 1}. Check to make sure this isn't the case
+ * before proceeding.
+ */
+ if (allocation.x < -1 && (allocation.width > 1 || allocation.height > 1)) {
+ // Adjust the allocation just like the clip, if it's negative
+ allocation.width = allocation.width + allocation.x;
+ allocation.x = 0;
+ // Call gtk_widget_get_preferred_size() to prevent warnings
+ GTK.gtk_widget_get_preferred_size(widget, minimumSize, naturalSize);
+ // Allocate and queue a resize event
+ GTK.gtk_widget_size_allocate(widget, allocation);
+ GTK.gtk_widget_queue_resize(widget);
+ }
+ }
+ // Adjust the clip
+ GTK.gtk_widget_set_clip(widget, allocation);
+}
+
+@Override
long /*int*/ gtk_draw (long /*int*/ widget, long /*int*/ cairo) {
if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0)) {
long /*int*/ context = GTK.gtk_widget_get_style_context(widget);
@@ -423,7 +428,7 @@ long /*int*/ gtk_draw (long /*int*/ widget, long /*int*/ cairo) {
if (GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) {
// If fixClipHandle is set: iterate through the children of widget
// and set their clips to be that of their allocation
- if (widget == fixClipHandle) fixChildClippings();
+ if (widget == fixClipHandle) fixClippings();
}
}
return super.gtk_draw(widget, cairo);

Back to the top