From 1881d8f488a8d61b3fbaa1b5b45ec1b2992eaa2e Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Fri, 4 Mar 2022 00:59:32 +0100 Subject: [PATCH] minor ui stuff --- src/kernel/ui/WindowContext.hx | 6 +++++- src/kernel/ui/WindowManager.hx | 5 +---- src/lib/TermIO.hx | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/kernel/ui/WindowContext.hx b/src/kernel/ui/WindowContext.hx index 2ed431c..1a60928 100644 --- a/src/kernel/ui/WindowContext.hx +++ b/src/kernel/ui/WindowContext.hx @@ -7,6 +7,9 @@ import kernel.ButtonType; import util.Vec.Vec2; import lib.TermWriteable; +/** + The main object you interact with when writing anything to the screen. +**/ class WindowContext implements TermWriteable { private final writer:VirtualTermWriter; @@ -26,7 +29,8 @@ class WindowContext implements TermWriteable { @:allow(kernel.ui.WindowManager) private final mouseUpTrigger:SignalTrigger<{button:ButtonType, pos:Vec2}>; @:allow(kernel.ui.WindowManager) private final pasteTrigger:SignalTrigger; - public function new(writer:VirtualTermWriter) { + @:allow(kernel.ui.WindowManager) + private function new(writer:VirtualTermWriter) { this.writer = writer; this.onResize = writer.onResize; diff --git a/src/kernel/ui/WindowManager.hx b/src/kernel/ui/WindowManager.hx index a58e72a..efb749b 100644 --- a/src/kernel/ui/WindowManager.hx +++ b/src/kernel/ui/WindowManager.hx @@ -67,10 +67,6 @@ class WindowManager { allContexts.push(newContext); - // newContext.setTarget(MainTerm.instance); - newContext.enable(); - currentMainContext = newContext; - return newContext; } @@ -84,6 +80,7 @@ class WindowManager { var target:TermWriteable; if (output == "main") { target = MainTerm.instance; + currentMainContext = context; } else { target = Peripheral.instance.getScreen(output); diff --git a/src/lib/TermIO.hx b/src/lib/TermIO.hx index 365999e..6cc457b 100644 --- a/src/lib/TermIO.hx +++ b/src/lib/TermIO.hx @@ -12,7 +12,7 @@ class TermIO { public function new(output:TermWriteable) { this.output = output; - output.clear(); + output.reset(); output.setCursorPos(0, 0); }