MCPcopy
hub / github.com/paperwm/PaperWM / _drift

Method _drift

tiling.js:1264–1287  ·  view source on GitHub ↗
(dx)

Source from the content-addressed store, hash-verified

1262 }
1263
1264 _drift(dx) {
1265 if (dx === 0) {
1266 return;
1267 }
1268 if (this.drifting) {
1269 return;
1270 }
1271 this.drifting = true;
1272
1273 // stop drifting on key_release
1274 Navigator.getActionDispatcher(DispatcherMode.KEYBOARD)
1275 .addKeyReleaseCallback(() => {
1276 Utils.timeout_remove(driftTimeout);
1277 this.drifting = null;
1278 });
1279
1280 Utils.timeout_remove(driftTimeout);
1281 driftTimeout = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 1, () => {
1282 Gestures.update(this, dx, 1);
1283 this.selectedWindow = Gestures.findTargetWindow(this, dx < 0 ? -1 : 1);
1284 ensureViewport(this.selectedWindow, this);
1285 return true;
1286 });
1287 }
1288
1289 driftLeft() { this._drift(-1 * Settings.prefs.drift_speed); }
1290 driftRight() { this._drift(Settings.prefs.drift_speed); }

Callers 2

driftLeftMethod · 0.95
driftRightMethod · 0.95

Calls 3

ensureViewportFunction · 0.85
addKeyReleaseCallbackMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected