0001-Remove-hot-corner-application-due-to-crash-issue.patch 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  1. From 23ce8b5393f5aacb976f8fe131229d9a87c6e80c Mon Sep 17 00:00:00 2001
  2. From: Yugang <fanyugang.fyg@linux.alibaba.com>
  3. Date: Wed, 17 Nov 2021 11:30:39 +0800
  4. Subject: [PATCH] Remove hot corner application due to crash issue.
  5. ---
  6. js/ui/layout.js | 238 +-----------------------------------------------
  7. js/ui/panel.js | 90 ------------------
  8. 2 files changed, 1 insertion(+), 327 deletions(-)
  9. diff --git a/js/ui/layout.js b/js/ui/layout.js
  10. index 1441bfe..9f8a639 100644
  11. --- a/js/ui/layout.js
  12. +++ b/js/ui/layout.js
  13. @@ -17,9 +17,6 @@ var STARTUP_ANIMATION_TIME = 500;
  14. var KEYBOARD_ANIMATION_TIME = 150;
  15. var BACKGROUND_FADE_ANIMATION_TIME = 1000;
  16. -var HOT_CORNER_PRESSURE_THRESHOLD = 100; // pixels
  17. -var HOT_CORNER_PRESSURE_TIMEOUT = 1000; // ms
  18. -
  19. function isPopupMetaWindow(actor) {
  20. switch (actor.meta_window.get_window_type()) {
  21. case Meta.WindowType.DROPDOWN_MENU:
  22. @@ -185,8 +182,7 @@ const defaultParams = {
  23. };
  24. var LayoutManager = GObject.registerClass({
  25. - Signals: { 'hot-corners-changed': {},
  26. - 'startup-complete': {},
  27. + Signals: { 'startup-complete': {},
  28. 'startup-prepared': {},
  29. 'monitors-changed': {},
  30. 'system-modal-opened': {},
  31. @@ -199,7 +195,6 @@ var LayoutManager = GObject.registerClass({
  32. this.monitors = [];
  33. this.primaryMonitor = null;
  34. this.primaryIndex = -1;
  35. - this.hotCorners = [];
  36. this._keyboardIndex = -1;
  37. this._rightPanelBarrier = null;
  38. @@ -282,9 +277,6 @@ var LayoutManager = GObject.registerClass({
  39. schema_id: 'org.gnome.desktop.interface'
  40. });
  41. - this._interfaceSettings.connect('changed::enable-hot-corners',
  42. - this._updateHotCorners.bind(this));
  43. -
  44. // Need to update struts on new workspaces when they are added
  45. let workspaceManager = global.workspace_manager;
  46. workspaceManager.connect('notify::n-workspaces',
  47. @@ -380,70 +372,6 @@ var LayoutManager = GObject.registerClass({
  48. }
  49. }
  50. - _updateHotCorners() {
  51. - // destroy old hot corners
  52. - this.hotCorners.forEach(corner => {
  53. - if (corner)
  54. - corner.destroy();
  55. - });
  56. - this.hotCorners = [];
  57. -
  58. - if (!this._interfaceSettings.get_boolean('enable-hot-corners')) {
  59. - this.emit('hot-corners-changed');
  60. - return;
  61. - }
  62. -
  63. - let size = this.panelBox.height;
  64. -
  65. - // build new hot corners
  66. - for (let i = 0; i < this.monitors.length; i++) {
  67. - let monitor = this.monitors[i];
  68. - let cornerX = this._rtl ? monitor.x + monitor.width : monitor.x;
  69. - let cornerY = monitor.y;
  70. -
  71. - let haveTopLeftCorner = true;
  72. -
  73. - if (i != this.primaryIndex) {
  74. - // Check if we have a top left (right for RTL) corner.
  75. - // I.e. if there is no monitor directly above or to the left(right)
  76. - let besideX = this._rtl ? monitor.x + 1 : cornerX - 1;
  77. - let besideY = cornerY;
  78. - let aboveX = cornerX;
  79. - let aboveY = cornerY - 1;
  80. -
  81. - for (let j = 0; j < this.monitors.length; j++) {
  82. - if (i == j)
  83. - continue;
  84. - let otherMonitor = this.monitors[j];
  85. - if (besideX >= otherMonitor.x &&
  86. - besideX < otherMonitor.x + otherMonitor.width &&
  87. - besideY >= otherMonitor.y &&
  88. - besideY < otherMonitor.y + otherMonitor.height) {
  89. - haveTopLeftCorner = false;
  90. - break;
  91. - }
  92. - if (aboveX >= otherMonitor.x &&
  93. - aboveX < otherMonitor.x + otherMonitor.width &&
  94. - aboveY >= otherMonitor.y &&
  95. - aboveY < otherMonitor.y + otherMonitor.height) {
  96. - haveTopLeftCorner = false;
  97. - break;
  98. - }
  99. - }
  100. - }
  101. -
  102. - if (haveTopLeftCorner) {
  103. - let corner = new HotCorner(this, monitor, cornerX, cornerY);
  104. - corner.setBarrierSize(size);
  105. - this.hotCorners.push(corner);
  106. - } else {
  107. - this.hotCorners.push(null);
  108. - }
  109. - }
  110. -
  111. - this.emit('hot-corners-changed');
  112. - }
  113. -
  114. _addBackgroundMenu(bgManager) {
  115. BackgroundMenu.addBackgroundMenu(bgManager.backgroundActor, this);
  116. }
  117. @@ -516,10 +444,6 @@ var LayoutManager = GObject.registerClass({
  118. this._updatePanelBarrier();
  119. let size = this.panelBox.height;
  120. - this.hotCorners.forEach(corner => {
  121. - if (corner)
  122. - corner.setBarrierSize(size);
  123. - });
  124. }
  125. _updatePanelBarrier() {
  126. @@ -544,7 +468,6 @@ var LayoutManager = GObject.registerClass({
  127. _monitorsChanged() {
  128. this._updateMonitors();
  129. this._updateBoxes();
  130. - this._updateHotCorners();
  131. this._updateBackgrounds();
  132. this._updateFullscreen();
  133. this._updateVisibility();
  134. @@ -1108,165 +1031,6 @@ var LayoutManager = GObject.registerClass({
  135. }
  136. });
  137. -
  138. -// HotCorner:
  139. -//
  140. -// This class manages a "hot corner" that can toggle switching to
  141. -// overview.
  142. -var HotCorner = class HotCorner {
  143. - constructor(layoutManager, monitor, x, y) {
  144. - // We use this flag to mark the case where the user has entered the
  145. - // hot corner and has not left both the hot corner and a surrounding
  146. - // guard area (the "environs"). This avoids triggering the hot corner
  147. - // multiple times due to an accidental jitter.
  148. - this._entered = false;
  149. -
  150. - this._monitor = monitor;
  151. -
  152. - this._x = x;
  153. - this._y = y;
  154. -
  155. - this._setupFallbackCornerIfNeeded(layoutManager);
  156. -
  157. - this._pressureBarrier = new PressureBarrier(HOT_CORNER_PRESSURE_THRESHOLD,
  158. - HOT_CORNER_PRESSURE_TIMEOUT,
  159. - Shell.ActionMode.NORMAL |
  160. - Shell.ActionMode.OVERVIEW);
  161. - this._pressureBarrier.connect('trigger', this._toggleOverview.bind(this));
  162. -
  163. - let px = 0.0;
  164. - let py = 0.0;
  165. - if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL) {
  166. - px = 1.0;
  167. - py = 0.0;
  168. - }
  169. -
  170. - this._ripples = new Ripples.Ripples(px, py, 'ripple-box');
  171. - this._ripples.addTo(layoutManager.uiGroup);
  172. - }
  173. -
  174. - setBarrierSize(size) {
  175. - if (this._verticalBarrier) {
  176. - this._pressureBarrier.removeBarrier(this._verticalBarrier);
  177. - this._verticalBarrier.destroy();
  178. - this._verticalBarrier = null;
  179. - }
  180. -
  181. - if (this._horizontalBarrier) {
  182. - this._pressureBarrier.removeBarrier(this._horizontalBarrier);
  183. - this._horizontalBarrier.destroy();
  184. - this._horizontalBarrier = null;
  185. - }
  186. -
  187. - if (size > 0) {
  188. - if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL) {
  189. - this._verticalBarrier = new Meta.Barrier({ display: global.display,
  190. - x1: this._x, x2: this._x, y1: this._y, y2: this._y + size,
  191. - directions: Meta.BarrierDirection.NEGATIVE_X });
  192. - this._horizontalBarrier = new Meta.Barrier({ display: global.display,
  193. - x1: this._x - size, x2: this._x, y1: this._y, y2: this._y,
  194. - directions: Meta.BarrierDirection.POSITIVE_Y });
  195. - } else {
  196. - this._verticalBarrier = new Meta.Barrier({ display: global.display,
  197. - x1: this._x, x2: this._x, y1: this._y, y2: this._y + size,
  198. - directions: Meta.BarrierDirection.POSITIVE_X });
  199. - this._horizontalBarrier = new Meta.Barrier({ display: global.display,
  200. - x1: this._x, x2: this._x + size, y1: this._y, y2: this._y,
  201. - directions: Meta.BarrierDirection.POSITIVE_Y });
  202. - }
  203. -
  204. - this._pressureBarrier.addBarrier(this._verticalBarrier);
  205. - this._pressureBarrier.addBarrier(this._horizontalBarrier);
  206. - }
  207. - }
  208. -
  209. - _setupFallbackCornerIfNeeded(layoutManager) {
  210. - if (!global.display.supports_extended_barriers()) {
  211. - this.actor = new Clutter.Actor({ name: 'hot-corner-environs',
  212. - x: this._x, y: this._y,
  213. - width: 3,
  214. - height: 3,
  215. - reactive: true });
  216. -
  217. - this._corner = new Clutter.Actor({ name: 'hot-corner',
  218. - width: 1,
  219. - height: 1,
  220. - opacity: 0,
  221. - reactive: true });
  222. - this._corner._delegate = this;
  223. -
  224. - this.actor.add_child(this._corner);
  225. - layoutManager.addChrome(this.actor);
  226. -
  227. - if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL) {
  228. - this._corner.set_position(this.actor.width - this._corner.width, 0);
  229. - this.actor.set_anchor_point_from_gravity(Clutter.Gravity.NORTH_EAST);
  230. - } else {
  231. - this._corner.set_position(0, 0);
  232. - }
  233. -
  234. - this.actor.connect('leave-event',
  235. - this._onEnvironsLeft.bind(this));
  236. -
  237. - this._corner.connect('enter-event',
  238. - this._onCornerEntered.bind(this));
  239. - this._corner.connect('leave-event',
  240. - this._onCornerLeft.bind(this));
  241. - }
  242. - }
  243. -
  244. - destroy() {
  245. - this.setBarrierSize(0);
  246. - this._pressureBarrier.destroy();
  247. - this._pressureBarrier = null;
  248. -
  249. - if (this.actor)
  250. - this.actor.destroy();
  251. -
  252. - this._ripples.destroy();
  253. - }
  254. -
  255. - _toggleOverview() {
  256. - if (this._monitor.inFullscreen && !Main.overview.visible)
  257. - return;
  258. -
  259. - if (Main.overview.shouldToggleByCornerOrButton()) {
  260. - this._ripples.playAnimation(this._x, this._y);
  261. - Main.overview.toggle();
  262. - }
  263. - }
  264. -
  265. - handleDragOver(source, _actor, _x, _y, _time) {
  266. - if (source != Main.xdndHandler)
  267. - return DND.DragMotionResult.CONTINUE;
  268. -
  269. - this._toggleOverview();
  270. -
  271. - return DND.DragMotionResult.CONTINUE;
  272. - }
  273. -
  274. - _onCornerEntered() {
  275. - if (!this._entered) {
  276. - this._entered = true;
  277. - this._toggleOverview();
  278. - }
  279. - return Clutter.EVENT_PROPAGATE;
  280. - }
  281. -
  282. - _onCornerLeft(actor, event) {
  283. - if (event.get_related() != this.actor)
  284. - this._entered = false;
  285. - // Consume event, otherwise this will confuse onEnvironsLeft
  286. - return Clutter.EVENT_STOP;
  287. - }
  288. -
  289. - _onEnvironsLeft(actor, event) {
  290. - if (event.get_related() != this._corner)
  291. - this._entered = false;
  292. - return Clutter.EVENT_PROPAGATE;
  293. - }
  294. -};
  295. -
  296. var PressureBarrier = class PressureBarrier {
  297. constructor(threshold, timeout, actionMode) {
  298. this._threshold = threshold;
  299. diff --git a/js/ui/panel.js b/js/ui/panel.js
  300. index 77163a7..8ee3a0c 100644
  301. --- a/js/ui/panel.js
  302. +++ b/js/ui/panel.js
  303. @@ -16,8 +16,6 @@ const Main = imports.ui.main;
  304. var PANEL_ICON_SIZE = 16;
  305. var APP_MENU_ICON_MARGIN = 0;
  306. -var BUTTON_DND_ACTIVATION_TIMEOUT = 250;
  307. -
  308. // To make sure the panel corners blend nicely with the panel,
  309. // we draw background and borders the same way, e.g. drawing
  310. // them as filled shapes from the outside inwards instead of
  311. @@ -421,93 +419,6 @@ var AppMenuButton = GObject.registerClass({
  312. }
  313. });
  314. -var ActivitiesButton = GObject.registerClass(
  315. -class ActivitiesButton extends PanelMenu.Button {
  316. - _init() {
  317. - super._init(0.0, null, true);
  318. - this.accessible_role = Atk.Role.TOGGLE_BUTTON;
  319. -
  320. - this.name = 'panelActivities';
  321. -
  322. - /* Translators: If there is no suitable word for "Activities"
  323. - in your language, you can use the word for "Overview". */
  324. - this._label = new St.Label({ text: _("Activities"),
  325. - y_align: Clutter.ActorAlign.CENTER });
  326. - this.add_actor(this._label);
  327. -
  328. - this.label_actor = this._label;
  329. -
  330. - this.connect('captured-event', this._onCapturedEvent.bind(this));
  331. - this.connect_after('key-release-event', this._onKeyRelease.bind(this));
  332. -
  333. - Main.overview.connect('showing', () => {
  334. - this.add_style_pseudo_class('overview');
  335. - this.add_accessible_state (Atk.StateType.CHECKED);
  336. - });
  337. - Main.overview.connect('hiding', () => {
  338. - this.remove_style_pseudo_class('overview');
  339. - this.remove_accessible_state (Atk.StateType.CHECKED);
  340. - });
  341. -
  342. - this._xdndTimeOut = 0;
  343. - }
  344. -
  345. - handleDragOver(source, _actor, _x, _y, _time) {
  346. - if (source != Main.xdndHandler)
  347. - return DND.DragMotionResult.CONTINUE;
  348. -
  349. - if (this._xdndTimeOut != 0)
  350. - GLib.source_remove(this._xdndTimeOut);
  351. - this._xdndTimeOut = GLib.timeout_add(GLib.PRIORITY_DEFAULT, BUTTON_DND_ACTIVATION_TIMEOUT, () => {
  352. - this._xdndToggleOverview();
  353. - });
  354. - GLib.Source.set_name_by_id(this._xdndTimeOut, '[gnome-shell] this._xdndToggleOverview');
  355. -
  356. - return DND.DragMotionResult.CONTINUE;
  357. - }
  358. -
  359. - _onCapturedEvent(actor, event) {
  360. - if (event.type() == Clutter.EventType.BUTTON_PRESS ||
  361. - event.type() == Clutter.EventType.TOUCH_BEGIN) {
  362. - if (!Main.overview.shouldToggleByCornerOrButton())
  363. - return Clutter.EVENT_STOP;
  364. - }
  365. - return Clutter.EVENT_PROPAGATE;
  366. - }
  367. -
  368. - _onEvent(actor, event) {
  369. - super._onEvent(actor, event);
  370. -
  371. - if (event.type() == Clutter.EventType.TOUCH_END ||
  372. - event.type() == Clutter.EventType.BUTTON_RELEASE)
  373. - if (Main.overview.shouldToggleByCornerOrButton())
  374. - Main.overview.toggle();
  375. -
  376. - return Clutter.EVENT_PROPAGATE;
  377. - }
  378. -
  379. - _onKeyRelease(actor, event) {
  380. - let symbol = event.get_key_symbol();
  381. - if (symbol == Clutter.KEY_Return || symbol == Clutter.KEY_space) {
  382. - if (Main.overview.shouldToggleByCornerOrButton())
  383. - Main.overview.toggle();
  384. - }
  385. - return Clutter.EVENT_PROPAGATE;
  386. - }
  387. -
  388. - _xdndToggleOverview() {
  389. - let [x, y] = global.get_pointer();
  390. - let pickedActor = global.stage.get_actor_at_pos(Clutter.PickMode.REACTIVE, x, y);
  391. -
  392. - if (pickedActor == this && Main.overview.shouldToggleByCornerOrButton())
  393. - Main.overview.toggle();
  394. -
  395. - GLib.source_remove(this._xdndTimeOut);
  396. - this._xdndTimeOut = 0;
  397. - return GLib.SOURCE_REMOVE;
  398. - }
  399. -});
  400. -
  401. var PanelCorner = class {
  402. constructor(side) {
  403. this._side = side;
  404. @@ -775,7 +686,6 @@ class AggregateMenu extends PanelMenu.Button {
  405. });
  406. const PANEL_ITEM_IMPLEMENTATIONS = {
  407. - 'activities': ActivitiesButton,
  408. 'aggregateMenu': AggregateMenu,
  409. 'appMenu': AppMenuButton,
  410. 'dateMenu': imports.ui.dateMenu.DateMenuButton,
  411. --
  412. 2.17.1