Archived
Private
Public Access
1
0

A few bug fixes

This commit is contained in:
2022-11-19 14:05:37 +01:00
parent 46afa9cb7a
commit b1cfd89d20
6 changed files with 52 additions and 27 deletions

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="dataSourceStorageLocal" created-in="RD-222.4167.23"> <component name="dataSourceStorageLocal" created-in="RD-222.4459.9">
<data-source name="WebDesktop" uuid="95aba07a-0fe8-4ac6-bdce-406f8acafcd0"> <data-source name="WebDesktop" uuid="95aba07a-0fe8-4ac6-bdce-406f8acafcd0">
<database-info product="MariaDB" version="10.3.34-MariaDB-0+deb10u1" jdbc-version="4.2" driver-name="MariaDB Connector/J" driver-version="2.7.3" dbms="MARIADB" exact-version="10.3.34" exact-driver-version="2.7"> <database-info product="MariaDB" version="10.3.34-MariaDB-0+deb10u1" jdbc-version="4.2" driver-name="MariaDB Connector/J" driver-version="2.7.3" dbms="MARIADB" exact-version="10.3.34" exact-driver-version="2.7">
<extra-name-characters>#@</extra-name-characters> <extra-name-characters>#@</extra-name-characters>

View File

@@ -6,23 +6,12 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="041c7675-58ae-4243-af88-0d29855e558f" name="Changes" comment=""> <list default="true" id="041c7675-58ae-4243-af88-0d29855e558f" name="Changes" comment="">
<change afterPath="$PROJECT_DIR$/WindowAPI_Test/favicon.ico" afterDir="false" /> <change afterPath="$PROJECT_DIR$/global.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/.idea.WebDesktop 2.0/.idea/dataSources.local.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.WebDesktop 2.0/.idea/dataSources.local.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/.idea.WebDesktop 2.0/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.WebDesktop 2.0/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/.idea.WebDesktop 2.0/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.WebDesktop 2.0/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Frontend/package-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/Frontend/package-lock.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Frontend/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/Frontend/package.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Frontend/src/app/components/window-wrapper/window-wrapper.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/Frontend/src/app/components/window-wrapper/window-wrapper.component.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Frontend/src/app/components/window-wrapper/window-wrapper.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/Frontend/src/app/components/window-wrapper/window-wrapper.component.ts" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Frontend/src/app/components/window-wrapper/window-wrapper.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/Frontend/src/app/components/window-wrapper/window-wrapper.component.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Frontend/src/app/sites/desktop/desktop.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/Frontend/src/app/sites/desktop/desktop.component.ts" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Frontend/src/app/sites/desktop/desktop.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/Frontend/src/app/sites/desktop/desktop.component.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Frontend/src/app/sites/desktop/taskbar-icon/taskbar-icon.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/Frontend/src/app/sites/desktop/taskbar-icon/taskbar-icon.component.ts" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Frontend/src/app/sites/desktop/taskbar-icon/taskbar-icon.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/Frontend/src/app/sites/desktop/taskbar-icon/taskbar-icon.component.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/WindowAPI/package-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/WindowAPI/package-lock.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/WindowAPI/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/WindowAPI/package.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/WindowAPI/src/WindowAPI.ts" beforeDir="false" afterPath="$PROJECT_DIR$/WindowAPI/src/WindowAPI.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/WindowAPI/src/helper/PackageTypes.ts" beforeDir="false" afterPath="$PROJECT_DIR$/WindowAPI/src/helper/PackageTypes.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/WindowAPI/src/helper/functions/Getter.ts" beforeDir="false" afterPath="$PROJECT_DIR$/WindowAPI/src/helper/functions/Getter.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/WindowAPI_Test/index.html" beforeDir="false" afterPath="$PROJECT_DIR$/WindowAPI_Test/index.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/WindowAPI_Test/package-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/WindowAPI_Test/package-lock.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/WindowAPI_Test/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/WindowAPI_Test/package.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/WindowAPI_Test/window.html" beforeDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -147,7 +136,9 @@
<workItem from="1666637982263" duration="7093000" /> <workItem from="1666637982263" duration="7093000" />
<workItem from="1667640438195" duration="3462000" /> <workItem from="1667640438195" duration="3462000" />
<workItem from="1667643992968" duration="576000" /> <workItem from="1667643992968" duration="576000" />
<workItem from="1667644608215" duration="2392000" /> <workItem from="1667644608215" duration="2578000" />
<workItem from="1668608627802" duration="886000" />
<workItem from="1668609549396" duration="872000" />
</task> </task>
<task id="LOCAL-00001" summary="Finished Login / Register system"> <task id="LOCAL-00001" summary="Finished Login / Register system">
<created>1662545562560</created> <created>1662545562560</created>
@@ -177,7 +168,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1666645149547</updated> <updated>1666645149547</updated>
</task> </task>
<option name="localTasksCounter" value="5" /> <task id="LOCAL-00005" summary="Implemented Backend WindowAPI">
<created>1667647154337</created>
<option name="number" value="00005" />
<option name="presentableId" value="LOCAL-00005" />
<option name="project" value="LOCAL" />
<updated>1667647154337</updated>
</task>
<option name="localTasksCounter" value="6" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
@@ -206,6 +204,7 @@
<MESSAGE value="Finished window system" /> <MESSAGE value="Finished window system" />
<MESSAGE value="Finished WindowAPI for the frontend" /> <MESSAGE value="Finished WindowAPI for the frontend" />
<MESSAGE value="Added .gitignore files" /> <MESSAGE value="Added .gitignore files" />
<option name="LAST_COMMIT_MESSAGE" value="Added .gitignore files" /> <MESSAGE value="Implemented Backend WindowAPI" />
<option name="LAST_COMMIT_MESSAGE" value="Implemented Backend WindowAPI" />
</component> </component>
</project> </project>

