Prepare wallpaper changing on macOS
This commit is contained in:
parent
87fcbbb494
commit
74de315eda
|
|
@ -7,15 +7,21 @@
|
||||||
static bool isCached = false;
|
static bool isCached = false;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
static WCHAR szStyle[8] = {0};
|
static WCHAR szStyle[8] = {0};
|
||||||
static WCHAR szTile[8] = {0};
|
static WCHAR szTile[8] = {0};
|
||||||
static WCHAR szFile[MAX_PATH+1] = {0};
|
static WCHAR szFile[MAX_PATH+1] = {0};
|
||||||
static DWORD oldcolor = 0;
|
static DWORD oldcolor = 0;
|
||||||
static DWORD szStyleSize = sizeof(szStyle) - 1;
|
static DWORD szStyleSize = sizeof(szStyle) - 1;
|
||||||
static DWORD szTileSize = sizeof(szTile) - 1;
|
static DWORD szTileSize = sizeof(szTile) - 1;
|
||||||
static bool setStyle = false;
|
static bool setStyle = false;
|
||||||
static bool setTile = false;
|
static bool setTile = false;
|
||||||
|
#else
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#include "mac-desktop.h"
|
||||||
|
#else
|
||||||
|
// XXX Implement me!
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
RB_METHOD(wallpaperSet)
|
RB_METHOD(wallpaperSet)
|
||||||
|
|
@ -93,6 +99,11 @@ end:
|
||||||
if (hKey)
|
if (hKey)
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
#else
|
#else
|
||||||
|
#ifdef __APPLE__
|
||||||
|
// XXX Implement me!
|
||||||
|
#else
|
||||||
|
// XXX Implement me!
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
@ -126,6 +137,11 @@ RB_METHOD(wallpaperReset)
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
#ifdef __APPLE__
|
||||||
|
// XXX Implement me!
|
||||||
|
#else
|
||||||
|
// XXX Implement me!
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
4
mkxp.pro
4
mkxp.pro
|
|
@ -41,8 +41,10 @@ unix {
|
||||||
LIBS += -ldl
|
LIBS += -ldl
|
||||||
macx: {
|
macx: {
|
||||||
INCLUDEPATH += $$QMAKE_MAC_SDK_PATH/System/Library/Frameworks/OpenAL.framework/Versions/A/Headers
|
INCLUDEPATH += $$QMAKE_MAC_SDK_PATH/System/Library/Frameworks/OpenAL.framework/Versions/A/Headers
|
||||||
LIBS += -framework OpenAL
|
LIBS += -framework OpenAL -framework AppKit
|
||||||
QMAKE_LFLAGS += -L/usr/local/opt/ruby@2.3/lib -L/usr/local/opt/openal-soft/lib
|
QMAKE_LFLAGS += -L/usr/local/opt/ruby@2.3/lib -L/usr/local/opt/openal-soft/lib
|
||||||
|
HEADERS += src/mac-desktop.h
|
||||||
|
SOURCES += src/mac-desktop.mm
|
||||||
}
|
}
|
||||||
!macx: {
|
!macx: {
|
||||||
# PKGCONFIG += openal zlib
|
# PKGCONFIG += openal zlib
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
//
|
||||||
|
// SyngleChance Engine - mac-desktop.h
|
||||||
|
// ©2018 Vinyl Darkscratch. You may use this code for anything you'd like.
|
||||||
|
// https://www.queengoob.org
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
bool ChangeBackground(std::string imageURL);
|
||||||
|
bool ResetBackground();
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
//
|
||||||
|
// SyngleChance Engine - mac-desktop.mm
|
||||||
|
// ©2018 Vinyl Darkscratch. You may use this code for anything you'd like.
|
||||||
|
// https://www.queengoob.org
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "mac-desktop.h"
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#import <AppKit/AppKit.h>
|
||||||
|
|
||||||
|
bool ChangeBackground(std::string imageURL) {
|
||||||
|
NSURL *URL = [NSURL fileURLWithPath:@(imageURL.c_str())];
|
||||||
|
NSScreen *mainscreen = [NSScreen mainScreen];
|
||||||
|
NSWorkspace *sharedworkspace = [NSWorkspace sharedWorkspace];
|
||||||
|
|
||||||
|
BOOL success = [sharedworkspace setDesktopImageURL:[URL absoluteURL] forScreen:mainscreen options:[sharedworkspace desktopImageOptionsForScreen:mainscreen] error:nil];
|
||||||
|
return (bool)success;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ResetBackground() {
|
||||||
|
// XXX Implement me!
|
||||||
|
return false;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue