diff options
author | Simeon Andreev | 2022-01-10 10:28:26 +0000 |
---|---|---|
committer | Andrey Loskutov | 2022-01-13 15:24:47 +0000 |
commit | 9b82966daed972320524a81a4a328de6c1ac9a5c (patch) | |
tree | 0ae61790b92db6bb01de6a46b8133f95fcb19ee5 /tests/org.eclipse.swt.tests.gtk/ManualTests/org | |
parent | b2365a601a01a6c1bc07db109575f8a27c2ff9b7 (diff) | |
download | eclipse.platform.swt-9b82966daed972320524a81a4a328de6c1ac9a5c.tar.gz eclipse.platform.swt-9b82966daed972320524a81a4a328de6c1ac9a5c.tar.xz eclipse.platform.swt-9b82966daed972320524a81a4a328de6c1ac9a5c.zip |
Bug 546961 - Scrollbar slider broken after debug hover resize
Added an extra resize for a Shell with custom resize, after triggering a
layout update for child widges of the Shell. This is a workaround for a
bug in GTK+, which results in not painting scrollbar sliders correctly
on scrolling.
Change-Id: I3980af5853c56c58a6e8e41e274d568524683d2b
Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
Reviewed-on: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/189427
Tested-by: Platform Bot <platform-bot@eclipse.org>
Tested-by: Andrey Loskutov <loskutov@gmx.de>
Reviewed-by: Andrey Loskutov <loskutov@gmx.de>
Diffstat (limited to 'tests/org.eclipse.swt.tests.gtk/ManualTests/org')
-rw-r--r-- | tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug546961_Scrollbar_Slider_Popup_Shell.java | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug546961_Scrollbar_Slider_Popup_Shell.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug546961_Scrollbar_Slider_Popup_Shell.java new file mode 100644 index 0000000000..9b3909a12a --- /dev/null +++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug546961_Scrollbar_Slider_Popup_Shell.java @@ -0,0 +1,76 @@ +/******************************************************************************* + * Copyright (c) 2022 Simeon Andreev and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Simeon Andreev - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.tests.gtk.snippets; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Scrollable; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +/** + * Description: After resizing a pop-up {@link Shell}, + * scrollbars of {@link Scrollable} child widgets + * no longer paint sliders correctly when scrolling. + * <p> + * Steps to reproduce: + * <ol> + * <li>Run the snippet.</li> + * <li>Resize the pop-up {@link Shell}, so that scrollbars can still be used.</li> + * <li>Scroll with mouse drag, observe that the sliders of the scrollbars don't move.</li> + * </ol> + * </p> + * Expected results: Scrollbar sliders move during scrolling. + * Actual results: Scrollbar sliders don't move when scrolling. + */ +public class Bug546961_Scrollbar_Slider_Popup_Shell { + + public static void main(String[] args) { + Display display = new Display(); + Shell shell = new Shell(display); + shell.setSize(400, 300); + shell.setText("Bug 546961"); + shell.setLayout(new FillLayout()); + + Shell s = new Shell(shell, SWT.ON_TOP | SWT.RESIZE); + s.setLayout(new FillLayout()); + s.setSize(300, 200); + Composite c = new Composite(s, SWT.BORDER); + c.setLayout(new FillLayout()); + + int n = 30; + int m = 30; + StringBuilder content = new StringBuilder(); + for (int i = 10; i <= n; ++i) { + for (int j = 10; j <= m; ++j) { + content.append(i + "." + j); + content.append(' '); + } + content.append(System.lineSeparator()); + } + Text text = new Text(c, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); + text.setText(content.toString()); + s.open(); + + shell.open(); + while (!shell.isDisposed()) { + if (!display.readAndDispatch()) + display.sleep(); + } + display.dispose(); + } + +} |