fixed missing char event in windowContext

This commit is contained in:
Djeeberjr 2022-12-15 14:20:46 +01:00
parent 209e40d0d5
commit 1863462b44
3 changed files with 11 additions and 0 deletions

View File

@ -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) {

View File

@ -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<String>;
public var onChar(default, null):Signal<String>;
@: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<String>;
@:allow(kernel.ui.WindowManager) private final onCharTrigger:SignalTrigger<String>;
@: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<Vec2<Int>>;

View File

@ -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 {