Changeset View
Changeset View
Standalone View
Standalone View
backends/xrandr/xrandr.cpp
Show First 20 Lines • Show All 245 Lines • ▼ Show 20 Line(s) | 235 | { | |||
---|---|---|---|---|---|
246 | } else { | 246 | } else { | ||
247 | result = nullptr; | 247 | result = nullptr; | ||
248 | } | 248 | } | ||
249 | 249 | | |||
250 | free(reply); | 250 | free(reply); | ||
251 | return result; | 251 | return result; | ||
252 | } | 252 | } | ||
253 | 253 | | |||
254 | quint8 *XRandR::outputEdid(xcb_randr_output_t outputId, size_t &len) | 254 | QByteArray XRandR::outputEdid(xcb_randr_output_t outputId) | ||
255 | { | 255 | { | ||
256 | size_t len = 0; | ||||
256 | quint8 *result; | 257 | quint8 *result; | ||
257 | 258 | | |||
258 | auto edid_atom = XCB::InternAtom(false, 4, "EDID")->atom; | 259 | auto edid_atom = XCB::InternAtom(false, 4, "EDID")->atom; | ||
259 | result = XRandR::getXProperty(outputId, edid_atom, len); | 260 | result = XRandR::getXProperty(outputId, edid_atom, len); | ||
260 | if (result == nullptr) { | 261 | if (result == nullptr) { | ||
261 | auto edid_atom = XCB::InternAtom(false, 9, "EDID_DATA")->atom; | 262 | auto edid_atom = XCB::InternAtom(false, 9, "EDID_DATA")->atom; | ||
262 | result = XRandR::getXProperty(outputId, edid_atom, len); | 263 | result = XRandR::getXProperty(outputId, edid_atom, len); | ||
263 | } | 264 | } | ||
264 | if (result == nullptr) { | 265 | if (result == nullptr) { | ||
265 | auto edid_atom = XCB::InternAtom(false, 25, "XFree86_DDC_EDID1_RAWDATA")->atom; | 266 | auto edid_atom = XCB::InternAtom(false, 25, "XFree86_DDC_EDID1_RAWDATA")->atom; | ||
266 | result = XRandR::getXProperty(outputId, edid_atom, len); | 267 | result = XRandR::getXProperty(outputId, edid_atom, len); | ||
267 | } | 268 | } | ||
268 | 269 | | |||
269 | if (result) { | 270 | QByteArray edid; | ||
271 | if (result != nullptr) { | ||||
270 | if (len % 128 == 0) { | 272 | if (len % 128 == 0) { | ||
271 | return result; | 273 | edid = QByteArray((char *) result, len); | ||
zzag: reinterpret_cast<char*>(result) | |||||
I agree, but there are more places with c-style casts, let's clean them all up in one go. This is just moving things. gladhorn: I agree, but there are more places with c-style casts, let's clean them all up in one go. This… | |||||
272 | } else { | | |||
273 | len = 0; | | |||
274 | delete[] result; | | |||
275 | } | 274 | } | ||
275 | delete[] result; | ||||
It would be great to use QScopedPointer, but that would be unrelated change, I guess. zzag: It would be great to use QScopedPointer, but that would be unrelated change, I guess. | |||||
276 | } | 276 | } | ||
277 | 277 | return edid; | |||
278 | return nullptr; | | |||
279 | } | 278 | } | ||
280 | 279 | | |||
281 | xcb_randr_get_screen_resources_reply_t* XRandR::screenResources() | 280 | xcb_randr_get_screen_resources_reply_t* XRandR::screenResources() | ||
282 | { | 281 | { | ||
283 | if (XRandR::s_has_1_3) { | 282 | if (XRandR::s_has_1_3) { | ||
284 | if (XRandR::s_xorgCacheInitialized) { | 283 | if (XRandR::s_xorgCacheInitialized) { | ||
285 | // HACK: This abuses the fact that xcb_randr_get_screen_resources_reply_t | 284 | // HACK: This abuses the fact that xcb_randr_get_screen_resources_reply_t | ||
286 | // and xcb_randr_get_screen_resources_current_reply_t are the same | 285 | // and xcb_randr_get_screen_resources_current_reply_t are the same | ||
Show All 26 Lines |
reinterpret_cast<char*>(result)