XDND: Don't reset switch timeout when pointer is over the same window
Currently we reset the timeout on every mouse movement which means the user has to keep the mouse at the exact same position for 1.25 seconds. Be more tolerant and allow the user to move the mouse over the window without reseting the timeout, which should make activating windows easier. https://bugzilla.gnome.org/show_bug.cgi?id=638896
This commit is contained in:
parent
2cfe978e1f
commit
ee6a852996
@ -167,6 +167,7 @@ Overview.prototype = {
|
|||||||
this._windowSwitchTimeoutId = 0;
|
this._windowSwitchTimeoutId = 0;
|
||||||
this._windowSwitchTimestamp = 0;
|
this._windowSwitchTimestamp = 0;
|
||||||
this._lastActiveWorkspaceIndex = -1;
|
this._lastActiveWorkspaceIndex = -1;
|
||||||
|
this._lastHoveredWindow = null;
|
||||||
this._needsFakePointerEvent = false;
|
this._needsFakePointerEvent = false;
|
||||||
|
|
||||||
this.workspaces = null;
|
this.workspaces = null;
|
||||||
@ -186,7 +187,7 @@ Overview.prototype = {
|
|||||||
global.screen.get_workspace_by_index(this._lastActiveWorkspaceIndex).activate(time);
|
global.screen.get_workspace_by_index(this._lastActiveWorkspaceIndex).activate(time);
|
||||||
this.hideTemporarily();
|
this.hideTemporarily();
|
||||||
}
|
}
|
||||||
|
this._lastHoveredWindow = null;
|
||||||
DND.removeMonitor(this._dragMonitor);
|
DND.removeMonitor(this._dragMonitor);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -200,15 +201,24 @@ Overview.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_onDragMotion: function(dragEvent) {
|
_onDragMotion: function(dragEvent) {
|
||||||
|
let targetIsWindow = dragEvent.targetActor &&
|
||||||
|
dragEvent.targetActor._delegate &&
|
||||||
|
dragEvent.targetActor._delegate.metaWindow;
|
||||||
|
|
||||||
|
if (targetIsWindow &&
|
||||||
|
dragEvent.targetActor._delegate.metaWindow == this._lastHoveredWindow)
|
||||||
|
return;
|
||||||
|
else
|
||||||
|
this._lastHoveredWindow = null;
|
||||||
|
|
||||||
if (this._windowSwitchTimeoutId != 0) {
|
if (this._windowSwitchTimeoutId != 0) {
|
||||||
Mainloop.source_remove(this._windowSwitchTimeoutId);
|
Mainloop.source_remove(this._windowSwitchTimeoutId);
|
||||||
this._windowSwitchTimeoutId = 0;
|
this._windowSwitchTimeoutId = 0;
|
||||||
this._needsFakePointerEvent = false;
|
this._needsFakePointerEvent = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dragEvent.targetActor &&
|
if (targetIsWindow) {
|
||||||
dragEvent.targetActor._delegate &&
|
this._lastHoveredWindow = dragEvent.targetActor._delegate.metaWindow;
|
||||||
dragEvent.targetActor._delegate.metaWindow) {
|
|
||||||
this._windowSwitchTimestamp = global.get_current_time();
|
this._windowSwitchTimestamp = global.get_current_time();
|
||||||
this._windowSwitchTimeoutId = Mainloop.timeout_add(DND_WINDOW_SWITCH_TIMEOUT,
|
this._windowSwitchTimeoutId = Mainloop.timeout_add(DND_WINDOW_SWITCH_TIMEOUT,
|
||||||
Lang.bind(this, function() {
|
Lang.bind(this, function() {
|
||||||
@ -216,6 +226,7 @@ Overview.prototype = {
|
|||||||
Main.activateWindow(dragEvent.targetActor._delegate.metaWindow,
|
Main.activateWindow(dragEvent.targetActor._delegate.metaWindow,
|
||||||
this._windowSwitchTimestamp);
|
this._windowSwitchTimestamp);
|
||||||
this.hideTemporarily();
|
this.hideTemporarily();
|
||||||
|
this._lastHoveredWindow = null;
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user