Bind GPU panel to 5,6,7,8,9,0 and fully implement multi-GPU support

This commit is contained in:
romner-set
2023-05-19 16:42:32 +02:00
parent 22a463976d
commit 01acfd603e
8 changed files with 154 additions and 105 deletions

View File

@@ -103,18 +103,21 @@ namespace Term {
bool mem = boxes.find("mem") != string::npos;
bool net = boxes.find("net") != string::npos;
bool proc = boxes.find("proc") != string::npos;
bool gpu = boxes.find("gpu") != string::npos and not Gpu::gpu_names.empty();
int width = 0;
bool gpu = 0;
if (not Gpu::gpu_names.empty())
for (char i = '0'; i <= '5'; ++i)
gpu += (boxes.find(std::string("gpu") + i) != string::npos);
int width = 0;
if (mem) width = Mem::min_width;
else if (net) width = Mem::min_width;
width += (proc ? Proc::min_width : 0);
if (cpu and width < Cpu::min_width) width = Cpu::min_width;
if (gpu and width < Gpu::min_width) width = Gpu::min_width;
if (gpu != 0 and width < Gpu::min_width) width = Gpu::min_width;
int height = (cpu ? Cpu::min_height : 0);
if (proc) height += Proc::min_height;
else height += (mem ? Mem::min_height : 0) + (net ? Net::min_height : 0);
if (gpu) height += Gpu::min_height;
if (gpu != 0) height += Gpu::min_height*gpu;
return { width, height };
}