Skip to content
  • Mariusz Glebocki's avatar
    Properly handle mouse in read-only mode · 52f1c015
    Mariusz Glebocki authored and Kurt Hindenburg's avatar Kurt Hindenburg committed
    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
    
    (cherry picked from commit 0ca1391c)
    52f1c015