mirror of
https://github.com/SFML/SFML.git
synced 2024-11-24 20:31:05 +08:00
Stop using identifiers with __
prefix
This commit is contained in:
parent
35653dacc5
commit
119ea42e0a
@ -41,7 +41,7 @@
|
||||
namespace sf::priv
|
||||
{
|
||||
|
||||
using IOHIDElements = std::vector<CFPtr<__IOHIDElement>>;
|
||||
using IOHIDElements = std::vector<CFPtr<IOHIDElementRef>>;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief sf::priv::InputImpl helper
|
||||
@ -247,7 +247,7 @@ private:
|
||||
/// \return a retained, non-empty __CFSet pointer of IOHIDDeviceRef or a null pointer
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CFPtr<const __CFSet> copyDevices(std::uint32_t page, std::uint32_t usage);
|
||||
CFPtr<CFSetRef> copyDevices(std::uint32_t page, std::uint32_t usage);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check if a key is pressed
|
||||
@ -287,8 +287,8 @@ private:
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
CFPtr<__IOHIDManager> m_manager{}; ///< Underlying HID Manager
|
||||
bool m_keysInitialized{}; ///< Has initializeKeyboard been called at least once?
|
||||
CFPtr<IOHIDManagerRef> m_manager; ///< Underlying HID Manager
|
||||
bool m_keysInitialized{}; ///< Has initializeKeyboard been called at least once?
|
||||
EnumArray<Keyboard::Scancode, IOHIDElements, Keyboard::ScancodeCount> m_keys; ///< All the keys on any connected keyboard
|
||||
EnumArray<Keyboard::Key, Keyboard::Scancode, Keyboard::KeyCount> m_keyToScancodeMapping{}; ///< Mapping from Key to Scancode
|
||||
EnumArray<Keyboard::Scancode, Keyboard::Key, Keyboard::ScancodeCount> m_scancodeToKeyMapping{}; ///< Mapping from Scancode to Key
|
||||
|
@ -78,11 +78,11 @@ CFDictionaryRef HIDInputManager::copyDevicesMask(std::uint32_t page, std::uint32
|
||||
&kCFTypeDictionaryValueCallBacks);
|
||||
|
||||
// Add the page value.
|
||||
auto value = CFPtr<const __CFNumber>(CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &page));
|
||||
auto value = CFPtr<CFNumberRef>(CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &page));
|
||||
CFDictionarySetValue(dict, CFSTR(kIOHIDDeviceUsagePageKey), value.get());
|
||||
|
||||
// Add the usage value (which is only valid if page value exists).
|
||||
value = CFPtr<const __CFNumber>(CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &usage));
|
||||
value = CFPtr<CFNumberRef>(CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &usage));
|
||||
CFDictionarySetValue(dict, CFSTR(kIOHIDDeviceUsageKey), value.get());
|
||||
|
||||
return dict;
|
||||
@ -710,7 +710,7 @@ String HIDInputManager::getDescription(Keyboard::Scancode code)
|
||||
HIDInputManager::HIDInputManager()
|
||||
{
|
||||
// Create an HID Manager reference
|
||||
m_manager = CFPtr<__IOHIDManager>(IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone));
|
||||
m_manager = CFPtr<IOHIDManagerRef>(IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone));
|
||||
const IOReturn openStatus = IOHIDManagerOpen(m_manager.get(), kIOHIDOptionsTypeNone);
|
||||
|
||||
if (openStatus != kIOReturnSuccess)
|
||||
@ -770,8 +770,7 @@ void HIDInputManager::initializeKeyboard()
|
||||
////////////////////////////////////////////////////////////
|
||||
void HIDInputManager::loadKeyboard(IOHIDDeviceRef keyboard)
|
||||
{
|
||||
const auto underlying = CFPtr<const __CFArray>(
|
||||
IOHIDDeviceCopyMatchingElements(keyboard, nullptr, kIOHIDOptionsTypeNone));
|
||||
const auto underlying = CFPtr<CFArrayRef>(IOHIDDeviceCopyMatchingElements(keyboard, nullptr, kIOHIDOptionsTypeNone));
|
||||
if ((underlying == nullptr) || (CFArrayGetCount(underlying.get()) == 0))
|
||||
{
|
||||
err() << "Detected a keyboard without any keys." << std::endl;
|
||||
@ -809,7 +808,7 @@ void HIDInputManager::buildMappings()
|
||||
m_scancodeToKeyMapping.fill(Keyboard::Key::Unknown);
|
||||
|
||||
// Get the current keyboard layout
|
||||
const auto tis = CFPtr<__TISInputSource>(TISCopyCurrentKeyboardLayoutInputSource());
|
||||
const auto tis = CFPtr<TISInputSourceRef>(TISCopyCurrentKeyboardLayoutInputSource());
|
||||
const auto* layoutData = static_cast<CFDataRef>(TISGetInputSourceProperty(tis.get(), kTISPropertyUnicodeKeyLayoutData));
|
||||
|
||||
if (layoutData == nullptr)
|
||||
@ -927,14 +926,14 @@ void HIDInputManager::freeUp()
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
CFPtr<const __CFSet> HIDInputManager::copyDevices(std::uint32_t page, std::uint32_t usage)
|
||||
CFPtr<CFSetRef> HIDInputManager::copyDevices(std::uint32_t page, std::uint32_t usage)
|
||||
{
|
||||
// Filter and keep only the requested devices
|
||||
const auto mask = CFPtr<const __CFDictionary>(copyDevicesMask(page, usage));
|
||||
const auto mask = CFPtr<CFDictionaryRef>(copyDevicesMask(page, usage));
|
||||
|
||||
IOHIDManagerSetDeviceMatching(m_manager.get(), mask.get());
|
||||
|
||||
auto devices = CFPtr<const __CFSet>(IOHIDManagerCopyDevices(m_manager.get()));
|
||||
auto devices = CFPtr<CFSetRef>(IOHIDManagerCopyDevices(m_manager.get()));
|
||||
if (devices == nullptr)
|
||||
return nullptr;
|
||||
|
||||
|
@ -61,9 +61,9 @@ unsigned int HIDJoystickManager::getJoystickCount()
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
CFPtr<const __CFSet> HIDJoystickManager::copyJoysticks()
|
||||
CFPtr<CFSetRef> HIDJoystickManager::copyJoysticks()
|
||||
{
|
||||
return CFPtr<const __CFSet>(IOHIDManagerCopyDevices(m_manager));
|
||||
return CFPtr<CFSetRef>(IOHIDManagerCopyDevices(m_manager));
|
||||
}
|
||||
|
||||
|
||||
@ -72,14 +72,14 @@ HIDJoystickManager::HIDJoystickManager()
|
||||
{
|
||||
m_manager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone);
|
||||
|
||||
const auto mask0 = CFPtr<const __CFDictionary>(
|
||||
const auto mask0 = CFPtr<CFDictionaryRef>(
|
||||
HIDInputManager::copyDevicesMask(kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick));
|
||||
|
||||
const auto mask1 = CFPtr<const __CFDictionary>(
|
||||
const auto mask1 = CFPtr<CFDictionaryRef>(
|
||||
HIDInputManager::copyDevicesMask(kHIDPage_GenericDesktop, kHIDUsage_GD_GamePad));
|
||||
|
||||
std::array maskArray = {mask0.get(), mask1.get()};
|
||||
const auto mask = CFPtr<const __CFArray>(
|
||||
const auto mask = CFPtr<CFArrayRef>(
|
||||
CFArrayCreate(nullptr, reinterpret_cast<const void**>(maskArray.data()), maskArray.size(), nullptr));
|
||||
|
||||
IOHIDManagerSetDeviceMatchingMultiple(m_manager, mask.get());
|
||||
|
@ -78,7 +78,7 @@ public:
|
||||
/// \return a retained __CFSet pointer of IOHIDDeviceRef or a null pointer
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CFPtr<const __CFSet> copyJoysticks();
|
||||
CFPtr<CFSetRef> copyJoysticks();
|
||||
|
||||
private:
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -212,7 +212,7 @@ void setMousePosition(Vector2i position)
|
||||
const CGPoint pos = CGPointMake(position.x / scale, position.y / scale);
|
||||
|
||||
// Place the cursor.
|
||||
const auto event = CFPtr<__CGEvent>(
|
||||
const auto event = CFPtr<CGEventRef>(
|
||||
CGEventCreateMouseEvent(nullptr,
|
||||
kCGEventMouseMoved,
|
||||
pos,
|
||||
|
@ -132,7 +132,7 @@ bool JoystickImpl::isConnected(unsigned int index)
|
||||
if (connectedCount > openedCount)
|
||||
{
|
||||
// Get all devices
|
||||
const auto devices = CFPtr<const __CFSet>(HIDJoystickManager::getInstance().copyJoysticks());
|
||||
const auto devices = CFPtr<CFSetRef>(HIDJoystickManager::getInstance().copyJoysticks());
|
||||
|
||||
if (devices != nullptr)
|
||||
{
|
||||
@ -209,7 +209,7 @@ bool JoystickImpl::open(unsigned int index)
|
||||
m_identification.productId = getDeviceUint(self, CFSTR(kIOHIDProductIDKey), m_index);
|
||||
|
||||
// Get a list of all elements attached to the device.
|
||||
const auto elements = CFPtr<const __CFArray>(IOHIDDeviceCopyMatchingElements(self, nullptr, kIOHIDOptionsTypeNone));
|
||||
const auto elements = CFPtr<CFArrayRef>(IOHIDDeviceCopyMatchingElements(self, nullptr, kIOHIDOptionsTypeNone));
|
||||
|
||||
if (elements == nullptr)
|
||||
return false;
|
||||
@ -218,7 +218,7 @@ bool JoystickImpl::open(unsigned int index)
|
||||
const CFIndex elementsCount = CFArrayGetCount(elements.get());
|
||||
for (int i = 0; i < elementsCount; ++i)
|
||||
{
|
||||
auto element = std::shared_ptr(CFPtr<__IOHIDElement>(
|
||||
auto element = std::shared_ptr(CFPtr<IOHIDElementRef>(
|
||||
static_cast<IOHIDElementRef>(const_cast<void*>(CFArrayGetValueAtIndex(elements.get(), i)))));
|
||||
switch (IOHIDElementGetUsagePage(element.get()))
|
||||
{
|
||||
|
@ -28,6 +28,7 @@
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
|
||||
|
||||
namespace sf::priv
|
||||
@ -50,5 +51,5 @@ struct CFDeleter
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
using CFPtr = std::unique_ptr<T, CFDeleter>;
|
||||
using CFPtr = std::unique_ptr<std::remove_pointer_t<T>, CFDeleter>;
|
||||
} // namespace sf::priv
|
||||
|
@ -44,7 +44,7 @@ std::vector<VideoMode> VideoModeImpl::getFullscreenModes()
|
||||
std::vector<VideoMode> modes;
|
||||
|
||||
// Retrieve all modes available for main screen only.
|
||||
const auto cgmodes = CFPtr<const __CFArray>(CGDisplayCopyAllDisplayModes(CGMainDisplayID(), nullptr));
|
||||
const auto cgmodes = CFPtr<CFArrayRef>(CGDisplayCopyAllDisplayModes(CGMainDisplayID(), nullptr));
|
||||
|
||||
if (cgmodes == nullptr)
|
||||
{
|
||||
|
@ -39,7 +39,7 @@ namespace sf::priv
|
||||
unsigned int modeBitsPerPixel(CGDisplayModeRef mode)
|
||||
{
|
||||
// Compare encoding.
|
||||
const auto pixEnc = CFPtr<const __CFString>(CGDisplayModeCopyPixelEncoding(mode));
|
||||
const auto pixEnc = CFPtr<CFStringRef>(CGDisplayModeCopyPixelEncoding(mode));
|
||||
if (CFStringCompare(pixEnc.get(), CFSTR(IO32BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo)
|
||||
return 32;
|
||||
if (CFStringCompare(pixEnc.get(), CFSTR(IO16BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo)
|
||||
|
Loading…
Reference in New Issue
Block a user