5#include "private/qcapturablewindow_p.h"
6#include "QtCore/private/qcore_mac_p.h"
8#include <AppKit/NSWindow.h>
16 CGWindowListCopyWindowInfo(kCGWindowListOptionOnScreenOnly, kCGNullWindowID));
19 CFIndex
count = CFArrayGetCount(windowList);
20 for (CFIndex
i = 0;
i <
count; ++
i) {
21 auto windowInfo = (CFDictionaryRef)CFArrayGetValueAtIndex(windowList,
i);
22 auto windowNumber = (CFNumberRef)CFDictionaryGetValue(windowInfo, kCGWindowNumber);
23 auto windowName = (CFStringRef)CFDictionaryGetValue(windowInfo, kCGWindowName);
25 CGWindowID windowId = 0;
26 static_assert(
sizeof(windowId) == 4,
27 "CGWindowID size is not compatible with kCFNumberSInt32Type");
28 CFNumberGetValue(windowNumber, kCFNumberSInt32Type, &windowId);
30 auto windowData = std::make_unique<QCapturableWindowPrivate>();
33 windowData->description = QString::fromCFString(windowName);
35 result.push_back(windowData.release()->create());
44 CGWindowListCreate(kCGWindowListOptionIncludingWindow,
window.id));
45 return CFArrayGetCount(windowList) > 0;
bool isWindowValid(const QCapturableWindowPrivate &window) const override
QList< QCapturableWindow > windows() const override
Combined button and popup list for selecting options.
GLenum GLenum GLsizei count