View File

@@ -4,6 +4,19 @@ import {TaskbarIcon} from "../../sites/desktop/taskbar-icon/taskbar-icon.compone
import {Package} from "webdesktop_windowapi/dist/helper/Package"; import {Package} from "webdesktop_windowapi/dist/helper/Package";
import {WindowEvent} from "webdesktop_windowapi/dist/helper/EventData"; import {WindowEvent} from "webdesktop_windowapi/dist/helper/EventData";
class StaticPromise<T> {
public readonly innerPromise: Promise<T>;
public reject: (reason?: any) => void;
public resolve: (value: (T | PromiseLike<T>)) => void;
public constructor() {
this.innerPromise = new Promise<T>((resolve1, reject1) => {
this.reject = reject1;
this.resolve = resolve1;
});
}
}
@Component({ @Component({
selector: 'app-window-wrapper', selector: 'app-window-wrapper',
templateUrl: './window-wrapper.component.html', templateUrl: './window-wrapper.component.html',
@@ -24,6 +37,7 @@ export class WindowWrapper {
public resizable: boolean = true; public resizable: boolean = true;
public asPopup: boolean; public asPopup: boolean;
public args: string[]; public args: string[];
public globalAwait: StaticPromise<void>;
public resizeIcon: string = "fullscreen"; public resizeIcon: string = "fullscreen";
public maximized: boolean = false; public maximized: boolean = false;
@@ -36,7 +50,8 @@ export class WindowWrapper {
window.addEventListener('message', this.messageHandler); window.addEventListener('message', this.messageHandler);
} }
public initialize(taskbar: TaskbarIcon, args: string[], asPopup: boolean) { public initialize(taskbar: TaskbarIcon, args: string[], asPopup: boolean): Promise<void> {
this.globalAwait = new StaticPromise<void>();
this.title = this.program.name; this.title = this.program.name;
this.args = args; this.args = args;
this.asPopup = asPopup; this.asPopup = asPopup;
@@ -45,6 +60,7 @@ export class WindowWrapper {
this.taskbar = taskbar; this.taskbar = taskbar;
this.content.nativeElement.src = this.program.handlerUrl; this.content.nativeElement.src = this.program.handlerUrl;
this.focus(); this.focus();
return this.globalAwait.innerPromise;
} }
public close() { public close() {
@@ -122,6 +138,7 @@ export class WindowWrapper {
} }
public applyContentListeners(content: HTMLIFrameElement) { public applyContentListeners(content: HTMLIFrameElement) {
// TODO: Handle inFrame events
/*content.contentWindow.addEventListener('mousemove', this.onMove.bind(this)); /*content.contentWindow.addEventListener('mousemove', this.onMove.bind(this));
content.contentWindow.addEventListener('mousedown', this.focus.bind(this)); content.contentWindow.addEventListener('mousedown', this.focus.bind(this));
content.contentWindow.addEventListener('mouseup', this.resizeHandler?.windowResizeStop.bind(this.resizeHandler));*/ content.contentWindow.addEventListener('mouseup', this.resizeHandler?.windowResizeStop.bind(this.resizeHandler));*/
@@ -132,6 +149,8 @@ export class WindowWrapper {
this.dispatchEvent({type: "openAsPopup", data: this.args}); this.dispatchEvent({type: "openAsPopup", data: this.args});
else else
this.dispatchEvent({type: "open", data: this.args}); this.dispatchEvent({type: "open", data: this.args});
this.globalAwait.resolve();
} }
public onMove(event: MouseEvent) { public onMove(event: MouseEvent) {
@@ -139,7 +158,7 @@ export class WindowWrapper {
this.resizeHandler?.windowResize(event); this.resizeHandler?.windowResize(event);
} }
private onMessage(event: MessageEvent) { private async onMessage(event: MessageEvent) {
const iframe = this.content.nativeElement as HTMLIFrameElement; const iframe = this.content.nativeElement as HTMLIFrameElement;
if (event.source != iframe.contentWindow) return; if (event.source != iframe.contentWindow) return;
@@ -152,9 +171,9 @@ export class WindowWrapper {
this.handleSet(data); this.handleSet(data);
} }
else if (data.method == 'action') { else if (data.method == 'action') {
const pkg: Package = {method: "action", content: this.handleAction(data)}; const pkg: Package = {method: "action", content: await this.handleAction(data)};
if (data.action != 'closeSelf' && (data.action == 'closeWindow' && data.content.uuid == this.uuid)) if (data.action != 'closeSelf' && (data.action == 'closeWindow' && data.content.uuid != this.uuid))
iframe.contentWindow.postMessage(pkg, event.origin); iframe.contentWindow.postMessage(pkg, event.origin);
} }
} }
@@ -232,7 +251,7 @@ export class WindowWrapper {
} }
} }
private handleAction(data: Package): any { private async handleAction(data: Package): Promise<any> {
switch (data.action) { switch (data.action) {
case "openWindow": case "openWindow":
return DesktopComponent.instance.openProgram(data.content.identifier, data.content.args, data.content.asPopup); return DesktopComponent.instance.openProgram(data.content.identifier, data.content.args, data.content.asPopup);

View File

@@ -61,7 +61,7 @@ export class DesktopComponent implements OnInit {
}); });
} }
public openProgram(programUUID: string, args?: string[], asPopup?: boolean): number { public openProgram(programUUID: string, args?: string[], asPopup?: boolean): Promise<number> {
const program = programs[programUUID]; const program = programs[programUUID];
const exists = this.getTaskbarIcon(programUUID) != undefined; const exists = this.getTaskbarIcon(programUUID) != undefined;

View File

@@ -21,22 +21,22 @@ export class TaskbarIcon {
this.type = type; this.type = type;
} }
public openProgram(args?: string[], asPopup: boolean = false): number { public async openProgram(args?: string[], asPopup: boolean = false): Promise<number> {
const window = DesktopComponent.windowContainer.createComponent(WindowWrapper); const window = DesktopComponent.windowContainer.createComponent(WindowWrapper);
window.instance.program = this.type.program; window.instance.program = this.type.program;
DesktopComponent.instance.cdr.detectChanges(); DesktopComponent.instance.cdr.detectChanges();
window.instance.initialize(this, args || [], asPopup); await window.instance.initialize(this, args || [], asPopup);
this.windows.push(window.instance); this.windows.push(window.instance);
this.setIndicator('wide'); this.setIndicator('wide');
return window.instance.uuid; return window.instance.uuid;
} }
public onTaskbarClick(event: MouseEvent) { public async onTaskbarClick(event: MouseEvent) {
if (this.instancesOpen) return; if (this.instancesOpen) return;
if (this.windows.length == 0 || event.shiftKey) { if (this.windows.length == 0 || event.shiftKey) {
this.openProgram(); await this.openProgram();
return; return;
} }

7
global.json Normal file
View File

@@ -0,0 +1,7 @@
{
"sdk": {
"version": "6.0.0",
"rollForward": "latestMajor",
"allowPrerelease": true
}
}