1 /*******************************************************************************
2  * Copyright (c) 2018 Red Hat and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *     Red Hat - initial API and implementation
13  *******************************************************************************/
14 package org.eclipse.swt.tests.gtk.snippets;
15 
16 import org.eclipse.swt.SWT;
17 import org.eclipse.swt.custom.*;
18 import org.eclipse.swt.layout.*;
19 import org.eclipse.swt.widgets.*;
20 
21 public class Bug516480_KeydownRussianlayout {
22 	/**
23 	 * @author Thomas Singer
24 	 */
main(String[] args)25 	public static void main(String[] args) {
26 		final Display display = new Display();
27 
28 		final Shell shell = new Shell(display);
29 		shell.setLayout(new FillLayout());
30 
31 		final StyledText text = new StyledText(shell, SWT.BORDER);
32 		text.setText("hello world");
33 
34 		text.addListener(SWT.KeyDown, new Listener() {
35 			@Override
36 			public void handleEvent(Event event) {
37 				System.out.println("event.character = " + (int)event.character);
38 				System.out.println("event.keyCode = " + event.keyCode);
39 			}
40 		});
41 
42 		shell.setSize(300, 200);
43 		shell.open();
44 
45 		while (!shell.isDisposed()) {
46 			if (!display.readAndDispatch()) {
47 				display.sleep();
48 			}
49 		}
50 
51 		display.dispose();
52 	}
53 }
54