From b2b000597a5624da6274759b3ea39dca2f39e4a1 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Fri, 16 Jul 2021 22:44:33 +0200 Subject: [PATCH] CIrrDeviceOSX: drop all video mode code --- source/Irrlicht/CIrrDeviceOSX.h | 4 -- source/Irrlicht/CIrrDeviceOSX.mm | 113 +------------------------------ 2 files changed, 3 insertions(+), 114 deletions(-) diff --git a/source/Irrlicht/CIrrDeviceOSX.h b/source/Irrlicht/CIrrDeviceOSX.h index 7c34ce4..7f0591d 100644 --- a/source/Irrlicht/CIrrDeviceOSX.h +++ b/source/Irrlicht/CIrrDeviceOSX.h @@ -95,10 +95,6 @@ namespace irr //! Activate any joysticks, and generate events for them. virtual bool activateJoysticks(core::array & joystickInfo) _IRR_OVERRIDE_; - //! \return Returns a pointer to a list with all video modes - //! supported by the gfx adapter. - virtual video::IVideoModeList* getVideoModeList() _IRR_OVERRIDE_; - //! Get the device type virtual E_DEVICE_TYPE getType() const _IRR_OVERRIDE_ { diff --git a/source/Irrlicht/CIrrDeviceOSX.mm b/source/Irrlicht/CIrrDeviceOSX.mm index b17cefd..dea86d9 100644 --- a/source/Irrlicht/CIrrDeviceOSX.mm +++ b/source/Irrlicht/CIrrDeviceOSX.mm @@ -597,8 +597,6 @@ CIrrDeviceMacOSX::CIrrDeviceMacOSX(const SIrrlichtCreationParameters& param) initKeycodes(); - VideoModeList->setDesktop(CreationParams.Bits, core::dimension2d([[NSScreen mainScreen] frame].size.width, [[NSScreen mainScreen] frame].size.height)); - bool success = true; if (CreationParams.DriverType != video::EDT_NULL) @@ -638,9 +636,6 @@ void CIrrDeviceMacOSX::closeDevice() [Window release]; Window = nil; } - - if (IsFullscreen) - CGReleaseAllDisplays(); IsFullscreen = false; IsActive = false; @@ -660,7 +655,8 @@ bool CIrrDeviceMacOSX::createWindow() const NSBackingStoreType type = (CreationParams.DriverType == video::EDT_OPENGL) ? NSBackingStoreBuffered : NSBackingStoreNonretained; - if (!CreationParams.Fullscreen) + // TODO: fullscreen + //if (!CreationParams.Fullscreen) { if (!CreationParams.WindowId) //create another window when WindowId is null { @@ -684,66 +680,6 @@ bool CIrrDeviceMacOSX::createWindow() result = true; } - else - { - IsFullscreen = true; - - displaymode = CGDisplayCopyDisplayMode(Display); - - CFArrayRef Modes = CGDisplayCopyAllDisplayModes(Display, NULL); - - for(int i = 0; i < CFArrayGetCount(Modes); ++i) - { - CGDisplayModeRef CurrentMode = (CGDisplayModeRef)CFArrayGetValueAtIndex(Modes, i); - - u8 Depth = 0; - - CFStringRef pixEnc = CGDisplayModeCopyPixelEncoding(CurrentMode); - - if (CFStringCompare(pixEnc, CFSTR(IO32BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) - Depth = 32; - else if(CFStringCompare(pixEnc, CFSTR(IO16BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) - Depth = 16; - else if(CFStringCompare(pixEnc, CFSTR(IO8BitIndexedPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) - Depth = 8; - - if(Depth == CreationParams.Bits) - if((CGDisplayModeGetWidth(CurrentMode) == CreationParams.WindowSize.Width) && (CGDisplayModeGetHeight(CurrentMode) == CreationParams.WindowSize.Height)) - { - displaymode = CurrentMode; - break; - } - } - - if (displaymode != NULL) - { - olddisplaymode = CGDisplayCopyDisplayMode(Display); - - error = CGCaptureAllDisplays(); - if (error == CGDisplayNoErr) - { - error = CGDisplaySetDisplayMode(Display, displaymode, NULL); - - if (error == CGDisplayNoErr) - { - Window = [[NSWindow alloc] initWithContentRect:[[NSScreen mainScreen] frame] styleMask:NSBorderlessWindowMask backing:type defer:FALSE screen:[NSScreen mainScreen]]; - - [Window setLevel: CGShieldingWindowLevel()]; - [Window setBackgroundColor:[NSColor blackColor]]; - - displayRect = CGDisplayBounds(Display); - ScreenWidth = DeviceWidth = (int)displayRect.size.width; - ScreenHeight = DeviceHeight = (int)displayRect.size.height; - CreationParams.WindowSize.set(ScreenWidth, ScreenHeight); - - result = true; - } - - if (!result) - CGReleaseAllDisplays(); - } - } - } if (result) { @@ -754,11 +690,6 @@ bool CIrrDeviceMacOSX::createWindow() [Window setIsVisible:TRUE]; [Window makeKeyAndOrderFront:nil]; } - - if (IsFullscreen) //hide menus in fullscreen mode only - { - [NSApp setPresentationOptions:(NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)]; - } } return result; @@ -1193,6 +1124,7 @@ void CIrrDeviceMacOSX::storeMouseLocation() } else { + // Do we still need this? CGEventRef ourEvent = CGEventCreate(NULL); CGPoint point = CGEventGetLocation(ourEvent); CFRelease(ourEvent); @@ -1203,7 +1135,6 @@ void CIrrDeviceMacOSX::storeMouseLocation() const core::position2di& curr = ((CCursorControl *)CursorControl)->getPosition(true); if (curr.X != x || curr.Y != y) { - // In fullscreen mode, events are not sent regularly so rely on polling irr::SEvent ievent; ievent.EventType = irr::EET_MOUSE_INPUT_EVENT; ievent.MouseInput.Event = irr::EMIE_MOUSE_MOVED; @@ -1745,44 +1676,6 @@ void CIrrDeviceMacOSX::pollJoysticks() #endif // _IRR_COMPILE_WITH_JOYSTICK_EVENTS_ } -video::IVideoModeList* CIrrDeviceMacOSX::getVideoModeList() -{ - if (!VideoModeList->getVideoModeCount()) - { - CGDirectDisplayID display; - display = CGMainDisplayID(); - - CFArrayRef Modes = CGDisplayCopyAllDisplayModes(display, NULL); - - for(int i = 0; i < CFArrayGetCount(Modes); ++i) - { - CGDisplayModeRef CurrentMode = (CGDisplayModeRef)CFArrayGetValueAtIndex(Modes, i); - - u8 Depth = 0; - - CFStringRef pixEnc = CGDisplayModeCopyPixelEncoding(CurrentMode); - - if(CFStringCompare(pixEnc, CFSTR(IO32BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) - Depth = 32; - else - if(CFStringCompare(pixEnc, CFSTR(IO16BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) - Depth = 16; - else - if(CFStringCompare(pixEnc, CFSTR(IO8BitIndexedPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo) - Depth = 8; - - if(Depth) - { - unsigned int Width = CGDisplayModeGetWidth(CurrentMode); - unsigned int Height = CGDisplayModeGetHeight(CurrentMode); - - VideoModeList->addMode(core::dimension2d(Width, Height), Depth); - } - } - } - return VideoModeList; -} - } // end namespace #endif // _IRR_COMPILE_WITH_OSX_DEVICE_