select output on home context
This commit is contained in:
parent
788c839937
commit
2937de86d6
@ -1,5 +1,7 @@
|
|||||||
package lib;
|
package lib;
|
||||||
|
|
||||||
|
import kernel.peripherals.Screen;
|
||||||
|
import kernel.peripherals.Peripherals.Peripheral;
|
||||||
import kernel.ps.Process;
|
import kernel.ps.Process;
|
||||||
import kernel.ps.ProcessManager;
|
import kernel.ps.ProcessManager;
|
||||||
import bin.KernelLog;
|
import bin.KernelLog;
|
||||||
@ -24,6 +26,9 @@ class HomeContext {
|
|||||||
private var requestRender: Void->Void;
|
private var requestRender: Void->Void;
|
||||||
private var renderer:RootElement;
|
private var renderer:RootElement;
|
||||||
|
|
||||||
|
private var selectedOutput:String = "main";
|
||||||
|
private var selectedOutputIndex:Int = -1;
|
||||||
|
|
||||||
public function new() {}
|
public function new() {}
|
||||||
|
|
||||||
public function run() {
|
public function run() {
|
||||||
@ -71,7 +76,7 @@ class HomeContext {
|
|||||||
|
|
||||||
private function focusContext(id:Int) {
|
private function focusContext(id:Int) {
|
||||||
if (workspaces.exists(id)) {
|
if (workspaces.exists(id)) {
|
||||||
WindowManager.instance.focusContextToOutput(workspaces[id], "main");
|
WindowManager.instance.focusContextToOutput(workspaces[id], selectedOutput);
|
||||||
currentWorkspace = id;
|
currentWorkspace = id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -102,6 +107,27 @@ class HomeContext {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
focusContext(lastContextID);
|
focusContext(lastContextID);
|
||||||
|
|
||||||
|
if (selectedOutputIndex != -1) {
|
||||||
|
requestRender();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function cycleOutput() {
|
||||||
|
var screenAddr = Peripheral.instance.findAddrByType(Screen.TYPE_NAME);
|
||||||
|
|
||||||
|
if (selectedOutputIndex == -1) {
|
||||||
|
selectedOutputIndex = 0;
|
||||||
|
selectedOutput = screenAddr[selectedOutputIndex];
|
||||||
|
} else if (selectedOutputIndex >= screenAddr.length - 1) {
|
||||||
|
selectedOutputIndex = -1;
|
||||||
|
selectedOutput = "main";
|
||||||
|
} else {
|
||||||
|
selectedOutputIndex++;
|
||||||
|
selectedOutput = screenAddr[selectedOutputIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
requestRender();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function render() {
|
private function render() {
|
||||||
@ -118,6 +144,7 @@ class HomeContext {
|
|||||||
children.push(new TextElement('Add Terminal', {onClick: this.spawnPs.bind(new Terminal())}));
|
children.push(new TextElement('Add Terminal', {onClick: this.spawnPs.bind(new Terminal())}));
|
||||||
children.push(new TextElement('Add Log', {onClick: this.spawnPs.bind(new KernelLog())}));
|
children.push(new TextElement('Add Log', {onClick: this.spawnPs.bind(new KernelLog())}));
|
||||||
children.push(new TextElement('Exit', {onClick: KernelEvents.instance.shutdown}));
|
children.push(new TextElement('Exit', {onClick: KernelEvents.instance.shutdown}));
|
||||||
|
children.push(new TextElement('Output :${selectedOutput}', {onClick: this.cycleOutput}));
|
||||||
|
|
||||||
renderer.setChildren(children);
|
renderer.setChildren(children);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user