xcbXorg: Replace display+screen with XConnectionIdentifier

This commit is contained in:
2025-01-14 16:58:22 -04:00
parent 0a6f7feeca
commit a80db04dac
+12 -12
View File
@@ -94,8 +94,7 @@ class AttachedDevice
public:
struct WindowSelector
{
int display;
int screen;
XcbConnection::XConnectionIdentifier xconn;
struct
{
uint32_t id;
@@ -106,8 +105,8 @@ public:
std::string stringify() const
{
std::ostringstream os;
os << "Display: " << display
<< ", Screen: " << screen
os << "Display: " << xconn.display
<< ", Screen: " << xconn.screen
<< ", Window: " << (useWindowId ?
std::to_string(window.id) :
"\"" + window.name + "\"");
@@ -120,8 +119,8 @@ public:
: deviceSpec(spec)
, connection(std::move(conn))
{
windowSelector.display = getRequiredParamAsInt(spec, "display");
windowSelector.screen = getRequiredParamAsInt(spec, "screen");
windowSelector.xconn.display = getRequiredParamAsInt(spec, "display");
windowSelector.xconn.screen = getRequiredParamAsInt(spec, "screen");
parseWindowSelector(spec.deviceSelector, windowSelector);
}
@@ -231,14 +230,15 @@ int xcbXorg_attachDeviceReq(const hk::device::SenseDeviceSpec &desc)
// Create temporary device to validate parameters
AttachedDevice::WindowSelector tempSelector;
tempSelector.display = AttachedDevice::getRequiredParamAsInt(
tempSelector.xconn.display = AttachedDevice::getRequiredParamAsInt(
desc, "display");
tempSelector.screen = AttachedDevice::getRequiredParamAsInt(desc, "screen");
tempSelector.xconn.screen = AttachedDevice::getRequiredParamAsInt(
desc, "screen");
// Get or create connection before constructing device
XcbConnection::XConnectionIdentifier id{
tempSelector.display,
tempSelector.screen
tempSelector.xconn.display,
tempSelector.xconn.screen
};
auto conn = XcbConnection::getOrCreateConnection(id);
@@ -281,8 +281,8 @@ int xcbXorg_detachDeviceReq(const hk::device::SenseDeviceSpec &spec)
}
XcbConnection::XConnectionIdentifier id{
it->windowSelector.display,
it->windowSelector.screen
it->windowSelector.xconn.display,
it->windowSelector.xconn.screen
};
// Atomic decrement refcount