1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:07:47 +00:00

Rage hacking on TerminalWidget.

There's some really hideous plumbing with globals going on here, but my
priority right now is getting a basic VT100 terminal emulator working.
This commit is contained in:
Andreas Kling 2018-10-11 12:33:03 +02:00
parent f282df6617
commit ab5266b924
8 changed files with 136 additions and 15 deletions

View file

@ -3,9 +3,12 @@
#include "Event.h"
#include "Widget.h"
#include <AK/Assertions.h>
#include "TerminalWidget.h"
static AbstractScreen* s_the;
extern TerminalWidget* g_tw;
AbstractScreen& AbstractScreen::the()
{
ASSERT(s_the);
@ -36,7 +39,16 @@ void AbstractScreen::event(Event& event)
//printf("hit test for %d,%d found: %s{%p} %d,%d\n", me.x(), me.y(), result.widget->className(), result.widget, result.localX, result.localY);
auto localEvent = make<MouseEvent>(event.type(), result.localX, result.localY, me.button());
result.widget->event(*localEvent);
return Object::event(event);
}
if (event.type() == Event::KeyDown || event.type() == Event::KeyUp) {
// FIXME: Implement proper focus.
Widget* focusedWidget = g_tw;
return focusedWidget->event(event);
}
return Object::event(event);
}
void AbstractScreen::setRootWidget(Widget* widget)