From 1863462b44d4eaa1ab1e92077d8212eddcd9e1c6 Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Thu, 15 Dec 2022 14:20:46 +0100 Subject: [PATCH] fixed missing char event in windowContext --- src/kernel/ui/TermBuffer.hx | 1 + src/kernel/ui/WindowContext.hx | 4 ++++ src/kernel/ui/WindowManager.hx | 6 ++++++ 3 files changed, 11 insertions(+) diff --git a/src/kernel/ui/TermBuffer.hx b/src/kernel/ui/TermBuffer.hx index 5619c98..a8797e0 100644 --- a/src/kernel/ui/TermBuffer.hx +++ b/src/kernel/ui/TermBuffer.hx @@ -89,6 +89,7 @@ class TermBuffer implements TermWriteable { target.setCursorPos(cursorPos.x, cursorPos.y); target.setTextColor(currentTextColor); target.setBackgroundColor(currentBgColor); + target.setCursorBlink(cursorBlink); } private function safeWriteScreenBuffer(pos:Pos, char:String) { diff --git a/src/kernel/ui/WindowContext.hx b/src/kernel/ui/WindowContext.hx index 4611fdf..e494034 100644 --- a/src/kernel/ui/WindowContext.hx +++ b/src/kernel/ui/WindowContext.hx @@ -21,6 +21,7 @@ class WindowContext implements TermWriteable { public var onMouseScroll(default, null):Signal<{dir:Int, pos:Pos}>; public var onMouseUp(default, null):Signal<{button:ButtonType, pos:Pos}>; public var onPaste(default, null):Signal; + public var onChar(default, null):Signal; @:allow(kernel.ui.WindowManager) private final onClickTrigger:SignalTrigger<{button:ButtonType, pos:Pos}>; @:allow(kernel.ui.WindowManager) private final onKeyTrigger:SignalTrigger<{keyCode:Int, isHeld:Bool}>; @@ -29,6 +30,7 @@ class WindowContext implements TermWriteable { @:allow(kernel.ui.WindowManager) private final onMouseScrollTrigger:SignalTrigger<{dir:Int, pos:Pos}>; @:allow(kernel.ui.WindowManager) private final onMouseUpTrigger:SignalTrigger<{button:ButtonType, pos:Pos}>; @:allow(kernel.ui.WindowManager) private final onPasteTrigger:SignalTrigger; + @:allow(kernel.ui.WindowManager) private final onCharTrigger:SignalTrigger; @:allow(kernel.ui.WindowManager) private function new(writer:VirtualTermWriter) { @@ -42,6 +44,7 @@ class WindowContext implements TermWriteable { this.onMouseScrollTrigger = Signal.trigger(); this.onMouseUpTrigger = Signal.trigger(); this.onPasteTrigger = Signal.trigger(); + this.onCharTrigger = Signal.trigger(); this.onClick = onClickTrigger.asSignal(); this.onKey = onKeyTrigger.asSignal(); @@ -50,6 +53,7 @@ class WindowContext implements TermWriteable { this.onMouseScroll = onMouseScrollTrigger.asSignal(); this.onMouseUp = onMouseUpTrigger.asSignal(); this.onPaste = onPasteTrigger.asSignal(); + this.onChar = onCharTrigger.asSignal(); } public var onResize(default, null):Signal>; diff --git a/src/kernel/ui/WindowManager.hx b/src/kernel/ui/WindowManager.hx index ea5fb2d..6ccc777 100644 --- a/src/kernel/ui/WindowManager.hx +++ b/src/kernel/ui/WindowManager.hx @@ -64,6 +64,12 @@ class WindowManager { KernelEvents.instance.onMonitorTouch.handle(params -> { // TODO }); + + KernelEvents.instance.onChar.handle(char -> { + if (currentMainContext != null) { + currentMainContext.onCharTrigger.trigger(char); + } + }); } public function createNewContext():WindowContext {