Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 344367 - Not possible to use ctrl+alt+ß in XX.keyboard file
Summary: Not possible to use ctrl+alt+ß in XX.keyboard file
Status: CLOSED DUPLICATE of bug 280562
Alias: None
Product: SWTBot
Classification: Technology
Component: SWTBot (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-30 06:45 EDT by Daniel Migowski CLA
Modified: 2013-07-08 05:42 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Migowski CLA 2011-04-30 06:45:37 EDT
Build Identifier: 2.0.4 0338

When using more than one modifier in the keyboard file, it is parsed, but the keys are not send correctly to the KeyboardStrategy. A single compound key is send for all modifiers, instead of pressing each modifier alone. I replaced the Keystrokes.create(char) function with the following one which fixes the problem:

    static KeyStroke[] create(char ch) {
        KeyStroke keyStroke = defaultKeyboardLayout.keyStrokeFor(ch);
	ArrayList<KeyStroke> keyStrokes = new ArrayList<KeyStroke>(4);
	int modifiers = keyStroke.getModifierKeys();
	if( (modifiers & SWT.CTRL ) != 0 ) {
	    modifiers -= SWT.CTRL;
	    keyStrokes.add(KeyStroke.getInstance(SWT.CTRL, 0));
	}
        if( (modifiers & SWT.ALT ) != 0 ) {
            modifiers -= SWT.ALT;
            keyStrokes.add(KeyStroke.getInstance(SWT.ALT, 0));
        }
        if( (modifiers & SWT.SHIFT ) != 0 ) {
            modifiers -= SWT.SHIFT;
            keyStrokes.add(KeyStroke.getInstance(SWT.SHIFT, 0));
        }
        if( modifiers != 0 ) { // There are still more?
            keyStrokes.add(KeyStroke.getInstance(modifiers, 0));
        }
        keyStrokes.add(KeyStroke.getInstance(0, keyStroke.getNaturalKey()));
        return keyStrokes.toArray(new KeyStroke[keyStrokes.size()]);
    }

Sorry for not providing a patch.

Reproducible: Always

Steps to Reproduce:
1. Add a line "\ ctrl+alt+ß" to a file names DE.keyboard
2. Try to use typeText("\"). 
3. It generates the chars 2\ instead of \
Comment 1 Mickael Istria CLA 2013-05-30 03:34:27 EDT
Bug #345156 is a generalization of this request.
@Daniel: feel free to contribute support for german keyboard: http://wiki.eclipse.org/SWTBot/Keyboard_Layouts#Creating_keyboard_layouts

*** This bug has been marked as a duplicate of bug 345156 ***
Comment 2 Mickael Istria CLA 2013-07-08 05:42:22 EDT
Actually, this bug is more a dup of bug 280562 which is about support Alt+Gr and multiple key modifiers

*** This bug has been marked as a duplicate of bug 280562 ***