Changeset View
Changeset View
Standalone View
Standalone View
backends/xrandr/xrandr.cpp
Show First 20 Lines • Show All 271 Lines • ▼ Show 20 Line(s) | 271 | if (result != nullptr) { | |||
---|---|---|---|---|---|
272 | if (len % 128 == 0) { | 272 | if (len % 128 == 0) { | ||
273 | edid = QByteArray(reinterpret_cast<const char *>(result), len); | 273 | edid = QByteArray(reinterpret_cast<const char *>(result), len); | ||
274 | } | 274 | } | ||
275 | delete[] result; | 275 | delete[] result; | ||
276 | } | 276 | } | ||
277 | return edid; | 277 | return edid; | ||
278 | } | 278 | } | ||
279 | 279 | | |||
280 | bool XRandR::hasProperty(xcb_randr_output_t output, const QByteArray& name) | ||||
281 | { | ||||
282 | xcb_generic_error_t *error = nullptr; | ||||
283 | auto atom = XCB::InternAtom(false, name.length(), name.constData())->atom; | ||||
284 | auto cookie = xcb_randr_get_output_property(XCB::connection(), output, atom, XCB_ATOM_ANY, 0, 1, false, false); | ||||
285 | auto prop_reply = xcb_randr_get_output_property_reply (XCB::connection(), cookie, &error); | ||||
286 | | ||||
287 | const bool ret = prop_reply->num_items == 1; | ||||
288 | free(prop_reply); | ||||
289 | return ret; | ||||
290 | } | ||||
291 | | ||||
280 | xcb_randr_get_screen_resources_reply_t* XRandR::screenResources() | 292 | xcb_randr_get_screen_resources_reply_t* XRandR::screenResources() | ||
281 | { | 293 | { | ||
282 | if (XRandR::s_has_1_3) { | 294 | if (XRandR::s_has_1_3) { | ||
283 | if (XRandR::s_xorgCacheInitialized) { | 295 | if (XRandR::s_xorgCacheInitialized) { | ||
284 | // HACK: This abuses the fact that xcb_randr_get_screen_resources_reply_t | 296 | // HACK: This abuses the fact that xcb_randr_get_screen_resources_reply_t | ||
285 | // and xcb_randr_get_screen_resources_current_reply_t are the same | 297 | // and xcb_randr_get_screen_resources_current_reply_t are the same | ||
286 | return reinterpret_cast<xcb_randr_get_screen_resources_reply_t*>( | 298 | return reinterpret_cast<xcb_randr_get_screen_resources_reply_t*>( | ||
287 | xcb_randr_get_screen_resources_current_reply(XCB::connection(), | 299 | xcb_randr_get_screen_resources_current_reply(XCB::connection(), | ||
Show All 24 Lines |