[gnome-shell] appDisplay: Simplify event blocking while folder is opened
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] appDisplay: Simplify event blocking while folder is opened
- Date: Sat, 23 Nov 2019 17:47:59 +0000 (UTC)
commit 0897915b05c39011532adac25206d5f78bc3bb02
Author: Jonas Dreßler <verdre v0yd nl>
Date: Sat Nov 23 21:11:14 2019 +0100
appDisplay: Simplify event blocking while folder is opened
There's no need for a `inhibitEventBlocker` interface. Since we connect
to "open-state-changed" of our folders in the AllView anyway, we can
just make the event blocker visible while a folder is opened, and hide
the event blocker during DnD.
This allows keeping the eventBlocker reactive at all times and fixes an
issue where DnD to create a new folder is impossible if no folders are
present because the eventBlocker would not get inhibited.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1652
js/ui/appDisplay.js | 35 +++++++++++++----------------------
1 file changed, 13 insertions(+), 22 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 6221eb2b41..2b60bc9a57 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -337,7 +337,12 @@ var AllView = GObject.registerClass({
this._grid.currentPage = 0;
this._stack.add_actor(this._grid);
- this._eventBlocker = new St.Widget({ x_expand: true, y_expand: true });
+ this._eventBlocker = new St.Widget({
+ x_expand: true,
+ y_expand: true,
+ reactive: true,
+ visible: false,
+ });
this._stack.add_actor(this._eventBlocker);
box.add_actor(this._stack);
@@ -364,6 +369,7 @@ var AllView = GObject.registerClass({
});
this._eventBlocker.add_action(this._clickAction);
+ this._currentPopup = null;
this._displayingPopup = false;
this._currentPopupDestroyId = 0;
@@ -394,8 +400,6 @@ var AllView = GObject.registerClass({
Main.overview.connect('item-drag-begin', this._onDragBegin.bind(this));
Main.overview.connect('item-drag-end', this._onDragEnd.bind(this));
-
- this._nEventBlockerInhibits = 0;
}
vfunc_map() {
@@ -610,7 +614,6 @@ var AllView = GObject.registerClass({
openSpaceForPopup(item, side, nRows) {
this._updateIconOpacities(true);
this._displayingPopup = true;
- this._eventBlocker.reactive = true;
this._grid.openExtraSpace(item, side, nRows);
}
@@ -685,7 +688,7 @@ var AllView = GObject.registerClass({
addFolderPopup(popup) {
this._stack.add_actor(popup);
popup.connect('open-state-changed', (o, isOpen) => {
- this._eventBlocker.reactive = isOpen;
+ this._eventBlocker.visible = isOpen;
if (this._currentPopup) {
this._currentPopup.disconnect(this._currentPopupDestroyId);
@@ -699,7 +702,7 @@ var AllView = GObject.registerClass({
this._currentPopupDestroyId = popup.connect('destroy', () => {
this._currentPopup = null;
this._currentPopupDestroyId = 0;
- this._eventBlocker.reactive = false;
+ this._eventBlocker.visible = false;
});
}
this._updateIconOpacities(isOpen);
@@ -795,6 +798,8 @@ var AllView = GObject.registerClass({
dragMotion: this._onDragMotion.bind(this),
};
DND.addDragMonitor(this._dragMonitor);
+
+ this._eventBlocker.visible = false;
}
_onDragMotion(dragEvent) {
@@ -817,6 +822,8 @@ var AllView = GObject.registerClass({
DND.removeDragMonitor(this._dragMonitor);
this._dragMonitor = null;
}
+
+ this._eventBlocker.visible = this._currentPopup !== null;
}
_canAccept(source) {
@@ -850,19 +857,6 @@ var AllView = GObject.registerClass({
return true;
}
- inhibitEventBlocker() {
- this._nEventBlockerInhibits++;
- this._eventBlocker.visible = this._nEventBlockerInhibits == 0;
- }
-
- uninhibitEventBlocker() {
- if (this._nEventBlockerInhibits === 0)
- throw new Error('Not inhibited');
-
- this._nEventBlockerInhibits--;
- this._eventBlocker.visible = this._nEventBlockerInhibits == 0;
- }
-
createFolder(apps) {
let newFolderId = GLib.uuid_string_random();
@@ -1566,8 +1560,6 @@ var FolderIcon = GObject.registerClass({
dragMotion: this._onDragMotion.bind(this),
};
DND.addDragMonitor(this._dragMonitor);
-
- this._parentView.inhibitEventBlocker();
}
_onDragMotion(dragEvent) {
@@ -1583,7 +1575,6 @@ var FolderIcon = GObject.registerClass({
_onDragEnd() {
this.remove_style_pseudo_class('drop');
- this._parentView.uninhibitEventBlocker();
DND.removeDragMonitor(this._dragMonitor);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]