Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorXi Yan2019-01-31 17:20:47 +0000
committerXi Yan2019-01-31 19:18:58 +0000
commit2f5a98b4cbd50b436a5ffad0a1d5949f3b9a1b18 (patch)
tree18ab49421674cd1ca742c1650a38fff68c47ecf0 /tests
parentd70957069be27c7a0616832a3d0c5f9364e95bb0 (diff)
downloadeclipse.platform.swt-2f5a98b4cbd50b436a5ffad0a1d5949f3b9a1b18.tar.gz
eclipse.platform.swt-2f5a98b4cbd50b436a5ffad0a1d5949f3b9a1b18.tar.xz
eclipse.platform.swt-2f5a98b4cbd50b436a5ffad0a1d5949f3b9a1b18.zip
Bug 543984 - [GTK4] Adapt to GdkEventType constants changes
Add new GdkEventType constant values, adapt GDK.EXPOSE, GDK.BUTTON_PRESS, GDK.BUTTON_RELEASE on GTK4. Guard connecting to event signal in Shell to avoid duplicate mouse press/release events. Tested on GTK3 with ControlExample MouseListener. Tested with attached snippet on GTK4. Change-Id: Ida2f3a4d77efcb98d99a1aa4bcbb418c8cbfc718
Diffstat (limited to 'tests')
-rw-r--r--tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug543984_GTK4EventTypeConstants.java66
1 files changed, 66 insertions, 0 deletions
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug543984_GTK4EventTypeConstants.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug543984_GTK4EventTypeConstants.java
new file mode 100644
index 0000000000..75724e3e21
--- /dev/null
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug543984_GTK4EventTypeConstants.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2018 Red Hat 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:
+ * Red Hat - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.tests.gtk.snippets;
+
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+/*
+ * Title:
+ * How to run:
+ * Bug description:
+ * Expected results:
+ * GTK Version(s):
+ */
+public class Bug543984_GTK4EventTypeConstants {
+
+ public static void main(String[] args) {
+ Display display = new Display();
+ Shell shell = new Shell(display);
+ shell.setLayout(new FillLayout());
+ shell.setSize(500, 200);
+
+ shell.open();
+
+ shell.addMouseListener(new MouseListener() {
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ System.out.println("MouseUp");
+
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+ System.out.println("MouseDown");
+
+ }
+
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ // TODO: GDK_2BUTTON_PRESS removed in GTK4, no signal for double click
+ System.out.println("MouseDoubleClick");
+
+ }
+ });
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch())
+ display.sleep();
+ }
+ }
+}

Back to the top