mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-68331 Mouse 4/Mouse 5 button not detected
This commit is contained in:
@@ -55,6 +55,8 @@ public class KeymapUtil {
|
||||
@NonNls private static final String BUTTON1 = "button1";
|
||||
@NonNls private static final String BUTTON2 = "button2";
|
||||
@NonNls private static final String BUTTON3 = "button3";
|
||||
@NonNls private static final String BUTTON4 = "button4";
|
||||
@NonNls private static final String BUTTON5 = "button5";
|
||||
@NonNls private static final String DOUBLE_CLICK = "doubleClick";
|
||||
|
||||
private static final Set<Integer> ourTooltipKeys = new HashSet<Integer>();
|
||||
@@ -114,34 +116,9 @@ public class KeymapUtil {
|
||||
* @return string representation of passed mouse shortcut.
|
||||
*/
|
||||
public static String getMouseShortcutText(int button, @JdkConstants.InputEventMask int modifiers, int clickCount) {
|
||||
// Modal keys
|
||||
|
||||
final int buttonNum;
|
||||
|
||||
if (MouseEvent.BUTTON1 == button) {
|
||||
buttonNum = 1;
|
||||
}
|
||||
else if (MouseEvent.BUTTON2 == button) {
|
||||
buttonNum = 2;
|
||||
}
|
||||
else if (MouseEvent.BUTTON3 == button) {
|
||||
buttonNum = 3;
|
||||
}
|
||||
else if (MouseEvent.NOBUTTON == button || -1 == button) {
|
||||
buttonNum = 0;
|
||||
// do nothing
|
||||
}
|
||||
else {
|
||||
buttonNum = button;
|
||||
}
|
||||
|
||||
if (clickCount == 1) {
|
||||
return KeyMapBundle.message("mouse.click.shortcut.text", getModifiersText(mapNewModifiers(modifiers)), buttonNum);
|
||||
}
|
||||
else if (clickCount == 2) {
|
||||
return KeyMapBundle.message("mouse.double.click.shortcut.text", getModifiersText(mapNewModifiers(modifiers)), buttonNum);
|
||||
}
|
||||
else {
|
||||
if (clickCount < 3) {
|
||||
return KeyMapBundle.message("mouse." + (clickCount == 1? "" : "double.") + "click.shortcut.text", getModifiersText(mapNewModifiers(modifiers)), button);
|
||||
} else {
|
||||
throw new IllegalStateException("unknown clickCount: " + clickCount);
|
||||
}
|
||||
}
|
||||
@@ -271,6 +248,12 @@ public class KeymapUtil {
|
||||
else if (BUTTON3.equals(token)) {
|
||||
button = MouseEvent.BUTTON3;
|
||||
}
|
||||
else if (BUTTON4.equals(token)) {
|
||||
button = MouseEvent.BUTTON3 + 1;
|
||||
}
|
||||
else if (BUTTON5.equals(token)) {
|
||||
button = MouseEvent.BUTTON3 + 2;
|
||||
}
|
||||
else if (DOUBLE_CLICK.equals(token)) {
|
||||
clickCount = 2;
|
||||
}
|
||||
|
||||
+6
@@ -143,6 +143,10 @@ public final class IdeMouseEventDispatcher {
|
||||
ignore = true;
|
||||
}
|
||||
|
||||
if (e.getID() == MouseEvent.MOUSE_PRESSED && e.getButton() > 3) {
|
||||
return true;
|
||||
}
|
||||
|
||||
final JRootPane root = findRoot(e);
|
||||
if (root != null) {
|
||||
final Integer lastId = myRootPane2BlockedId.get(root);
|
||||
@@ -206,6 +210,8 @@ public final class IdeMouseEventDispatcher {
|
||||
e.consume();
|
||||
}
|
||||
}
|
||||
if (actions.length > 0 && e.isConsumed())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -70,9 +70,6 @@ public class KeymapImpl implements Keymap, ExternalizableScheme {
|
||||
@NonNls private static final String META = "meta";
|
||||
@NonNls private static final String ALT = "alt";
|
||||
@NonNls private static final String ALT_GRAPH = "altGraph";
|
||||
@NonNls private static final String BUTTON1 = "button1";
|
||||
@NonNls private static final String BUTTON2 = "button2";
|
||||
@NonNls private static final String BUTTON3 = "button3";
|
||||
@NonNls private static final String DOUBLE_CLICK = "doubleClick";
|
||||
@NonNls private static final String VIRTUAL_KEY_PREFIX = "VK_";
|
||||
@NonNls private static final String EDITOR_ACTION_PREFIX = "Editor";
|
||||
@@ -792,22 +789,7 @@ public class KeymapImpl implements Keymap, ExternalizableScheme {
|
||||
|
||||
// button
|
||||
|
||||
int button = shortcut.getButton();
|
||||
if (MouseEvent.BUTTON1 == button) {
|
||||
buffer.append(BUTTON1);
|
||||
buffer.append(' ');
|
||||
}
|
||||
else if (MouseEvent.BUTTON2 == button) {
|
||||
buffer.append(BUTTON2);
|
||||
buffer.append(' ');
|
||||
}
|
||||
else if (MouseEvent.BUTTON3 == button) {
|
||||
buffer.append(BUTTON3);
|
||||
buffer.append(' ');
|
||||
}
|
||||
else {
|
||||
buffer.append("button").append(button);
|
||||
}
|
||||
buffer.append("button").append(shortcut.getButton()).append(' ');
|
||||
|
||||
if (shortcut.getClickCount() > 1) {
|
||||
buffer.append(DOUBLE_CLICK);
|
||||
|
||||
@@ -87,9 +87,9 @@ quick.list.panel.description.label=Description:
|
||||
quick.list.panel.display.name.label=Display name:
|
||||
no.actions=No actions
|
||||
|
||||
#0 - modifiers (with + for windows or empty str), 1 - button num (1 - left, 2 - center, 3 - right 0 - no button)
|
||||
mouse.click.shortcut.text={0}Button{1} Click
|
||||
mouse.double.click.shortcut.text={0}Button{1} Double-Click
|
||||
#0 - modifiers (with + for windows or empty str), 1 - button num (1 - left, 2 - center, 3 - right, 4 - back, 5 - forward, 0 - no button)
|
||||
mouse.click.shortcut.text={0}{1,choice,1#Button1|2#Button2|3#Button3|4#Back|5#Forward} Click
|
||||
mouse.double.click.shortcut.text={0}{1,choice,1#Button1|2#Button2|3#Button3|4#Back|5#Forward} Double-Click
|
||||
configuration.all.keymaps.should.have.non.empty.names.error.message=All keymaps should have non empty names
|
||||
configuration.all.keymaps.should.have.unique.names.error.message=All keymaps should have unique names
|
||||
|
||||
|
||||
Reference in New Issue
Block a user