MCPcopy Create free account
hub / github.com/KDE/kwin / xineramaIndexToOutput

Method xineramaIndexToOutput

src/workspace.cpp:2596–2623  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2594
2595#if KWIN_BUILD_X11
2596LogicalOutput *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
2626void Workspace::updateOutputOrder()

Callers 4

indexToOutputMethod · 0.80
manageMethod · 0.80
startupIdChangedMethod · 0.80

Calls 4

kwinAppFunction · 0.85
atomNameFunction · 0.85
x11RootWindowMethod · 0.80
getMethod · 0.45

Tested by 1

indexToOutputMethod · 0.64