MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / main

Function main

Applications/Shell/main.cpp:113–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111void MinimizeMenu(bool s);
112
113int main(){
114 handle_t svc = Lemon::CreateService("lemon.shell");
115 shell = new ShellInstance(svc, "Instance");
116
117 syscall(SYS_GET_VIDEO_MODE, (uintptr_t)&videoInfo,0,0,0,0);
118 syscall(SYS_UNAME, (uintptr_t)versionString,0,0,0,0);
119
120 Lemon::Graphics::LoadImage("/initrd/menubuttons.png", &menuButton);
121
122 handle_t tempEndpoint = 0;
123 while(tempEndpoint <= 0){
124 tempEndpoint = Lemon::InterfaceConnect("lemon.lemonwm/Instance");
125 } // Wait for LemonWM to create the interface (if not already created)
126 Lemon::DestroyKObject(tempEndpoint);
127
128 taskbar = new Lemon::GUI::Window("", {static_cast<int>(videoInfo.width), 32}, WINDOW_FLAGS_NODECORATION | WINDOW_FLAGS_NOSHELL, Lemon::GUI::WindowType::GUI, {0, static_cast<int>(videoInfo.height) - 32});
129 taskbar->OnPaint = OnTaskbarPaint;
130 taskbar->rootContainer.background = {0, 0, 0, 0};
131 taskbarWindowsContainer = new Lemon::GUI::LayoutContainer({40, 0, static_cast<int>(videoInfo.width) - 104, static_cast<int>(videoInfo.height)}, {160, 32 - 4});
132 taskbarWindowsContainer->background = {0, 0, 0, 0};
133 taskbar->AddWidget(taskbarWindowsContainer);
134
135 shell->AddWindow = AddWindow;
136 shell->RemoveWindow = RemoveWindow;
137
138 InitializeMenu();
139
140 taskbar->InitializeShellConnection();
141
142 Lemon::Waiter waiter;
143 waiter.WaitOnAll(&shell->GetInterface());
144 waiter.WaitOn(taskbar);
145 waiter.WaitOn(menuWindow);
146
147 for(;;){
148 shell->Update();
149
150 Lemon::LemonEvent ev;
151 while(taskbar->PollEvent(ev)){
152 if(ev.event == Lemon::EventMouseReleased){
153 if(ev.mousePos.x < 100){
154 showMenu = !showMenu;
155
156 MinimizeMenu(!showMenu);
157 } else {
158 taskbar->GUIHandleEvent(ev);
159 }
160 } else {
161 taskbar->GUIHandleEvent(ev);
162 }
163 paintTaskbar = true;
164 }
165
166 PollMenu();
167
168 uint64_t usedMemLast = sysInfo.usedMem;
169 sysInfo = Lemon::SysInfo();
170

Callers

nothing calls this directly

Calls 15

CreateServiceFunction · 0.85
InterfaceConnectFunction · 0.85
DestroyKObjectFunction · 0.85
InitializeMenuFunction · 0.85
MinimizeMenuFunction · 0.85
PollMenuFunction · 0.85
WaitOnAllMethod · 0.80
WaitOnMethod · 0.80
PollEventMethod · 0.80
GUIHandleEventMethod · 0.80
LoadImageFunction · 0.50
SysInfoFunction · 0.50

Tested by

no test coverage detected