Luna/gui/wind/Window.cpp
apio fb3333a086
All checks were successful
Build and test / build (push) Successful in 1m38s
wind: Remove special window attributes and add different window layers.
Two layers are accessible to all apps: global and global_top (for popups and similar windows).
Three other layers are accessible to privileged clients (background, system and lock), for things that need to be on a different level than user apps, like the taskbar, system popups, menus and the lock screen.
2024-12-13 21:53:12 +01:00

38 lines
756 B
C++

#include "Window.h"
#include "Layer.h"
#include <luna/Utf8.h>
#include <os/File.h>
#include <sys/mman.h>
#include <ui/Font.h>
#include <ui/Image.h>
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);
}