Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEric Williams2018-03-23 20:12:53 +0000
committerEric Williams2018-03-28 13:41:42 +0000
commit4b0412b94e47be8f2c5480568a36ec71809a148f (patch)
tree4f8feb4ee2c641352622e053f494de85dce7e02f /tests
parent4d2c33af20c542f90d3e1a83000c87c19cfafcd5 (diff)
downloadeclipse.platform.swt-4b0412b94e47be8f2c5480568a36ec71809a148f.tar.gz
eclipse.platform.swt-4b0412b94e47be8f2c5480568a36ec71809a148f.tar.xz
eclipse.platform.swt-4b0412b94e47be8f2c5480568a36ec71809a148f.zip
Bug 531928: [GTK3] Table editing is broken
The fix for bug 511133 introduced some logic which raises/lowers the GdkWindows of widgets who are children of Table or Tree. Unforunately, this breaks certain cases such as Tables/Trees that have more than one child widget. Additionally, changing the drawing handle from fixedHandle to handle meant that some child widgets were not getting their draw events properly. According to GTK, child widgets with non-native windows should receive draw events from their parent containers using gtk_container_propagate_draw(). This patch follows this advice and connects a Table/Tree's fixedHandle to the draw signal. The incoming draw events to that fixedHandle are then propagated to the respective child widgets using gtk_container_propagate_draw(). A reproducer snippet is attached. This patch also fixes a regression from bug 511133 which caused the file permissions table (right click file -> properties -> resources) to be empty/contain only one checkbox. Change-Id: I645a04df6773372aa27a360d3df9a3521437828f Signed-off-by: Eric Williams <ericwill@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug531928_TableTreeEditorVisibility.java98
1 files changed, 98 insertions, 0 deletions
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug531928_TableTreeEditorVisibility.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug531928_TableTreeEditorVisibility.java
new file mode 100644
index 0000000000..79826b0177
--- /dev/null
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug531928_TableTreeEditorVisibility.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2018 Simeon Andreev and others. All rights reserved.
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ *
+ * Contributors:
+ * Simeon Andreev - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.tests.gtk.snippets;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ControlEditor;
+import org.eclipse.swt.custom.TableEditor;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * Description: {@link ControlEditor} editors are not drawn.
+ * Steps to reproduce:
+ * <ol>
+ * <li>Run the snippet.</li>
+ * <li>Scroll horizontally so that the first column is no longer visible.</li>
+ * </ol>
+ * Expected results: The combo editor in the first row and first column, and
+ * the text editor in the first row and second column,
+ * are visible and can be interacted with.
+ * Actual results: The two editors are not visible but can be interacted with.
+ */
+public class Bug531928_TableTreeEditorVisibility {
+
+ public static void main(String[] args) {
+ Display display = new Display();
+ Shell shell = new Shell(display);
+ shell.setLayout(new FillLayout());
+ shell.setSize(300, 200);
+ shell.setText("Bug 531928");
+
+ table(shell);
+
+ shell.open();
+
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch())
+ display.sleep();
+ }
+ display.dispose();
+ }
+
+ private static void table(Shell shell) {
+ Composite composite = new Composite(shell, SWT.NONE);
+ composite.setLayout(new FillLayout());
+
+ Table table = new Table(composite, SWT.BORDER);
+ TableColumn a = new TableColumn(table, SWT.NONE);
+ a.setText("column 1");
+ a.setWidth(140);
+ TableColumn b = new TableColumn(table, SWT.NONE);
+ b.setText("column 2");
+ b.setWidth(140);
+ TableColumn c = new TableColumn(table, SWT.NONE);
+ c.setText("column 2");
+ c.setWidth(140);
+
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+
+ TableItem item1 = new TableItem(table, SWT.NONE);
+ item1.setText(new String[] { "combo11", "text12", "other13" });
+ TableItem item2 = new TableItem(table, SWT.NONE);
+ item2.setText(new String[] { "other21", "other22", "other23" });
+
+ TableEditor comboEditor1 = new TableEditor(table);
+ Combo combo = new Combo(table, SWT.READ_ONLY);
+ combo.add("item 1");
+ combo.add("item 2");
+ comboEditor1.grabHorizontal = true;
+ comboEditor1.setEditor(combo, item1, 0);
+
+ TableEditor textEditor = new TableEditor(table);
+ Text text = new Text(table, SWT.NONE);
+ text.setText("something");
+ textEditor.grabHorizontal = true;
+ textEditor.setEditor(text, item1, 1);
+ }
+}

Back to the top