1. 19 Aug, 2017 1 commit
    • Martin Flöser's avatar
      Send QKeyEvent with Qt::Key as expected by Qt to internal windows · 70bc9524
      Martin Flöser authored
      Summary:
      KWin passes the current keysym converted to a Qt::Key in the QKeyEvent.
      The current keysym does not always change when a key gets released, so
      when pressing a shortcut the release carry a Qt::Key which could be
      considered as wrong.
      
      QtWayland transforms the actual pressed/released key into a keysym and
      passes that through the QKeyEvent. This change does the same for the
      internal windows. A new QKeyEvent is created and adjusted in a way that
      it matches what Qt expects.
      
      Why not change everything to how Qt expects it? The key is used at
      various places and in KWin internally we expect the behavior how it is
      currently implemented. So it's better to use Qt's expectation only when
      interacting with Qt.
      
      Also the change carries a workaround for a bug in QKeySequenceEdit
      (see QTBUG-62102) and transforms Super to Meta. As this adjustment only
      makes sense for the internal windows we need to send in an adjusted
      QKeyEvent anyway, so another argument for using the Qt behavior only in
      this place.
      
      Test Plan:
      Can set a shortcut on Wayland and it can be used to activate
      the window.
      
      Reviewers: #kwin, #plasma
      
      Subscribers: plasma-devel
      
      Tags: #plasma
      
      Differential Revision: https://phabricator.kde.org/D6828
      70bc9524
  2. 12 Aug, 2017 1 commit
    • Martin Flöser's avatar
      Implement the shortcut caption suffix for Wayland windows · bbca8c66
      Martin Flöser authored
      Summary:
      The generation of the shortcut caption part is moved from Client to
      AbstractClient. The ShellClient also has a captionSuffix and implements
      the full part in caption.
      
      Overall this needs more refactoring to support more sharing between the
      two implementations. But one step at a time.
      
      Reviewers: #kwin, #plasma
      
      Subscribers: plasma-devel
      
      Tags: #plasma
      
      Differential Revision: https://phabricator.kde.org/D7093
      bbca8c66
  3. 25 Jul, 2017 1 commit
    • Martin Flöser's avatar
      Implement support for window shortcuts for Wayland windows · c29d6093
      Martin Flöser authored
      Summary:
      Moves most of the implementation from Client to AbstractClient, so that
      it can be used for both Client and ShellClient. Only the X11 specific
      code is kept in Client.
      
      Not yet implemented is updating the window caption.
      
      Unfortunately the testing of this feature showed that setting a window
      shortcut is not working on Wayland at all (the Qt widget doesn't properly
      catch the shortcut). So this feature is currently only of erm theoretical
      use.
      
      Test Plan: Added new test case. No testing in real world as explained.
      
      Reviewers: #kwin, #plasma
      
      Subscribers: plasma-devel, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D6818
      c29d6093
  4. 20 Jul, 2017 1 commit
  5. 15 Dec, 2016 1 commit
  6. 17 Oct, 2016 1 commit
    • Martin Flöser's avatar
      Fix shortcut triggering with shift+letter · 78a2732a
      Martin Flöser authored
      Summary:
      A shortcut with e.g. shift+w could not be triggered as shift is
      considered as consumed. It transforms the keysym to an uppercase variant
      thus it is consumed.
      
      This change checks for the condition that shift is pressed and is the
      only consumed modifier. If the current keysym is a letter the shift is
      removed from the consumed modifier again to still support the shortcut.
      
      BUG: 370341
      FIXED-IN: 5.8.2
      
      Reviewers: #kwin, #plasma_on_wayland
      
      Subscribers: plasma-devel, kwin
      
      Tags: #plasma_on_wayland, #kwin
      
      Differential Revision: https://phabricator.kde.org/D3015
      78a2732a
  7. 11 Oct, 2016 1 commit
  8. 06 Oct, 2016 2 commits
    • Martin Flöser's avatar
      Workaround xkbcommon behavior concerning consumed modifiers · 421824b6
      Martin Flöser authored
      Summary:
      If a key could be turned into a keysym with a modifier xkbcommon
      considers the modifier as consumed even if not pressed.
      E.g. Alt+F3 considers alt as consumed as there is a keysym gnerated with
      Ctrl+Alt+F3 (vt switching).
      
      This change tries to workaround the problem by ignoring the consumed
      modifiers if there are more modifiers consumed than active. It's
      possible that this will create regressions for other shortcuts - we need
      to test it in the wild. Although this might cause regressions I'm aiming
      for Plasma/5.8 branch with the change. It only affects Wayland and fixes
      quite important shortcuts from window manager perspective (desktop
      switching (ctrl+f1 to ctrl+f4), desktop grid (ctrl+f8), present windows
      (ctrl+f9, ctrl+10), cube (ctrl+f11), user actions (alt+f3), close window
      (alt+f4)). If it causes regressions they need to be fixed as well in the
      Plasma/5.8 branch.
      
      A new API entry point for xkbcommon was proposed, but is not yet merged
      and there is no release with it yet. Once that is available the
      workaround should get removed and replaced by the new API call.
      
      BUG: 368989
      FIXED-IN: 5.8.1
      
      Test Plan: Going to restart session now with the change
      
      Reviewers: #kwin, #plasma_on_wayland
      
      Subscribers: plasma-devel, kwin
      
      Tags: #plasma_on_wayland, #kwin
      
      Differential Revision: https://phabricator.kde.org/D2945
      421824b6
    • Martin Flöser's avatar
      Only repeat one key · 3bc60893
      Martin Flöser authored
      Summary:
      So far KWin tried to repeat all pressed keys which should repeat. But
      this is not how X11 and e.g. QtWayland handle it. There only one key -
      the last one which got pressed - repeats. And this makes sense as the
      key is used to generate a keysym and that one KWin caches. Thus the
      logic so far resulted in incorrect keysyms to be generated during the
      repeat. E.g. pressing a, pressing b, releasing b would repeat b instead
      of the hold a as b was the last generated keysym.
      
      This change addresses this problem and let's only one key repeat at a
      time. When the currently repeating key gets released the repeat timer is
      stopped and other hold keys won't repeat any more. This also matches the
      behavior of X11 and QtWayland.
      
      BUG: 369091
      FIXED-IN: 5.8.1
      
      Reviewers: #kwin, #plasma_on_wayland
      
      Subscribers: plasma-devel, kwin
      
      Tags: #plasma_on_wayland, #kwin
      
      Differential Revision: https://phabricator.kde.org/D2941
      3bc60893
  9. 05 Oct, 2016 1 commit
  10. 04 Oct, 2016 1 commit
    • Martin Flöser's avatar
      [autotests/integration] Add test case for repeating shortcuts · 48db6716
      Martin Flöser authored
      This adds a new test case for global shortcuts which simulates
      triggering a shortcut through key repeat. The test verifies a problem
      that the the shortcut continues to be triggered after releasing the key
      if another key is still pressed (and triggers repeats).
      
      CCBUG: 369091
      48db6716
  11. 15 Sep, 2016 2 commits
    • Sebastian Kügler's avatar
      parent qaction in test · 99f491e7
      Sebastian Kügler authored
      Summary:
      My compiler doesn't seem to like this constructor, it bails out with the
      following error:
      
      /home/sebas/kf5/src/kde/workspace/kwin/autotests/integration/globalshortcuts_test.cpp:
      In member function ‘void GlobalShortcutsTest::testConsumedShift()’:
      /home/sebas/kf5/src/kde/workspace/kwin/autotests/integration/globalshortcuts_test.cpp:79:40:
      error: no matching function for call to ‘QAction::QAction()’
           QScopedPointer<QAction> action(new QAction);
                                              ^~~~~~~
      
      Using this as first argument fixes the build on my machine.
      
      Test Plan: screenedges test fails, others pass. (this screenedges test failure seems unrelated)
      
      Reviewers: graesslin
      
      Reviewed By: graesslin
      
      Subscribers: luebking, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D2782
      99f491e7
    • Sebastian Kügler's avatar
      parent qaction in test · 1d37b92d
      Sebastian Kügler authored
      Summary:
      My compiler doesn't seem to like this constructor, it bails out with the
      following error:
      
      /home/sebas/kf5/src/kde/workspace/kwin/autotests/integration/globalshortcuts_test.cpp:
      In member function ‘void GlobalShortcutsTest::testConsumedShift()’:
      /home/sebas/kf5/src/kde/workspace/kwin/autotests/integration/globalshortcuts_test.cpp:79:40:
      error: no matching function for call to ‘QAction::QAction()’
           QScopedPointer<QAction> action(new QAction);
                                              ^~~~~~~
      
      Using this as first argument fixes the build on my machine.
      
      Test Plan: screenedges test fails, others pass. (this screenedges test failure seems unrelated)
      
      Reviewers: graesslin
      
      Reviewed By: graesslin
      
      Subscribers: luebking, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D2782
      1d37b92d
  12. 14 Sep, 2016 2 commits
    • Martin Flöser's avatar
      Remove not-wanted modifiers prior to evaluating global shortcuts · 42358716
      Martin Flöser authored
      Summary:
      When triggering global shortcuts we are more interested in the hold
      keys than the currently active modifiers. E.g. capslock should not
      be seen as "shift is hold". Similar we need to remove consumed
      modifiers. Shift+5 is % and not Shift+% - the shift modifier is
      consumed and needs to be removed from shortcut evaluation.
      
      To support this we need to have the actual state directly from
      xkbcommon. Thus a new method is added which exposes the modifiers
      relevant for global shortcut matching. In addition on every key press
      all consumed modifiers are calculated and kept so that they can be
      used for shortcut matching.
      
      In addition a workaround is added for Backtab. Similar workaround
      exists in kglobalaccel for X11. The problem is that our shortcuts are
      stored incorrectly: Shift+Tab instead of Backtab. Thus a mapping back
      is required. To make everything worse KWin registers the wrong key
      sequence "Alt+Shift+Backtab" which doesn't make any sense and is
      broken on X11 at least.
      
      The workaround supports both special cases. The one for Backtab should
      be turned into Shift+Tab and also KWin's special case of adding shift
      to backtab.
      
      CCBUG: 368581
      
      Reviewers: #kwin, #plasma_on_wayland, bshah
      
      Subscribers: plasma-devel, kwin
      
      Tags: #plasma_on_wayland, #kwin
      
      Differential Revision: https://phabricator.kde.org/D2768
      42358716
    • Martin Flöser's avatar
      [autotests/integration] Add a global shortcuts test · cdcee88b
      Martin Flöser authored
      New test case to verify that global shortcut triggering works correctly.
      First test case is to verify that consumed modifiers do not break the
      shortcut. E.g. a shortcut registered for % should trigger on Shift+5 on
      us layout. For that the modifier needs to be consumed, otherwise it's
      Shift+% and doesn't trigger. As the test shows this is currently the
      case.
      cdcee88b