123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426 |
- From 23ce8b5393f5aacb976f8fe131229d9a87c6e80c Mon Sep 17 00:00:00 2001
- From: Yugang <fanyugang.fyg@linux.alibaba.com>
- Date: Wed, 17 Nov 2021 11:30:39 +0800
- Subject: [PATCH] Remove hot corner application due to crash issue.
- ---
- js/ui/layout.js | 238 +-----------------------------------------------
- js/ui/panel.js | 90 ------------------
- 2 files changed, 1 insertion(+), 327 deletions(-)
- diff --git a/js/ui/layout.js b/js/ui/layout.js
- index 1441bfe..9f8a639 100644
- --- a/js/ui/layout.js
- +++ b/js/ui/layout.js
- @@ -17,9 +17,6 @@ var STARTUP_ANIMATION_TIME = 500;
- var KEYBOARD_ANIMATION_TIME = 150;
- var BACKGROUND_FADE_ANIMATION_TIME = 1000;
-
- -var HOT_CORNER_PRESSURE_THRESHOLD = 100; // pixels
- -var HOT_CORNER_PRESSURE_TIMEOUT = 1000; // ms
- -
- function isPopupMetaWindow(actor) {
- switch (actor.meta_window.get_window_type()) {
- case Meta.WindowType.DROPDOWN_MENU:
- @@ -185,8 +182,7 @@ const defaultParams = {
- };
-
- var LayoutManager = GObject.registerClass({
- - Signals: { 'hot-corners-changed': {},
- - 'startup-complete': {},
- + Signals: { 'startup-complete': {},
- 'startup-prepared': {},
- 'monitors-changed': {},
- 'system-modal-opened': {},
- @@ -199,7 +195,6 @@ var LayoutManager = GObject.registerClass({
- this.monitors = [];
- this.primaryMonitor = null;
- this.primaryIndex = -1;
- - this.hotCorners = [];
-
- this._keyboardIndex = -1;
- this._rightPanelBarrier = null;
- @@ -282,9 +277,6 @@ var LayoutManager = GObject.registerClass({
- schema_id: 'org.gnome.desktop.interface'
- });
-
- - this._interfaceSettings.connect('changed::enable-hot-corners',
- - this._updateHotCorners.bind(this));
- -
- // Need to update struts on new workspaces when they are added
- let workspaceManager = global.workspace_manager;
- workspaceManager.connect('notify::n-workspaces',
- @@ -380,70 +372,6 @@ var LayoutManager = GObject.registerClass({
- }
- }
-
- - _updateHotCorners() {
- - // destroy old hot corners
- - this.hotCorners.forEach(corner => {
- - if (corner)
- - corner.destroy();
- - });
- - this.hotCorners = [];
- -
- - if (!this._interfaceSettings.get_boolean('enable-hot-corners')) {
- - this.emit('hot-corners-changed');
- - return;
- - }
- -
- - let size = this.panelBox.height;
- -
- - // build new hot corners
- - for (let i = 0; i < this.monitors.length; i++) {
- - let monitor = this.monitors[i];
- - let cornerX = this._rtl ? monitor.x + monitor.width : monitor.x;
- - let cornerY = monitor.y;
- -
- - let haveTopLeftCorner = true;
- -
- - if (i != this.primaryIndex) {
- - // Check if we have a top left (right for RTL) corner.
- - // I.e. if there is no monitor directly above or to the left(right)
- - let besideX = this._rtl ? monitor.x + 1 : cornerX - 1;
- - let besideY = cornerY;
- - let aboveX = cornerX;
- - let aboveY = cornerY - 1;
- -
- - for (let j = 0; j < this.monitors.length; j++) {
- - if (i == j)
- - continue;
- - let otherMonitor = this.monitors[j];
- - if (besideX >= otherMonitor.x &&
- - besideX < otherMonitor.x + otherMonitor.width &&
- - besideY >= otherMonitor.y &&
- - besideY < otherMonitor.y + otherMonitor.height) {
- - haveTopLeftCorner = false;
- - break;
- - }
- - if (aboveX >= otherMonitor.x &&
- - aboveX < otherMonitor.x + otherMonitor.width &&
- - aboveY >= otherMonitor.y &&
- - aboveY < otherMonitor.y + otherMonitor.height) {
- - haveTopLeftCorner = false;
- - break;
- - }
- - }
- - }
- -
- - if (haveTopLeftCorner) {
- - let corner = new HotCorner(this, monitor, cornerX, cornerY);
- - corner.setBarrierSize(size);
- - this.hotCorners.push(corner);
- - } else {
- - this.hotCorners.push(null);
- - }
- - }
- -
- - this.emit('hot-corners-changed');
- - }
- -
- _addBackgroundMenu(bgManager) {
- BackgroundMenu.addBackgroundMenu(bgManager.backgroundActor, this);
- }
- @@ -516,10 +444,6 @@ var LayoutManager = GObject.registerClass({
- this._updatePanelBarrier();
-
- let size = this.panelBox.height;
- - this.hotCorners.forEach(corner => {
- - if (corner)
- - corner.setBarrierSize(size);
- - });
- }
-
- _updatePanelBarrier() {
- @@ -544,7 +468,6 @@ var LayoutManager = GObject.registerClass({
- _monitorsChanged() {
- this._updateMonitors();
- this._updateBoxes();
- - this._updateHotCorners();
- this._updateBackgrounds();
- this._updateFullscreen();
- this._updateVisibility();
- @@ -1108,165 +1031,6 @@ var LayoutManager = GObject.registerClass({
- }
- });
-
- -
- -// HotCorner:
- -//
- -// This class manages a "hot corner" that can toggle switching to
- -// overview.
- -var HotCorner = class HotCorner {
- - constructor(layoutManager, monitor, x, y) {
- - // We use this flag to mark the case where the user has entered the
- - // hot corner and has not left both the hot corner and a surrounding
- - // guard area (the "environs"). This avoids triggering the hot corner
- - // multiple times due to an accidental jitter.
- - this._entered = false;
- -
- - this._monitor = monitor;
- -
- - this._x = x;
- - this._y = y;
- -
- - this._setupFallbackCornerIfNeeded(layoutManager);
- -
- - this._pressureBarrier = new PressureBarrier(HOT_CORNER_PRESSURE_THRESHOLD,
- - HOT_CORNER_PRESSURE_TIMEOUT,
- - Shell.ActionMode.NORMAL |
- - Shell.ActionMode.OVERVIEW);
- - this._pressureBarrier.connect('trigger', this._toggleOverview.bind(this));
- -
- - let px = 0.0;
- - let py = 0.0;
- - if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL) {
- - px = 1.0;
- - py = 0.0;
- - }
- -
- - this._ripples = new Ripples.Ripples(px, py, 'ripple-box');
- - this._ripples.addTo(layoutManager.uiGroup);
- - }
- -
- - setBarrierSize(size) {
- - if (this._verticalBarrier) {
- - this._pressureBarrier.removeBarrier(this._verticalBarrier);
- - this._verticalBarrier.destroy();
- - this._verticalBarrier = null;
- - }
- -
- - if (this._horizontalBarrier) {
- - this._pressureBarrier.removeBarrier(this._horizontalBarrier);
- - this._horizontalBarrier.destroy();
- - this._horizontalBarrier = null;
- - }
- -
- - if (size > 0) {
- - if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL) {
- - this._verticalBarrier = new Meta.Barrier({ display: global.display,
- - x1: this._x, x2: this._x, y1: this._y, y2: this._y + size,
- - directions: Meta.BarrierDirection.NEGATIVE_X });
- - this._horizontalBarrier = new Meta.Barrier({ display: global.display,
- - x1: this._x - size, x2: this._x, y1: this._y, y2: this._y,
- - directions: Meta.BarrierDirection.POSITIVE_Y });
- - } else {
- - this._verticalBarrier = new Meta.Barrier({ display: global.display,
- - x1: this._x, x2: this._x, y1: this._y, y2: this._y + size,
- - directions: Meta.BarrierDirection.POSITIVE_X });
- - this._horizontalBarrier = new Meta.Barrier({ display: global.display,
- - x1: this._x, x2: this._x + size, y1: this._y, y2: this._y,
- - directions: Meta.BarrierDirection.POSITIVE_Y });
- - }
- -
- - this._pressureBarrier.addBarrier(this._verticalBarrier);
- - this._pressureBarrier.addBarrier(this._horizontalBarrier);
- - }
- - }
- -
- - _setupFallbackCornerIfNeeded(layoutManager) {
- - if (!global.display.supports_extended_barriers()) {
- - this.actor = new Clutter.Actor({ name: 'hot-corner-environs',
- - x: this._x, y: this._y,
- - width: 3,
- - height: 3,
- - reactive: true });
- -
- - this._corner = new Clutter.Actor({ name: 'hot-corner',
- - width: 1,
- - height: 1,
- - opacity: 0,
- - reactive: true });
- - this._corner._delegate = this;
- -
- - this.actor.add_child(this._corner);
- - layoutManager.addChrome(this.actor);
- -
- - if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL) {
- - this._corner.set_position(this.actor.width - this._corner.width, 0);
- - this.actor.set_anchor_point_from_gravity(Clutter.Gravity.NORTH_EAST);
- - } else {
- - this._corner.set_position(0, 0);
- - }
- -
- - this.actor.connect('leave-event',
- - this._onEnvironsLeft.bind(this));
- -
- - this._corner.connect('enter-event',
- - this._onCornerEntered.bind(this));
- - this._corner.connect('leave-event',
- - this._onCornerLeft.bind(this));
- - }
- - }
- -
- - destroy() {
- - this.setBarrierSize(0);
- - this._pressureBarrier.destroy();
- - this._pressureBarrier = null;
- -
- - if (this.actor)
- - this.actor.destroy();
- -
- - this._ripples.destroy();
- - }
- -
- - _toggleOverview() {
- - if (this._monitor.inFullscreen && !Main.overview.visible)
- - return;
- -
- - if (Main.overview.shouldToggleByCornerOrButton()) {
- - this._ripples.playAnimation(this._x, this._y);
- - Main.overview.toggle();
- - }
- - }
- -
- - handleDragOver(source, _actor, _x, _y, _time) {
- - if (source != Main.xdndHandler)
- - return DND.DragMotionResult.CONTINUE;
- -
- - this._toggleOverview();
- -
- - return DND.DragMotionResult.CONTINUE;
- - }
- -
- - _onCornerEntered() {
- - if (!this._entered) {
- - this._entered = true;
- - this._toggleOverview();
- - }
- - return Clutter.EVENT_PROPAGATE;
- - }
- -
- - _onCornerLeft(actor, event) {
- - if (event.get_related() != this.actor)
- - this._entered = false;
- - // Consume event, otherwise this will confuse onEnvironsLeft
- - return Clutter.EVENT_STOP;
- - }
- -
- - _onEnvironsLeft(actor, event) {
- - if (event.get_related() != this._corner)
- - this._entered = false;
- - return Clutter.EVENT_PROPAGATE;
- - }
- -};
- -
- var PressureBarrier = class PressureBarrier {
- constructor(threshold, timeout, actionMode) {
- this._threshold = threshold;
- diff --git a/js/ui/panel.js b/js/ui/panel.js
- index 77163a7..8ee3a0c 100644
- --- a/js/ui/panel.js
- +++ b/js/ui/panel.js
- @@ -16,8 +16,6 @@ const Main = imports.ui.main;
- var PANEL_ICON_SIZE = 16;
- var APP_MENU_ICON_MARGIN = 0;
-
- -var BUTTON_DND_ACTIVATION_TIMEOUT = 250;
- -
- // To make sure the panel corners blend nicely with the panel,
- // we draw background and borders the same way, e.g. drawing
- // them as filled shapes from the outside inwards instead of
- @@ -421,93 +419,6 @@ var AppMenuButton = GObject.registerClass({
- }
- });
-
- -var ActivitiesButton = GObject.registerClass(
- -class ActivitiesButton extends PanelMenu.Button {
- - _init() {
- - super._init(0.0, null, true);
- - this.accessible_role = Atk.Role.TOGGLE_BUTTON;
- -
- - this.name = 'panelActivities';
- -
- - /* Translators: If there is no suitable word for "Activities"
- - in your language, you can use the word for "Overview". */
- - this._label = new St.Label({ text: _("Activities"),
- - y_align: Clutter.ActorAlign.CENTER });
- - this.add_actor(this._label);
- -
- - this.label_actor = this._label;
- -
- - this.connect('captured-event', this._onCapturedEvent.bind(this));
- - this.connect_after('key-release-event', this._onKeyRelease.bind(this));
- -
- - Main.overview.connect('showing', () => {
- - this.add_style_pseudo_class('overview');
- - this.add_accessible_state (Atk.StateType.CHECKED);
- - });
- - Main.overview.connect('hiding', () => {
- - this.remove_style_pseudo_class('overview');
- - this.remove_accessible_state (Atk.StateType.CHECKED);
- - });
- -
- - this._xdndTimeOut = 0;
- - }
- -
- - handleDragOver(source, _actor, _x, _y, _time) {
- - if (source != Main.xdndHandler)
- - return DND.DragMotionResult.CONTINUE;
- -
- - if (this._xdndTimeOut != 0)
- - GLib.source_remove(this._xdndTimeOut);
- - this._xdndTimeOut = GLib.timeout_add(GLib.PRIORITY_DEFAULT, BUTTON_DND_ACTIVATION_TIMEOUT, () => {
- - this._xdndToggleOverview();
- - });
- - GLib.Source.set_name_by_id(this._xdndTimeOut, '[gnome-shell] this._xdndToggleOverview');
- -
- - return DND.DragMotionResult.CONTINUE;
- - }
- -
- - _onCapturedEvent(actor, event) {
- - if (event.type() == Clutter.EventType.BUTTON_PRESS ||
- - event.type() == Clutter.EventType.TOUCH_BEGIN) {
- - if (!Main.overview.shouldToggleByCornerOrButton())
- - return Clutter.EVENT_STOP;
- - }
- - return Clutter.EVENT_PROPAGATE;
- - }
- -
- - _onEvent(actor, event) {
- - super._onEvent(actor, event);
- -
- - if (event.type() == Clutter.EventType.TOUCH_END ||
- - event.type() == Clutter.EventType.BUTTON_RELEASE)
- - if (Main.overview.shouldToggleByCornerOrButton())
- - Main.overview.toggle();
- -
- - return Clutter.EVENT_PROPAGATE;
- - }
- -
- - _onKeyRelease(actor, event) {
- - let symbol = event.get_key_symbol();
- - if (symbol == Clutter.KEY_Return || symbol == Clutter.KEY_space) {
- - if (Main.overview.shouldToggleByCornerOrButton())
- - Main.overview.toggle();
- - }
- - return Clutter.EVENT_PROPAGATE;
- - }
- -
- - _xdndToggleOverview() {
- - let [x, y] = global.get_pointer();
- - let pickedActor = global.stage.get_actor_at_pos(Clutter.PickMode.REACTIVE, x, y);
- -
- - if (pickedActor == this && Main.overview.shouldToggleByCornerOrButton())
- - Main.overview.toggle();
- -
- - GLib.source_remove(this._xdndTimeOut);
- - this._xdndTimeOut = 0;
- - return GLib.SOURCE_REMOVE;
- - }
- -});
- -
- var PanelCorner = class {
- constructor(side) {
- this._side = side;
- @@ -775,7 +686,6 @@ class AggregateMenu extends PanelMenu.Button {
- });
-
- const PANEL_ITEM_IMPLEMENTATIONS = {
- - 'activities': ActivitiesButton,
- 'aggregateMenu': AggregateMenu,
- 'appMenu': AppMenuButton,
- 'dateMenu': imports.ui.dateMenu.DateMenuButton,
- --
- 2.17.1
|