Add log messages to indicate display numbers for KMS and Wlgrab

This commit is contained in:
Cameron Gutman 2024-03-01 20:51:50 -06:00
parent 75a97883e7
commit 1ab30aa70b
2 changed files with 16 additions and 3 deletions

View File

@ -145,10 +145,13 @@ namespace platf {
};
struct monitor_t {
// Connector attributes
std::uint32_t type;
std::uint32_t index;
// Monitor index in the global list
std::uint32_t monitor_index;
platf::touch_port_t viewport;
};
@ -1516,11 +1519,11 @@ namespace platf {
correlate_to_wayland(std::vector<kms::card_descriptor_t> &cds) {
auto monitors = wl::monitors();
BOOST_LOG(info) << "-------- Start of KMS monitor list --------"sv;
for (auto &monitor : monitors) {
std::string_view name = monitor->name;
BOOST_LOG(info) << name << ": "sv << monitor->description;
// Try to convert names in the format:
// {type}-{index}
// {index} is n'th occurrence of {type}
@ -1553,6 +1556,7 @@ namespace platf {
<< monitor->viewport.width << 'x' << monitor->viewport.height;
}
BOOST_LOG(info) << "Monitor " << monitor_descriptor.monitor_index << " is "sv << name << ": "sv << monitor->description;
goto break_for_loop;
}
}
@ -1561,6 +1565,8 @@ namespace platf {
BOOST_LOG(verbose) << "Reduced to name: "sv << name << ": "sv << index;
}
BOOST_LOG(info) << "--------- End of KMS monitor list ---------"sv;
}
// A list of names of displays accepted as display_name
@ -1637,6 +1643,7 @@ namespace platf {
(int) crtc->width,
(int) crtc->height,
};
it->second.monitor_index = count;
}
kms::env_width = std::max(kms::env_width, (int) (crtc->x + crtc->width));

View File

@ -424,15 +424,21 @@ namespace platf {
display.roundtrip();
BOOST_LOG(info) << "-------- Start of Wayland monitor list --------"sv;
for (int x = 0; x < interface.monitors.size(); ++x) {
auto monitor = interface.monitors[x].get();
wl::env_width = std::max(wl::env_width, (int) (monitor->viewport.offset_x + monitor->viewport.width));
wl::env_height = std::max(wl::env_height, (int) (monitor->viewport.offset_y + monitor->viewport.height));
BOOST_LOG(info) << "Monitor " << x << " is "sv << monitor->name << ": "sv << monitor->description;
display_names.emplace_back(std::to_string(x));
}
BOOST_LOG(info) << "--------- End of Wayland monitor list ---------"sv;
return display_names;
}