Commit 0020390292c545a5ab951c635c07c86ff71eb51a

Authored by Colomban Wendling
1 parent f3d2a3b8

Avoid unnecessary extra focus events when switching between apps

debian/changelog
... ... @@ -10,6 +10,8 @@ compiz (2:0.9.12.2+hypra7.8) UNRELEASED; urgency=medium
10 10 * Fix support for GSettings defaults overrides.
11 11 * Restore support for Metacity < 3.16.
12 12 * Fix missing Firefox's frame in certain cases.
  13 + * 18_switcher-focus: New patch to avoid unnecessary extra focus events
  14 + when switching between applications.
13 15  
14 16 [ Samuel Thibault ]
15 17 * 16_scroll: Add scrolling feature.
... ...
debian/patches/18_switcher-focus 0 → 100644
... ... @@ -0,0 +1,21 @@
  1 +--- a/plugins/switcher/src/switcher.cpp
  2 ++++ b/plugins/switcher/src/switcher.cpp
  3 +@@ -363,7 +363,18 @@ switchTerminate (CompAction *act
  4 + }
  5 +
  6 + if (state && ss->selectedWindow && !ss->selectedWindow->destroyed ())
  7 ++ {
  8 ++ /* Move input focus to the selected window if not already done
  9 ++ * to prevent the previously active window from getting the
  10 ++ * focus back for a short time before the request below gets
  11 ++ * processed. This is useful to prevent some applications from
  12 ++ * spamming the Accessibility layer and leading to confusing
  13 ++ * situations. */
  14 ++ if (!ss->optionGetFocusOnSwitch ())
  15 ++ ss->selectedWindow->moveInputFocusTo ();
  16 ++
  17 + screen->sendWindowActivationRequest (ss->selectedWindow->id ());
  18 ++ }
  19 +
  20 + screen->removeGrab (ss->grabIndex, 0);
  21 + ss->grabIndex = NULL;
... ...
debian/patches/series
... ... @@ -2,3 +2,4 @@
2 2 02_add_bell_plugin
3 3 01_add_vertical_guides_to_showMouse
4 4 16_scroll
  5 +18_switcher-focus
... ...
plugins/switcher/src/switcher.cpp
... ... @@ -363,7 +363,18 @@ switchTerminate (CompAction *action,
363 363 }
364 364  
365 365 if (state && ss->selectedWindow && !ss->selectedWindow->destroyed ())
  366 + {
  367 + /* Move input focus to the selected window if not already done
  368 + * to prevent the previously active window from getting the
  369 + * focus back for a short time before the request below gets
  370 + * processed. This is useful to prevent some applications from
  371 + * spamming the Accessibility layer and leading to confusing
  372 + * situations. */
  373 + if (!ss->optionGetFocusOnSwitch ())
  374 + ss->selectedWindow->moveInputFocusTo ();
  375 +
366 376 screen->sendWindowActivationRequest (ss->selectedWindow->id ());
  377 + }
367 378  
368 379 screen->removeGrab (ss->grabIndex, 0);
369 380 ss->grabIndex = NULL;
... ...