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.setCursorPos(cursorPos.x, cursorPos.y);
target.setTextColor(currentTextColor); target.setTextColor(currentTextColor);
target.setBackgroundColor(currentBgColor); target.setBackgroundColor(currentBgColor);
target.setCursorBlink(cursorBlink);
} }
private function safeWriteScreenBuffer(pos:Pos, char:String) { 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 onMouseScroll(default, null):Signal<{dir:Int, pos:Pos}>;
public var onMouseUp(default, null):Signal<{button:ButtonType, pos:Pos}>; public var onMouseUp(default, null):Signal<{button:ButtonType, pos:Pos}>;
public var onPaste(default, null):Signal<String>; 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 onClickTrigger:SignalTrigger<{button:ButtonType, pos:Pos}>;
@:allow(kernel.ui.WindowManager) private final onKeyTrigger:SignalTrigger<{keyCode:Int, isHeld:Bool}>; @: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 onMouseScrollTrigger:SignalTrigger<{dir:Int, pos:Pos}>;
@:allow(kernel.ui.WindowManager) private final onMouseUpTrigger:SignalTrigger<{button:ButtonType, 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 onPasteTrigger:SignalTrigger<String>;
@:allow(kernel.ui.WindowManager) private final onCharTrigger:SignalTrigger<String>;
@:allow(kernel.ui.WindowManager) @:allow(kernel.ui.WindowManager)
private function new(writer:VirtualTermWriter) { private function new(writer:VirtualTermWriter) {
@ -42,6 +44,7 @@ class WindowContext implements TermWriteable {
this.onMouseScrollTrigger = Signal.trigger(); this.onMouseScrollTrigger = Signal.trigger();
this.onMouseUpTrigger = Signal.trigger(); this.onMouseUpTrigger = Signal.trigger();
this.onPasteTrigger = Signal.trigger(); this.onPasteTrigger = Signal.trigger();
this.onCharTrigger = Signal.trigger();
this.onClick = onClickTrigger.asSignal(); this.onClick = onClickTrigger.asSignal();
this.onKey = onKeyTrigger.asSignal(); this.onKey = onKeyTrigger.asSignal();
@ -50,6 +53,7 @@ class WindowContext implements TermWriteable {
this.onMouseScroll = onMouseScrollTrigger.asSignal(); this.onMouseScroll = onMouseScrollTrigger.asSignal();
this.onMouseUp = onMouseUpTrigger.asSignal(); this.onMouseUp = onMouseUpTrigger.asSignal();
this.onPaste = onPasteTrigger.asSignal(); this.onPaste = onPasteTrigger.asSignal();
this.onChar = onCharTrigger.asSignal();
} }
public var onResize(default, null):Signal<Vec2<Int>>; public var onResize(default, null):Signal<Vec2<Int>>;

View File

@ -64,6 +64,12 @@ class WindowManager {
KernelEvents.instance.onMonitorTouch.handle(params -> { KernelEvents.instance.onMonitorTouch.handle(params -> {
// TODO // TODO
}); });
KernelEvents.instance.onChar.handle(char -> {
if (currentMainContext != null) {
currentMainContext.onCharTrigger.trigger(char);
}
});
} }
public function createNewContext():WindowContext { public function createNewContext():WindowContext {