Fix Windows and macOS build errors

Adds to e4b640903d and de5b6f8eb4
This commit is contained in:
Myned 2020-05-23 00:25:30 -04:00
parent 87da123c19
commit f0cf5a5c19
No known key found for this signature in database
GPG Key ID: 24318A323F309244
2 changed files with 41 additions and 2 deletions

View File

@ -26,6 +26,27 @@ void GetWindowList(vector<string> &windows)
}
}
// Overloaded
void GetWindowList(QStringList &windows)
{
windows.clear();
@autoreleasepool {
NSWorkspace *ws = [NSWorkspace sharedWorkspace];
NSArray *array = [ws runningApplications];
for (NSRunningApplication *app in array) {
NSString *name = app.localizedName;
if (!name)
continue;
const char *str = name.UTF8String;
if (str && *str)
windows.emplace_back(str);
windows << QString(str);
}
}
}
void GetCurrentWindowTitle(string &title)
{
title.resize(0);
@ -56,7 +77,8 @@ pair<int, int> getCursorPos()
return pos;
}
bool isFullscreen()
// Argument added in lieu of fullscreen bug fix
bool isFullscreen(std::string &title)
{
@autoreleasepool {
AXValueRef temp;

View File

@ -58,6 +58,22 @@ void GetWindowList(vector<string>& windows)
}
}
// Overloaded
void GetWindowList(QStringList &windows)
{
windows.clear();
HWND window = GetWindow(GetDesktopWindow(), GW_CHILD);
while (window)
{
string title;
if (WindowValid(window) && GetWindowTitle(window, title))
windows << QString::fromStdString(title);
window = GetNextWindow(window, GW_HWNDNEXT);
}
}
void GetCurrentWindowTitle(string& title)
{
HWND window = GetForegroundWindow();
@ -87,7 +103,8 @@ pair<int, int> getCursorPos()
return pos;
}
bool isFullscreen()
// Argument added in lieu of fullscreen bug fix
bool isFullscreen(std::string &title)
{
RECT appBounds;
RECT rc;