diff options
author | Steve Northover <steve> | 2005-04-08 16:18:06 +0000 |
---|---|---|
committer | Steve Northover <steve> | 2005-04-08 16:18:06 +0000 |
commit | b103fd807559d48c897b2c2c3616c607a2d74179 (patch) | |
tree | e92bd3e7c599636573e83274e67cf7a658d547d0 | |
parent | 08b35427b630b058d33816f10064b6c3de68a1f4 (diff) | |
download | eclipse.platform.swt-b103fd807559d48c897b2c2c3616c607a2d74179.tar.gz eclipse.platform.swt-b103fd807559d48c897b2c2c3616c607a2d74179.tar.xz eclipse.platform.swt-b103fd807559d48c897b2c2c3616c607a2d74179.zip |
fix redraw() and redrawHandle() to call XClearArea() properly
6 files changed, 29 insertions, 62 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Canvas.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Canvas.java index 8578be4b9d..510e345576 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Canvas.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Canvas.java @@ -96,10 +96,10 @@ public Caret getCaret () { Caret getIMCaret () { return caret; } -void redrawWidget (int x, int y, int width, int height, boolean all) { +void redrawWidget (int x, int y, int width, int height, boolean redrawAll, boolean allChildren) { boolean isFocus = caret != null && caret.isFocusCaret (); if (isFocus) caret.killFocus (); - super.redrawWidget (x, y, width, height, all); + super.redrawWidget (x, y, width, height, redrawAll, allChildren); if (isFocus) caret.setFocus (); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Composite.java index d3aab6bf9d..4f05236bd5 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Composite.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Composite.java @@ -799,14 +799,14 @@ void register () { super.register (); if (focusHandle != 0) display.addWidget (focusHandle, this); } -void redrawWidget (int x, int y, int width, int height, boolean all) { - super.redrawWidget (x, y, width, height, all); - if (!all) return; +void redrawWidget (int x, int y, int width, int height, boolean redrawAll, boolean allChildren) { + super.redrawWidget (x, y, width, height, redrawAll, allChildren); + if (!allChildren) return; Control [] children = _getChildren (); for (int i = 0; i < children.length; i++) { Control child = children [i]; Point location = child.getClientLocation (); - child.redrawWidget (x - location.x, y - location.y, width, height, all); + child.redrawWidget (x - location.x, y - location.y, width, height, redrawAll, allChildren); } } void releaseChildren () { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Control.java index 7acb33cd16..255bfc4e8b 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Control.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Control.java @@ -1425,7 +1425,7 @@ void realizeChildren () { */ public void redraw () { checkWidget(); - redrawWidget (0, 0, 0, 0, false); + redrawWidget (0, 0, 0, 0, true, false); } /** * Causes the rectangular area of the receiver specified by @@ -1458,11 +1458,12 @@ public void redraw () { */ public void redraw (int x, int y, int width, int height, boolean all) { checkWidget (); - if (width <= 0 || height <= 0) return; - redrawWidget (x, y, width, height, all); + if (width > 0 && height > 0) { + redrawWidget (x, y, width, height, false, all); + } } -void redrawWidget (int x, int y, int width, int height, boolean all) { - redrawHandle (x, y, width, height, handle); +void redrawWidget (int x, int y, int width, int height, boolean redrawAll, boolean allChildren) { + redrawHandle (x, y, width, height, redrawAll, handle); } void releaseChild () { parent.removeControl (this); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Group.java index 7181a8be71..63e66a88d8 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Group.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Group.java @@ -236,13 +236,13 @@ void propagateWidget (boolean enabled) { super.propagateWidget (enabled); propagateHandle (enabled, labelHandle, OS.None); } -void redrawWidget (int x, int y, int width, int height, boolean all) { - super.redrawWidget (x, y, width, height, all); +void redrawWidget (int x, int y, int width, int height, boolean redrawAll, boolean allChildren) { + super.redrawWidget (x, y, width, height, redrawAll, allChildren); short [] root_x = new short [1], root_y = new short [1]; OS.XtTranslateCoords (handle, (short) x, (short) y, root_x, root_y); short [] label_x = new short [1], label_y = new short [1]; OS.XtTranslateCoords (labelHandle, (short) 0, (short) 0, label_x, label_y); - redrawHandle (root_x [0] - label_x [0], root_y [0] - label_y [0], width, height, labelHandle); + redrawHandle (root_x [0] - label_x [0], root_y [0] - label_y [0], width, height, redrawAll, labelHandle); } void releaseHandle () { super.releaseHandle (); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Scrollable.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Scrollable.java index a3e766c6ae..157f16289e 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Scrollable.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Scrollable.java @@ -234,37 +234,6 @@ void propagateWidget (boolean enabled) { if (verticalBar != null) verticalBar.propagateWidget (enabled); } } -void redrawWidget (int x, int y, int width, int height, boolean all) { - super.redrawWidget (x, y, width, height, all); - /* - * Uncomment this code to force the window trimmings to redraw. - */ -// if (formHandle == 0 && scrolledHandle == 0) return; -// short [] root_x = new short [1], root_y = new short [1]; -// OS.XtTranslateCoords (handle, (short) x, (short) y, root_x, root_y); -// if (formHandle != 0) { -// short [] form_x = new short [1], form_y = new short [1]; -// OS.XtTranslateCoords (formHandle, (short) 0, (short) 0, form_x, form_y); -// redrawHandle (root_x [0] - form_x [0], root_y [0] - form_y [0], width, height, formHandle); -// } -// if (scrolledHandle != 0) { -// short [] scrolled_x = new short [1], scrolled_y = new short [1]; -// OS.XtTranslateCoords (scrolledHandle, (short) 0, (short) 0, scrolled_x, scrolled_y); -// redrawHandle (root_x [0] - scrolled_x [0], root_y [0] - scrolled_y [0], width, height, scrolledHandle); -// if (horizontalBar != null && horizontalBar.getVisible ()) { -// int horizontalHandle = horizontalBar.handle; -// short [] hscroll_x = new short [1], hscroll_y = new short [1]; -// OS.XtTranslateCoords (horizontalHandle, (short) 0, (short) 0, hscroll_x, hscroll_y); -// redrawHandle (root_x [0] - hscroll_x [0], root_y [0] - hscroll_y [0], width, height, horizontalHandle); -// } -// if (verticalBar != null && verticalBar.getVisible ()) { -// int verticalHandle = verticalBar.handle; -// short [] vscroll_x = new short [1], vscroll_y = new short [1]; -// OS.XtTranslateCoords (verticalHandle, (short) 0, (short) 0, vscroll_x, vscroll_y); -// redrawHandle (root_x [0] - vscroll_x [0], root_y [0] - vscroll_y [0], width, height, verticalHandle); -// } -// } -} void register () { super.register (); if (formHandle != 0) display.addWidget (formHandle, this); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Widget.java index 77a5efda9d..264accfaa1 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Widget.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Widget.java @@ -583,27 +583,24 @@ void propagateHandle (boolean enabled, int widgetHandle, int cursor) { attributes.cursor = cursor; OS.XChangeWindowAttributes (xDisplay, xWindow, mask, attributes); } -void redrawHandle (int x, int y, int width, int height, int widgetHandle) { +void redrawHandle (int x, int y, int width, int height, boolean redrawAll, int widgetHandle) { int display = OS.XtDisplay (widgetHandle); if (display == 0) return; int window = OS.XtWindow (widgetHandle); if (window == 0) return; - int [] argList = { - OS.XmNwidth, 0, /* 1 */ - OS.XmNheight, 0, /* 3 */ - OS.XmNborderWidth, 0, /* 5 */ - OS.XmNborderColor, 0, /* 7 */ - }; - OS.XtGetValues (widgetHandle, argList, argList.length / 2); - /* - * Uncomment this code to force the window trimmings to redraw. - */ -// if (argList [5] != 0) { -// /* Force the border to repaint by setting the color */ -// OS.XtSetValues (widgetHandle, argList, argList.length / 2); -// } - if ((x < argList [1]) && (y < argList [3]) && (x + width > 0) && (y + height > 0)) { - OS.XClearArea (display, window, x, y, width, height, true); + if (redrawAll) { + OS.XClearArea (display, window, 0, 0, 0, 0, true); + } else { + if (width > 0 && height > 0) { + int [] argList = { + OS.XmNwidth, 0, /* 1 */ + OS.XmNheight, 0, /* 3 */ + }; + OS.XtGetValues (widgetHandle, argList, argList.length / 2); + if ((x < argList [1]) && (y < argList [3]) && (x + width > 0) && (y + height > 0)) { + OS.XClearArea (display, window, x, y, width, height, true); + } + } } } void register () { |