| 2594 | |
| 2595 | #if KWIN_BUILD_X11 |
| 2596 | LogicalOutput *Workspace::xineramaIndexToOutput(int index) const |
| 2597 | { |
| 2598 | xcb_connection_t *connection = kwinApp()->x11Connection(); |
| 2599 | if (!connection) { |
| 2600 | return nullptr; |
| 2601 | } |
| 2602 | |
| 2603 | xcb_randr_get_monitors_cookie_t cookie = xcb_randr_get_monitors(kwinApp()->x11Connection(), kwinApp()->x11RootWindow(), 1); |
| 2604 | const UniqueCPtr<xcb_randr_get_monitors_reply_t> monitors(xcb_randr_get_monitors_reply(kwinApp()->x11Connection(), cookie, nullptr)); |
| 2605 | if (!monitors) { |
| 2606 | return nullptr; |
| 2607 | } |
| 2608 | |
| 2609 | xcb_randr_monitor_info_t *monitorInfo = nullptr; |
| 2610 | for (auto it = xcb_randr_get_monitors_monitors_iterator(monitors.get()); it.rem; xcb_randr_monitor_info_next(&it)) { |
| 2611 | const int current = monitors->nMonitors - it.rem; |
| 2612 | if (current == index) { |
| 2613 | monitorInfo = it.data; |
| 2614 | break; |
| 2615 | } |
| 2616 | } |
| 2617 | |
| 2618 | if (!monitorInfo) { |
| 2619 | return nullptr; |
| 2620 | } |
| 2621 | |
| 2622 | return findOutput(Xcb::atomName(monitorInfo->name)); |
| 2623 | } |
| 2624 | #endif |
| 2625 | |
| 2626 | void Workspace::updateOutputOrder() |