#include "Window.h" #include "Layer.h" #include #include #include #include #include void Window::draw(ui::Canvas& screen) { dirty = false; auto window = screen.subcanvas(surface); window.copy(pixels, surface.width); } void Window::focus() { // Bring the window to the front of the list. layer->windows.remove(this); layer->windows.append(this); } Window::Window(ui::Rect r, RefString&& n) : surface(r), name(move(n)) { auto font = ui::Font::default_font(); titlebar = ui::Rect { 0, 0, 0, 0 }; l_global.windows.append(this); layer = &l_global; } Window::~Window() { usize size = surface.width * surface.height * 4; munmap(pixels, size); }