0001-js-ui-Use-captured-event-nonmotion.patch 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. From 81c17e5993001cf30d706642d67e09812136adf2 Mon Sep 17 00:00:00 2001
  2. From: Daniel van Vugt <daniel.van.vugt@canonical.com>
  3. Date: Fri, 2 Nov 2018 17:58:37 +0800
  4. Subject: [PATCH] js/ui: Use captured-event::nonmotion
  5. Cherry picked from commit 297a18f29a423da26fd86417e6c1fe82349d8f98.
  6. This new detail filters out mouse motion events so we don't waste CPU
  7. translating them all into JavaScript handlers that don't care about them.
  8. This helps with https://gitlab.gnome.org/GNOME/mutter/issues/283
  9. ---
  10. js/ui/padOsd.js | 2 +-
  11. js/ui/panel.js | 2 +-
  12. js/ui/status/system.js | 2 +-
  13. js/ui/viewSelector.js | 2 +-
  14. js/ui/windowManager.js | 2 +-
  15. 5 files changed, 5 insertions(+), 5 deletions(-)
  16. diff --git a/js/ui/padOsd.js b/js/ui/padOsd.js
  17. index a4af47297..6bff40849 100644
  18. --- a/js/ui/padOsd.js
  19. +++ b/js/ui/padOsd.js
  20. @@ -615,7 +615,7 @@ var PadOsd = class {
  21. this._settings = settings;
  22. this._imagePath = imagePath;
  23. this._editionMode = editionMode;
  24. - this._capturedEventId = global.stage.connect('captured-event', this._onCapturedEvent.bind(this));
  25. + this._capturedEventId = global.stage.connect('captured-event::nonmotion', this._onCapturedEvent.bind(this));
  26. this._padChooser = null;
  27. let deviceManager = Clutter.DeviceManager.get_default();
  28. diff --git a/js/ui/panel.js b/js/ui/panel.js
  29. index 16484850a..57f0778b1 100644
  30. --- a/js/ui/panel.js
  31. +++ b/js/ui/panel.js
  32. @@ -473,7 +473,7 @@ class ActivitiesButton extends PanelMenu.Button {
  33. this.actor.label_actor = this._label;
  34. - this.actor.connect('captured-event', this._onCapturedEvent.bind(this));
  35. + this.actor.connect('captured-event::nonmotion', this._onCapturedEvent.bind(this));
  36. this.actor.connect_after('key-release-event', this._onKeyRelease.bind(this));
  37. Main.overview.connect('showing', () => {
  38. diff --git a/js/ui/status/system.js b/js/ui/status/system.js
  39. index 1b0d10d8c..b25a6bf32 100644
  40. --- a/js/ui/status/system.js
  41. +++ b/js/ui/status/system.js
  42. @@ -23,7 +23,7 @@ var AltSwitcher = class {
  43. this._alternate.connect('clicked',
  44. () => { this._clickAction.release(); });
  45. - this._capturedEventId = global.stage.connect('captured-event', this._onCapturedEvent.bind(this));
  46. + this._capturedEventId = global.stage.connect('captured-event::nonmotion', this._onCapturedEvent.bind(this));
  47. this._flipped = false;
  48. diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
  49. index 77146552d..092ff8f1c 100644
  50. --- a/js/ui/viewSelector.js
  51. +++ b/js/ui/viewSelector.js
  52. @@ -44,7 +44,7 @@ function getTermsForSearchString(searchString) {
  53. var TouchpadShowOverviewAction = class {
  54. constructor(actor) {
  55. - actor.connect('captured-event', this._handleEvent.bind(this));
  56. + actor.connect('captured-event::nonmotion', this._handleEvent.bind(this));
  57. }
  58. _handleEvent(actor, event) {
  59. diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
  60. index b9f5fef46..97d980940 100644
  61. --- a/js/ui/windowManager.js
  62. +++ b/js/ui/windowManager.js
  63. @@ -461,7 +461,7 @@ var TouchpadWorkspaceSwitchAction = class {
  64. this._dx = 0;
  65. this._dy = 0;
  66. this._enabled = true;
  67. - actor.connect('captured-event', this._handleEvent.bind(this));
  68. + actor.connect('captured-event::nonmotion', this._handleEvent.bind(this));
  69. this._touchpadSettings = new Gio.Settings({schema_id: 'org.gnome.desktop.peripherals.touchpad'});
  70. }
  71. --
  72. 2.22.0