-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add swipe gesture recognizer and onDidReceiveSwipeGesture
extension API.
#879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -737,6 +737,41 @@ export class CodeWindow extends BaseWindow implements ICodeWindow { | |
|
||
cb({ cancel: false, requestHeaders: Object.assign(details.requestHeaders, headers) }); | ||
}); | ||
|
||
this.registerSwipeGesture(); | ||
} | ||
private registerSwipeGesture(): void { | ||
|
||
const configurationKey = 'workbench.editor.swipeGestureRecognizer'; | ||
Comment on lines
+743
to
+745
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The configuration key string Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||
const swipeListener = this._register(new DisposableStore()); | ||
|
||
const swipeGestureRecognizer = (electronWindow: electron.BrowserWindow) => { | ||
|
||
swipeListener.clear(); | ||
if (this.configurationService.getValue<boolean | undefined>(configurationKey) !== true) { | ||
return; | ||
} | ||
|
||
const disposable = this._register( | ||
Event.fromNodeEventEmitter(electronWindow, 'swipe', | ||
(event: Electron.Event, direction: 'left' | 'right' | 'up' | 'down') => ({ event, direction }))((e) => { | ||
this.sendWhenReady('vscode:runAction', CancellationToken.None, { id: '_workbench.triggerSwipeGesture', args: [e.direction] }); | ||
|
||
})); | ||
Comment on lines
+755
to
+760
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The command ID Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||
swipeListener.add(disposable); | ||
|
||
}; | ||
|
||
if (this.win !== null && isMacintosh) { | ||
const win = this.win; | ||
this._register(this.configurationService.onDidChangeConfiguration(event => { | ||
if (event.affectsConfiguration(configurationKey)) { | ||
swipeGestureRecognizer(win); | ||
} | ||
})); | ||
swipeGestureRecognizer(win); | ||
} | ||
|
||
} | ||
|
||
private marketplaceHeadersPromise: Promise<object> | undefined; | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -26,6 +26,10 @@ export class ExtHostWindow implements ExtHostWindowShape { | |||||||||||||
private readonly _onDidChangeWindowState = new Emitter<WindowState>(); | ||||||||||||||
readonly onDidChangeWindowState: Event<WindowState> = this._onDidChangeWindowState.event; | ||||||||||||||
|
||||||||||||||
private _onDidReceiveSwipeGesture = new Emitter<'left' | 'right' | 'up' | 'down'>(); | ||||||||||||||
|
||||||||||||||
readonly onDidReceiveSwipeGesture: Event<'left' | 'right' | 'up' | 'down'> = this._onDidReceiveSwipeGesture.event; | ||||||||||||||
Comment on lines
+29
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The swipe direction type
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||||||||||
|
||||||||||||||
private _nativeHandle: Uint8Array | undefined; | ||||||||||||||
private _state = ExtHostWindow.InitialState; | ||||||||||||||
|
||||||||||||||
|
@@ -56,6 +60,9 @@ export class ExtHostWindow implements ExtHostWindowShape { | |||||||||||||
this.onDidChangeWindowProperty('active', isActive); | ||||||||||||||
}); | ||||||||||||||
} | ||||||||||||||
$onDidReceiveSwipeGesture(direction: 'left' | 'right' | 'up' | 'down'): void { | ||||||||||||||
this._onDidReceiveSwipeGesture.fire(direction); | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
get nativeHandle(): Uint8Array | undefined { | ||||||||||||||
return this._nativeHandle; | ||||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.