From 83158d522684f04926ced6fb66b17c0f8612ddb1 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Tue, 26 Feb 2019 22:09:52 -0500 Subject: [PATCH] Use shell-global to check if mouse btn is pressed --- intellihide.js | 7 +++++-- panelManager.js | 10 ---------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/intellihide.js b/intellihide.js index b83c12a..4690500 100644 --- a/intellihide.js +++ b/intellihide.js @@ -16,6 +16,7 @@ */ const Lang = imports.lang; +const Clutter = imports.gi.Clutter; const Meta = imports.gi.Meta; const Shell = imports.gi.Shell; @@ -295,12 +296,14 @@ var Intellihide = Utils.defineClass({ } if (fromRevealMechanism) { + let mouseBtnIsPressed = global.get_pointer()[2] & Clutter.ModifierType.BUTTON1_MASK; + //the user is trying to reveal the panel - if (this._monitor.inFullscreen && !this._panelManager.mouseBtnPressed) { + if (this._monitor.inFullscreen && !mouseBtnIsPressed) { return this._dtpSettings.get_boolean('intellihide-show-in-fullscreen'); } - return !this._panelManager.mouseBtnPressed; + return !mouseBtnIsPressed; } if (!this._dtpSettings.get_boolean('intellihide-hide-from-windows')) { diff --git a/panelManager.js b/panelManager.js index 8373edc..889286f 100755 --- a/panelManager.js +++ b/panelManager.js @@ -36,7 +36,6 @@ const Utils = Me.imports.utils; const Lang = imports.lang; const Gi = imports._gi; -const Atspi = imports.gi.Atspi; const Clutter = imports.gi.Clutter; const Meta = imports.gi.Meta; const Shell = imports.gi.Shell; @@ -50,16 +49,12 @@ const PanelMenu = imports.ui.panelMenu; const Layout = imports.ui.layout; const WorkspacesView = imports.ui.workspacesView; -const ATSPI_MOUSE = 'mouse:button:'; -const ATSPI_MOUSE_EVENTS = ['1p', '1r']; - var dtpPanelManager = Utils.defineClass({ Name: 'DashToPanel.PanelManager', _init: function(settings) { this._dtpSettings = settings; this.overview = new Overview.dtpOverview(settings); - this.mouseBtnPressed = false; }, enable: function(reset) { @@ -147,9 +142,6 @@ var dtpPanelManager = Utils.defineClass({ this._needsDashItemContainerAllocate = !Dash.DashItemContainer.prototype.hasOwnProperty('vfunc_allocate'); - this._mouseListener = Atspi.EventListener.new(e => this.mouseBtnPressed = e.type.slice(-1) == 'p'); - ATSPI_MOUSE_EVENTS.forEach(e => this._mouseListener.register(ATSPI_MOUSE + e)); - if (this._needsDashItemContainerAllocate) { Utils.hookVfunc(Dash.DashItemContainer.prototype, 'allocate', this._newDashItemContainerAllocate); } @@ -250,8 +242,6 @@ var dtpPanelManager = Utils.defineClass({ if (this._needsDashItemContainerAllocate) { Utils.hookVfunc(Dash.DashItemContainer.prototype, 'allocate', function(box, flags) { this.vfunc_allocate(box, flags); }); } - - ATSPI_MOUSE_EVENTS.forEach(e => this._mouseListener.deregister(ATSPI_MOUSE + e)); }, setFocusedMonitor: function(monitor, ignoreRelayout) {