mirror of
https://github.com/luanti-org/luanti.git
synced 2025-11-08 11:05:28 +01:00
Remove Irrlicht devices except SDL (#16580)
This commit is contained in:
@@ -20,23 +20,10 @@
|
||||
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||
#include <SDL_clipboard.h>
|
||||
#include <SDL_version.h>
|
||||
#elif defined(_IRR_COMPILE_WITH_X11_DEVICE_)
|
||||
#include "CIrrDeviceLinux.h"
|
||||
#endif
|
||||
#if defined(_IRR_COMPILE_WITH_OSX_DEVICE_)
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#endif
|
||||
|
||||
#include "fast_atof.h"
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_)
|
||||
// constructor linux
|
||||
COSOperator::COSOperator(const core::stringc &osVersion, CIrrDeviceLinux *device) :
|
||||
OperatingSystem(osVersion), IrrDeviceLinux(device)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
// constructor
|
||||
COSOperator::COSOperator(const core::stringc &osVersion) :
|
||||
OperatingSystem(osVersion)
|
||||
@@ -64,43 +51,6 @@ void COSOperator::copyToClipboard(const c8 *text) const
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
|
||||
SDL_SetClipboardText(text);
|
||||
|
||||
#elif defined(_IRR_WINDOWS_API_)
|
||||
if (!OpenClipboard(NULL) || text == 0)
|
||||
return;
|
||||
|
||||
EmptyClipboard();
|
||||
|
||||
core::stringw tempbuffer;
|
||||
core::utf8ToWString(tempbuffer, text);
|
||||
const u32 size = (tempbuffer.size() + 1) * sizeof(wchar_t);
|
||||
|
||||
HGLOBAL clipbuffer;
|
||||
void *buffer;
|
||||
|
||||
clipbuffer = GlobalAlloc(GMEM_MOVEABLE, size);
|
||||
buffer = GlobalLock(clipbuffer);
|
||||
|
||||
memcpy(buffer, tempbuffer.c_str(), size);
|
||||
|
||||
GlobalUnlock(clipbuffer);
|
||||
SetClipboardData(CF_UNICODETEXT, clipbuffer);
|
||||
CloseClipboard();
|
||||
|
||||
#elif defined(_IRR_COMPILE_WITH_OSX_DEVICE_)
|
||||
NSString *str = nil;
|
||||
NSPasteboard *board = nil;
|
||||
|
||||
if ((text != NULL) && (strlen(text) > 0)) {
|
||||
str = [NSString stringWithCString:text encoding:NSUTF8StringEncoding];
|
||||
board = [NSPasteboard generalPasteboard];
|
||||
[board declareTypes:[NSArray arrayWithObject:NSPasteboardTypeString] owner:NSApp];
|
||||
[board setString:str forType:NSPasteboardTypeString];
|
||||
}
|
||||
|
||||
#elif defined(_IRR_COMPILE_WITH_X11_DEVICE_)
|
||||
if (IrrDeviceLinux)
|
||||
IrrDeviceLinux->copyToClipboard(text);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -114,10 +64,6 @@ void COSOperator::copyToPrimarySelection(const c8 *text) const
|
||||
#if SDL_VERSION_ATLEAST(2, 25, 0)
|
||||
SDL_SetPrimarySelectionText(text);
|
||||
#endif
|
||||
|
||||
#elif defined(_IRR_COMPILE_WITH_X11_DEVICE_)
|
||||
if (IrrDeviceLinux)
|
||||
IrrDeviceLinux->copyToPrimarySelection(text);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -128,42 +74,6 @@ const c8 *COSOperator::getTextFromClipboard() const
|
||||
SDL_free(ClipboardSelectionText);
|
||||
ClipboardSelectionText = SDL_GetClipboardText();
|
||||
return ClipboardSelectionText;
|
||||
|
||||
#elif defined(_IRR_WINDOWS_API_)
|
||||
if (!OpenClipboard(NULL))
|
||||
return 0;
|
||||
|
||||
HANDLE hData = GetClipboardData(CF_UNICODETEXT);
|
||||
if (hData == NULL) // Probably not in Unicode text format
|
||||
return 0;
|
||||
|
||||
wchar_t *buffer = (wchar_t *)GlobalLock(hData);
|
||||
|
||||
core::wStringToUTF8(ClipboardBuf, buffer);
|
||||
|
||||
GlobalUnlock(hData);
|
||||
CloseClipboard();
|
||||
|
||||
return ClipboardBuf.c_str();
|
||||
|
||||
#elif defined(_IRR_COMPILE_WITH_OSX_DEVICE_)
|
||||
NSString *str = nil;
|
||||
NSPasteboard *board = nil;
|
||||
char *result = 0;
|
||||
|
||||
board = [NSPasteboard generalPasteboard];
|
||||
str = [board stringForType:NSPasteboardTypeString];
|
||||
|
||||
if (str != nil)
|
||||
result = (char *)[str cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
|
||||
return (result);
|
||||
|
||||
#elif defined(_IRR_COMPILE_WITH_X11_DEVICE_)
|
||||
if (IrrDeviceLinux)
|
||||
return IrrDeviceLinux->getTextFromClipboard();
|
||||
return 0;
|
||||
|
||||
#else
|
||||
|
||||
return 0;
|
||||
@@ -181,11 +91,6 @@ const c8 *COSOperator::getTextFromPrimarySelection() const
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
#elif defined(_IRR_COMPILE_WITH_X11_DEVICE_)
|
||||
if (IrrDeviceLinux)
|
||||
return IrrDeviceLinux->getTextFromPrimarySelection();
|
||||
return 0;
|
||||
|
||||
#else
|
||||
|
||||
return 0;
|
||||
@@ -238,7 +143,6 @@ bool COSOperator::getSystemMemory(u32 *Total, u32 *Avail) const
|
||||
*Avail = (u32)(physical_memory >> 10); // we don't know better
|
||||
return true;
|
||||
#else
|
||||
// TODO: implement for others
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user