Properly handle mouse in read-only mode
Summary:
- Do not send mouse events and emulated up/down keys to programs when read-only mode is enabled.
- Set the currentTerminalDisplay before sending key events, like in keyPressEvent.
- wheelEvent code is restructured a bit to easily separate code not allowed in read-only mode.
Test Plan:
- Start Konsole
- Run man man, do not press any key after enter
- Turn on read only mode
- Try to scroll using mouse wheel.
- Expected result: scrolling does not work in read-only mode
- Actual result: scrolling works in read only mode (but only when no key has been pressed before on 2nd terminal screen)
- Start konsole
- Run a program which uses mouse events, e.g. vim (enable mouse with :set mouse=a)
- Make the program state suitable for using mouse events, e.g. enter a few lines of text
- Confirm that mouse events (clicks, selection, wheel) work in the program
- Turn on read-only mode
- Try:
- Click (left/right/middle button), double click
- Mouse wheel
- Click and move (selecting)
- Expected result: mouse events are not passed to the program in read-only mode; nothing happens
- Actual result: mouse events are passed to the program
Reviewers: Konsole, hindenburg
Reviewed By: Konsole, hindenburg
Subscribers: hindenburg, Konsole
Tags: Konsole
Differential Revision: https://phabricator.kde.org/D11763