1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-21 21:52:10 +02:00

Bug 558536: Revert "Bug 549013 - Eclipse menu won't display on Ubuntu 16.04 LTS when SSH/Serial command shells are opened"

Using the mouse and not the focus listeners leads to lots
of weird, unintended consequences. For example:

- If mouse does not exit the control (because, e.g. it was not
in the control) then captureKeyEvents(false) is never issued
- If mouse does leave control, then control stops capturing
events. This means that although the cursor and focus is still
on the control, keyboard shortcuts no longer go to the control,
so Ctrl-C becomes copy again. This means, depending on where you
move the mouse changes the behaviour of the control.

This reverts commit 19351cbc2b.

Change-Id: I4f57c659e21d823df049b095159a34e5c110ef29
This commit is contained in:
Jonah Graham 2020-05-16 15:55:19 -04:00
parent da0d1d7df6
commit 56d741a50c

View file

@ -73,12 +73,13 @@ import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseTrackListener;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@ -140,7 +141,7 @@ public class VT100TerminalControl implements ITerminalControlForText, ITerminalC
private KeyListener fKeyHandler;
private final ITerminalListener fTerminalListener;
private String fMsg = ""; //$NON-NLS-1$
private TerminalMouseTrackListener fFocusListener;
private TerminalFocusListener fFocusListener;
private ITerminalConnector fConnector;
private final ITerminalConnector[] fConnectors;
private final boolean fUseCommonPrefs;
@ -741,10 +742,10 @@ public class VT100TerminalControl implements ITerminalControlForText, ITerminalC
protected void setupListeners() {
fKeyHandler = new TerminalKeyHandler();
fFocusListener = new TerminalMouseTrackListener();
fFocusListener = new TerminalFocusListener();
getCtlText().addKeyListener(fKeyHandler);
getCtlText().addMouseTrackListener(fFocusListener);
getCtlText().addFocusListener(fFocusListener);
}
@ -817,20 +818,16 @@ public class VT100TerminalControl implements ITerminalControlForText, ITerminalC
return fTerminalText;
}
protected class TerminalMouseTrackListener implements MouseTrackListener {
protected class TerminalFocusListener implements FocusListener {
private IContextActivation terminalContextActivation = null;
private IContextActivation editContextActivation = null;
protected TerminalMouseTrackListener() {
protected TerminalFocusListener() {
super();
}
@Override
public void mouseHover(MouseEvent e) {
}
@Override
public void mouseEnter(MouseEvent e) {
public void focusGained(FocusEvent event) {
// Disable all keyboard accelerators (e.g., Control-B) so the Terminal view
// can see every keystroke. Without this, Emacs, vi, and Bash are unusable
// in the Terminal view.
@ -842,7 +839,7 @@ public class VT100TerminalControl implements ITerminalControlForText, ITerminalC
}
@Override
public void mouseExit(MouseEvent e) {
public void focusLost(FocusEvent event) {
// Enable all keybindings.
captureKeyEvents(false);