Use shell-global to check if mouse btn is pressed

This commit is contained in:
Charles Gagnon
2019-02-26 22:09:52 -05:00
parent d4d13cf386
commit 83158d5226
2 changed files with 5 additions and 12 deletions

View File

@@ -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')) {

View File

@@ -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) {