foundry
Foundry OS: the operating system built on the Rustbelt kernel
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | //! tile [N] -- draw a tiling-window-manager mock-up on /dev/fb0.
//!
//! tile 4 "windows" in a dwindle layout, the text console in the first
//! tile 6 1 to 6 windows
//! tile -r give the text console the whole screen back
//!
//! A hint of the compositor planned for later (think Hyprland): a gradient
//! wallpaper, windows with gaps between them and a border, the focused one
//! cyan. The "windows" are only coloured rectangles, except the first one,
//! which is where the kernel's text console moves to (FB_SET_CONSOLE), so
//! the shell keeps working inside it.
//!
//! How it talks to the framebuffer (no mmap yet, so no direct pointer):
//! ioctl(FB_GET_INFO) width, height, bytes per row, bits per pixel
//! lseek + write raw 0x00RRGGBB pixels (the wallpaper rows)
//! ioctl(FB_FILL) fill a rectangle with one colour (fast)
//! ioctl(FB_FLUSH) send the changed part to the screen
extern crate alloc;
use vec;
use Vec;
use *;
const GAP: u32 = 10; // space between windows and around the screen edge
const BORDER: u32 = 3;
const ACTIVE: u32 = 0x33ccff; // focused window border (cyan)
const INACTIVE: u32 = 0x595959; // the other borders (gray)
/// Window contents: soft pastels (the first window is the console).
const COLORS: = ;
/// Split the screen like a "dwindle" layout: each window takes half of
/// what is left, alternating left|right and top/bottom splits.
/// A vertical gradient, written 8 rows (32 KiB) at a time with lseek +
/// write. (Programs only have a 64 KiB heap until mmap exists.)
/// Dark blue at the top to purple at the bottom.
/// Fill a window with `color` and draw some darker bars, like lines of text.
|