use process on KernelLog
This commit is contained in:
parent
2da337b8a9
commit
8dca828cf3
@ -1,5 +1,7 @@
|
|||||||
package bin;
|
package bin;
|
||||||
|
|
||||||
|
import kernel.ps.ProcessHandle;
|
||||||
|
import kernel.ps.Process;
|
||||||
import lib.Color;
|
import lib.Color;
|
||||||
import lib.MathI;
|
import lib.MathI;
|
||||||
import kernel.log.Log;
|
import kernel.log.Log;
|
||||||
@ -8,24 +10,22 @@ import lib.ui.UIApp;
|
|||||||
|
|
||||||
using tink.CoreApi;
|
using tink.CoreApi;
|
||||||
|
|
||||||
class KernelLog extends UIApp{
|
class KernelLog implements Process {
|
||||||
private var ctx:WindowContext;
|
private var handle: ProcessHandle;
|
||||||
private var exitTrigger: Bool -> Void;
|
private var ctx: WindowContext;
|
||||||
|
|
||||||
public function new() {}
|
public function new() {}
|
||||||
|
|
||||||
public function invoke(context:WindowContext):Future<Bool> {
|
public function run(handle: ProcessHandle):Void {
|
||||||
this.ctx = context;
|
this.handle = handle;
|
||||||
|
|
||||||
|
var statelessCtx = handle.createStatelessWindowContext();
|
||||||
|
this.ctx = statelessCtx.ctx;
|
||||||
|
|
||||||
|
statelessCtx.setRenderFunc(this.render);
|
||||||
|
|
||||||
Log.instance.onLog.handle(()->{
|
Log.instance.onLog.handle(()->{
|
||||||
render();
|
statelessCtx.requestRender();
|
||||||
});
|
|
||||||
|
|
||||||
render();
|
|
||||||
|
|
||||||
return new Future<Bool>(cb -> {
|
|
||||||
this.exitTrigger = cb;
|
|
||||||
return null;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package lib;
|
package lib;
|
||||||
|
|
||||||
|
import kernel.ps.ProcessManager;
|
||||||
import bin.KernelLog;
|
import bin.KernelLog;
|
||||||
import lib.ui.elements.UIElement;
|
import lib.ui.elements.UIElement;
|
||||||
import lib.ui.elements.TextElement;
|
import lib.ui.elements.TextElement;
|
||||||
@ -104,17 +105,20 @@ class HomeContext {
|
|||||||
|
|
||||||
|
|
||||||
private function addLog(){
|
private function addLog(){
|
||||||
var newContext = WindowManager.instance.createNewBufferedContext();
|
var pid = ProcessManager.run(new KernelLog(),{
|
||||||
|
|
||||||
// Create new terminal
|
});
|
||||||
var term = new KernelLog();
|
|
||||||
term.invoke(newContext);
|
|
||||||
|
|
||||||
var contextID = addContextNextWorkspace(newContext);
|
var lastContextID = -1;
|
||||||
if (contextID == -1) {
|
|
||||||
|
for ( ctx in WindowManager.instance.getContextByPID(pid)){
|
||||||
|
lastContextID = addContextNextWorkspace(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lastContextID == -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
focusContext(contextID);
|
focusContext(lastContextID);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function render() {
|
private function render() {
|
||||||
|
Loading…
Reference in New Issue
Block a user