5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-21 11:29:29 +08:00

[linux] Create Linux runtime

This commit is contained in:
Lea Anthony 2021-06-04 20:32:40 +10:00
parent a1d5412465
commit 466676d99f
No known key found for this signature in database
GPG Key ID: 33DAF7BB90A58405
5 changed files with 34 additions and 3 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -19,7 +19,7 @@ export const System = {
};
export function SendMessage(message) {
window.webkit.messageHandlers.external.postMessage(message);
window.wailsInvoke(message);
}
export function Init() {
@ -32,10 +32,34 @@ export function Init() {
if (currentElement.hasAttribute('data-wails-no-drag')) {
break;
} else if (currentElement.hasAttribute('data-wails-drag')) {
window.webkit.messageHandlers.windowDrag.postMessage(null);
window.wailsDrag(null);
break;
}
currentElement = currentElement.parentElement;
}
});
// Setup context menu hook
window.addEventListener('contextmenu', function (e) {
let currentElement = e.target;
let contextMenuId;
while (currentElement != null) {
contextMenuId = currentElement.dataset['wails-context-menu-id'];
if (contextMenuId != null) {
break;
}
currentElement = currentElement.parentElement;
}
if (contextMenuId != null || window.disableWailsDefaultContextMenu) {
e.preventDefault();
}
if( contextMenuId != null ) {
let contextData = currentElement.dataset['wails-context-menu-data'];
let message = {
id: contextMenuId,
data: contextData || '',
};
window.wailsContextMenuMessage(JSON.stringify(message));
}
});
}

View File

@ -16,7 +16,7 @@ func main() {
sourceDir := fs.RelativePath("../../../internal/runtime/js")
platforms := []string{"darwin", "windows"}
platforms := []string{"darwin", "windows", "linux"}
for _, platform := range platforms {
println("Building JS Runtime for " + platform)