diff options
author | Steve Northover <steve> | 2004-10-14 21:56:47 +0000 |
---|---|---|
committer | Steve Northover <steve> | 2004-10-14 21:56:47 +0000 |
commit | bb4bcf269d79e4bbfbecea2088c8afbce7fcac2e (patch) | |
tree | 7d88c562e955d2f545648c705007c968799f05ed /bundles | |
parent | ec4463e5809457fec0c4e8fa95d96c7900df01c5 (diff) | |
download | eclipse.platform.swt-bb4bcf269d79e4bbfbecea2088c8afbce7fcac2e.tar.gz eclipse.platform.swt-bb4bcf269d79e4bbfbecea2088c8afbce7fcac2e.tar.xz eclipse.platform.swt-bb4bcf269d79e4bbfbecea2088c8afbce7fcac2e.zip |
fix extra layout when moved
Diffstat (limited to 'bundles')
13 files changed, 51 insertions, 39 deletions
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 a1b45faf03..2c9e554001 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 @@ -553,15 +553,15 @@ void setBackgroundColor (GdkColor color) { if (imageHandle != 0) setBackgroundColor(imageHandle, color); } -boolean setBounds (int x, int y, int width, int height, boolean move, boolean resize) { - boolean result = super.setBounds (x, y, width, height, move, resize); +int setBounds (int x, int y, int width, int height, boolean move, boolean resize) { + int result = super.setBounds (x, y, width, height, move, resize); /* * 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 all available space * excluding trimmings. */ - if (resize && result && (style & (SWT.CHECK | SWT.RADIO)) != 0) { + if ((result & RESIZED) != 0 && (style & (SWT.CHECK | SWT.RADIO)) != 0) { int childHeight = 0, buttonWidth = 0, buttonHeight = 0; GtkRequisition requisition = new GtkRequisition (); OS.gtk_widget_size_request (handle, requisition); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java index 76bce69e6d..dfb8b327f5 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Canvas.java @@ -234,12 +234,12 @@ public void scroll (int destX, int destY, int x, int y, int width, int height, b if (isFocus) caret.setFocus (); } -boolean setBounds (int x, int y, int width, int height, boolean move, boolean resize) { +int setBounds (int x, int y, int width, int height, boolean move, boolean resize) { boolean isFocus = caret != null && caret.isFocusCaret (); if (isFocus) caret.killFocus (); - boolean changed = super.setBounds (x, y, width, height, move, resize); + int result = super.setBounds (x, y, width, height, move, resize); if (isFocus) caret.setFocus (); - return changed; + return result; } /** 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 541db5fbe7..a60cc4cd82 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 @@ -1195,7 +1195,7 @@ void setBackgroundColor (GdkColor color) { if (listHandle != 0) OS.gtk_widget_modify_base (listHandle, 0, color); } -boolean setBounds (int x, int y, int width, int height, boolean move, boolean resize) { +int setBounds (int x, int y, int width, int height, boolean move, boolean resize) { int newHeight = (resize && (style & SWT.DROP_DOWN) != 0) ? getTextHeight () : height; return super.setBounds (x, y, width, newHeight, move, resize); } 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 fb2c5ee15f..0a51986b93 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 @@ -708,10 +708,10 @@ void resizeHandle (int width, int height) { if (socketHandle != 0) OS.gtk_widget_set_size_request (socketHandle, width, height); } -boolean setBounds (int x, int y, int width, int height, boolean move, boolean resize) { - boolean changed = super.setBounds (x, y, width, height, move, resize); - if (changed && resize && layout != null) layout.layout (this, false); - return changed; +int setBounds (int x, int y, int width, int height, boolean move, boolean resize) { + int result = super.setBounds (x, y, width, height, move, resize); + if ((result & RESIZED) != 0 && layout != null) layout.layout (this, false); + return result; } public boolean setFocus () { 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 5389ac5272..ced85bafc8 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 @@ -496,7 +496,7 @@ void resizeHandle (int width, int height) { OS.gtk_widget_size_request (handle, requisition); } -boolean setBounds (int x, int y, int width, int height, boolean move, boolean resize) { +int setBounds (int x, int y, int width, int height, boolean move, boolean resize) { int /*long*/ topHandle = topHandle (); int flags = OS.GTK_WIDGET_FLAGS (topHandle); OS.GTK_WIDGET_SET_FLAGS (topHandle, OS.GTK_VISIBLE); @@ -538,9 +538,16 @@ boolean setBounds (int x, int y, int width, int height, boolean move, boolean re if ((flags & OS.GTK_VISIBLE) == 0) { OS.GTK_WIDGET_UNSET_FLAGS (topHandle, OS.GTK_VISIBLE); } - if (!sameOrigin) sendEvent (SWT.Move); - if (!sameExtent) sendEvent (SWT.Resize); - return !sameOrigin || !sameExtent; + int result = 0; + if (move && !sameOrigin) { + sendEvent (SWT.Move); + result |= MOVED; + } + if (resize && !sameExtent) { + sendEvent (SWT.Resize); + result |= RESIZED; + } + return result; } /** 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 7478059d2e..345b61ff32 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 @@ -383,7 +383,7 @@ void setBackgroundColor (GdkColor color) { if (imageHandle != 0) setBackgroundColor(imageHandle, color); } -boolean setBounds (int x, int y, int width, int height, boolean move, boolean resize) { +int setBounds (int x, int y, int width, int height, boolean move, boolean resize) { /* * Bug in GTK. For some reason, when the label is * wrappable and its container is resized, it does not @@ -398,7 +398,7 @@ boolean setBounds (int x, int y, int width, int height, boolean move, boolean re */ boolean fixWrap = resize && labelHandle != 0 && (style & SWT.WRAP) != 0; if (fixWrap) OS.gtk_widget_set_size_request (labelHandle, -1, -1); - boolean changed = super.setBounds (x, y, width, height, move, resize); + int result = super.setBounds (x, y, width, height, move, resize); /* * Bug in GTK. For some reason, when the label is * wrappable and its container is resized, it does not @@ -410,7 +410,7 @@ boolean setBounds (int x, int y, int width, int height, boolean move, boolean re * This part of the fix forces the label to be * resized so that it will draw wrapped. */ - if (fixWrap) { + if (fixWrap && (result & RESIZED) != 0) { int labelWidth = OS.GTK_WIDGET_WIDTH (handle); int labelHeight = OS.GTK_WIDGET_HEIGHT (handle); OS.gtk_widget_set_size_request (labelHandle, labelWidth, labelHeight); @@ -418,7 +418,7 @@ boolean setBounds (int x, int y, int width, int height, boolean move, boolean re GtkRequisition requisition = new GtkRequisition (); OS.gtk_widget_size_request (widgetHandle, requisition); } - return changed; + return result; } void setFontDescription (int /*long*/ font) { 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 c6ca0e40fa..6012b25ef2 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 @@ -1168,8 +1168,8 @@ void setBackgroundColor (GdkColor color) { OS.gtk_widget_modify_base (handle, 0, color); } -boolean setBounds (int x, int y, int width, int height, boolean move, boolean resize) { - boolean result = super.setBounds (x, y, width, height, move, resize); +int setBounds (int x, int y, int width, int height, boolean move, boolean resize) { + int result = super.setBounds (x, y, width, height, move, resize); /* * Bug on GTK. The tree view sometimes does not get a paint * event or resizes to a one pixel square when resized in a new 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 33862237ab..796b01aeb5 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 @@ -981,7 +981,8 @@ void resizeBounds (int width, int height, boolean notify) { } } -boolean setBounds (int x, int y, int width, int height, boolean move, boolean resize) { +int setBounds (int x, int y, int width, int height, boolean move, boolean resize) { + int result = 0; if (move) { int [] x_pos = new int [1], y_pos = new int [1]; OS.gtk_window_get_position (shellHandle, x_pos, y_pos); @@ -991,6 +992,7 @@ boolean setBounds (int x, int y, int width, int height, boolean move, boolean re oldX = x; oldY = y; sendEvent(SWT.Move); + result |= MOVED; } } if (resize) { @@ -1001,10 +1003,11 @@ boolean setBounds (int x, int y, int width, int height, boolean move, boolean re if (changed) { oldWidth = width; oldHeight = height; + result |= RESIZED; } resizeBounds (width, height, changed); } - return move || resize; + return result; } void setCursor (int /*long*/ cursor) { 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 62b914c5cf..8deb5a75ce 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 @@ -565,9 +565,9 @@ public void removeSelectionListener (SelectionListener listener) { eventTable.unhook (SWT.DefaultSelection,listener); } -boolean setBounds (int x, int y, int width, int height, boolean move, boolean resize) { - boolean changed = super.setBounds (x, y, width, height, move, resize); - if (changed && resize) { +int setBounds (int x, int y, int width, int height, boolean move, boolean resize) { + int result = super.setBounds (x, y, width, height, move, resize); + if ((result & RESIZED) != 0) { int index = getSelectionIndex (); if (index != -1) { TabItem item = items [index]; @@ -577,7 +577,7 @@ boolean setBounds (int x, int y, int width, int height, boolean move, boolean re } } } - return changed; + return result; } void setFontDescription (int /*long*/ font) { 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 4b27e51dca..65c483074b 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 @@ -1953,8 +1953,8 @@ void setBackgroundColor (GdkColor color) { OS.gtk_widget_modify_base (handle, 0, color); } -boolean setBounds (int x, int y, int width, int height, boolean move, boolean resize) { - boolean result = super.setBounds (x, y, width, height, move, resize); +int setBounds (int x, int y, int width, int height, boolean move, boolean resize) { + int result = super.setBounds (x, y, width, height, move, resize); /* * Bug on GTK. The tree view sometimes does not get a paint * event or resizes to a one pixel square when resized in a new diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java index e2325e231e..700195899f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java @@ -402,10 +402,10 @@ void removeControl (Control control) { } } -boolean setBounds (int x, int y, int width, int height, boolean move, boolean resize) { - boolean changed = super.setBounds (x, y, width, height, move, resize); - if (changed && resize) layoutItems (); - return changed; +int setBounds (int x, int y, int width, int height, boolean move, boolean resize) { + int result = super.setBounds (x, y, width, height, move, resize); + if ((result & RESIZED) != 0) layoutItems (); + return result; } void setFontDescription (int /*long*/ font) { 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 d4f6023a77..2c156165fa 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 @@ -971,8 +971,8 @@ void setBackgroundColor (GdkColor color) { OS.gtk_widget_modify_base (handle, 0, color); } -boolean setBounds (int x, int y, int width, int height, boolean move, boolean resize) { - boolean result = super.setBounds (x, y, width, height, move, resize); +int setBounds (int x, int y, int width, int height, boolean move, boolean resize) { + int result = super.setBounds (x, y, width, height, move, resize); /* * Bug on GTK. The tree view sometimes does not get a paint * event or resizes to a one pixel square when resized in a new 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 4148acc376..cae77c3efe 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 @@ -56,11 +56,13 @@ public abstract class Widget { /* Global state flags */ static final int DISPOSED = 1<<0; static final int CANVAS = 1<<1; - static final int KEYED_DATA = 1<<2; + static final int KEYED_DATA = 1<<2; static final int HANDLE = 1<<3; - static final int DISABLED = 1<<4; - static final int MENU = 1<<5; - static final int OBSCURED = 1<<6; + static final int DISABLED = 1<<4; + static final int MENU = 1<<5; + static final int OBSCURED = 1<<6; + static final int MOVED = 1<<7; + static final int RESIZED = 1<<8; /* Default widths for widgets */ static final int DEFAULT_WIDTH = 64; |