support retina display
This commit is contained in:
parent
e3eebdf591
commit
3aa9901618
|
@ -50,7 +50,7 @@ public:
|
|||
DSPDebuggerLLE(wxWindow *parent, wxWindowID id = wxID_ANY);
|
||||
virtual ~DSPDebuggerLLE();
|
||||
|
||||
void Refresh();
|
||||
virtual void Refresh();
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
|
|
@ -450,11 +450,26 @@ CFrame::~CFrame()
|
|||
|
||||
bool CFrame::RendererIsFullscreen()
|
||||
{
|
||||
bool fullscreen = false;
|
||||
|
||||
if (Core::GetState() == Core::CORE_RUN || Core::GetState() == Core::CORE_PAUSE)
|
||||
{
|
||||
return m_RenderFrame->IsFullScreen();
|
||||
fullscreen = m_RenderFrame->IsFullScreen();
|
||||
}
|
||||
return false;
|
||||
|
||||
#if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
|
||||
if (m_RenderFrame != NULL)
|
||||
{
|
||||
NSView *view = (NSView *) m_RenderFrame->GetHandle();
|
||||
NSWindow *window = [view window];
|
||||
|
||||
if ([window respondsToSelector:@selector(toggleFullScreen:)]) {
|
||||
fullscreen = (([window styleMask] & NSFullScreenWindowMask) == NSFullScreenWindowMask);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return fullscreen;
|
||||
}
|
||||
|
||||
void CFrame::OnQuit(wxCommandEvent& WXUNUSED (event))
|
||||
|
@ -1002,7 +1017,23 @@ void CFrame::DoFullscreen(bool bF)
|
|||
{
|
||||
ToggleDisplayMode(bF);
|
||||
|
||||
m_RenderFrame->ShowFullScreen(bF, wxFULLSCREEN_ALL);
|
||||
#if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
|
||||
NSView *view = (NSView *) m_RenderFrame->GetHandle();
|
||||
NSWindow *window = [view window];
|
||||
|
||||
if ([window respondsToSelector:@selector(toggleFullScreen:)])
|
||||
{
|
||||
if (bF != RendererIsFullscreen())
|
||||
{
|
||||
[window toggleFullScreen:nil];
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
m_RenderFrame->ShowFullScreen(bF, wxFULLSCREEN_ALL);
|
||||
}
|
||||
|
||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain)
|
||||
{
|
||||
if (bF)
|
||||
|
|
|
@ -29,6 +29,10 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <Cocoa/Cocoa.h>
|
||||
#endif
|
||||
|
||||
#include "CDUtils.h"
|
||||
#include "Debugger/CodeWindow.h"
|
||||
#include "LogWindow.h"
|
||||
|
|
|
@ -876,39 +876,46 @@ void CFrame::ToggleDisplayMode(bool bFullscreen)
|
|||
#elif defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||
m_XRRConfig->ToggleDisplayMode(bFullscreen);
|
||||
#elif defined __APPLE__
|
||||
if (!bFullscreen) {
|
||||
CGRestorePermanentDisplayConfiguration();
|
||||
CGDisplayRelease(CGMainDisplayID());
|
||||
return;
|
||||
}
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
|
||||
NSView *view = (NSView *) m_RenderFrame->GetHandle();
|
||||
NSWindow *window = [view window];
|
||||
|
||||
CFArrayRef modes = CGDisplayAvailableModes(CGMainDisplayID());
|
||||
for (CFIndex i = 0; i < CFArrayGetCount(modes); i++)
|
||||
if (![window respondsToSelector:@selector(toggleFullScreen:)])
|
||||
#endif
|
||||
{
|
||||
CFDictionaryRef mode;
|
||||
CFNumberRef ref;
|
||||
int x, y, w, h, d;
|
||||
if (!bFullscreen) {
|
||||
CGRestorePermanentDisplayConfiguration();
|
||||
CGDisplayRelease(CGMainDisplayID());
|
||||
return;
|
||||
}
|
||||
|
||||
sscanf(SConfig::GetInstance().m_LocalCoreStartupParameter.\
|
||||
strFullscreenResolution.c_str(), "%dx%d", &x, &y);
|
||||
CFArrayRef modes = CGDisplayAvailableModes(CGMainDisplayID());
|
||||
for (CFIndex i = 0; i < CFArrayGetCount(modes); i++)
|
||||
{
|
||||
CFDictionaryRef mode;
|
||||
CFNumberRef ref;
|
||||
int x, y, w, h, d;
|
||||
|
||||
mode = (CFDictionaryRef)CFArrayGetValueAtIndex(modes, i);
|
||||
ref = (CFNumberRef)CFDictionaryGetValue(mode, kCGDisplayWidth);
|
||||
CFNumberGetValue(ref, kCFNumberIntType, &w);
|
||||
ref = (CFNumberRef)CFDictionaryGetValue(mode, kCGDisplayHeight);
|
||||
CFNumberGetValue(ref, kCFNumberIntType, &h);
|
||||
ref = (CFNumberRef)CFDictionaryGetValue(mode,
|
||||
kCGDisplayBitsPerPixel);
|
||||
CFNumberGetValue(ref, kCFNumberIntType, &d);
|
||||
sscanf(SConfig::GetInstance().m_LocalCoreStartupParameter.\
|
||||
strFullscreenResolution.c_str(), "%dx%d", &x, &y);
|
||||
|
||||
if (CFDictionaryContainsKey(mode, kCGDisplayModeIsStretched))
|
||||
continue;
|
||||
if (w != x || h != y || d != 32)
|
||||
continue;;
|
||||
mode = (CFDictionaryRef)CFArrayGetValueAtIndex(modes, i);
|
||||
ref = (CFNumberRef)CFDictionaryGetValue(mode, kCGDisplayWidth);
|
||||
CFNumberGetValue(ref, kCFNumberIntType, &w);
|
||||
ref = (CFNumberRef)CFDictionaryGetValue(mode, kCGDisplayHeight);
|
||||
CFNumberGetValue(ref, kCFNumberIntType, &h);
|
||||
ref = (CFNumberRef)CFDictionaryGetValue(mode,
|
||||
kCGDisplayBitsPerPixel);
|
||||
CFNumberGetValue(ref, kCFNumberIntType, &d);
|
||||
|
||||
CGDisplaySwitchToMode(CGMainDisplayID(), mode);
|
||||
if (CFDictionaryContainsKey(mode, kCGDisplayModeIsStretched))
|
||||
continue;
|
||||
if (w != x || h != y || d != 32)
|
||||
continue;;
|
||||
|
||||
CGDisplaySwitchToMode(CGMainDisplayID(), mode);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -968,6 +975,14 @@ void CFrame::StartGame(const std::string& filename)
|
|||
m_RenderFrame->Show();
|
||||
}
|
||||
|
||||
#if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
|
||||
NSView *view = (NSView *) m_RenderFrame->GetHandle();
|
||||
NSWindow *window = [view window];
|
||||
|
||||
if ([window respondsToSelector:@selector(setCollectionBehavior:)])
|
||||
[window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
|
||||
#endif
|
||||
|
||||
wxBeginBusyCursor();
|
||||
|
||||
DoFullscreen(SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen);
|
||||
|
@ -1140,8 +1155,23 @@ void CFrame::DoStop()
|
|||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
|
||||
m_RenderParent->SetCursor(wxNullCursor);
|
||||
DoFullscreen(false);
|
||||
|
||||
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain)
|
||||
{
|
||||
m_RenderFrame->Destroy();
|
||||
}
|
||||
#if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
|
||||
else
|
||||
{
|
||||
// Disable the full screen button when not in a game.
|
||||
NSView *view = (NSView *) m_RenderFrame->GetHandle();
|
||||
NSWindow *window = [view window];
|
||||
|
||||
if ([window respondsToSelector:@selector(setCollectionBehavior:)])
|
||||
[window setCollectionBehavior:NSWindowCollectionBehaviorDefault];
|
||||
}
|
||||
#endif
|
||||
|
||||
m_RenderParent = NULL;
|
||||
|
||||
// Clean framerate indications from the status bar.
|
||||
|
|
|
@ -680,7 +680,7 @@ void TASInputDlg::OnCloseWindow(wxCloseEvent& event)
|
|||
}
|
||||
}
|
||||
|
||||
bool TASInputDlg::HasFocus()
|
||||
bool TASInputDlg::HasFocus() const
|
||||
{
|
||||
//allows numbers to be used as hotkeys
|
||||
if(TextBoxHasFocus())
|
||||
|
@ -695,7 +695,7 @@ bool TASInputDlg::HasFocus()
|
|||
return false;
|
||||
}
|
||||
|
||||
bool TASInputDlg::TextBoxHasFocus()
|
||||
bool TASInputDlg::TextBoxHasFocus() const
|
||||
{
|
||||
if(wxWindow::FindFocus() == wx_mainX_t)
|
||||
return true;
|
||||
|
|
|
@ -45,8 +45,8 @@ class TASInputDlg : public wxDialog
|
|||
void SetTurboFalse(wxMouseEvent& event);
|
||||
void ButtonTurbo();
|
||||
void GetKeyBoardInput(SPADStatus *PadStatus);
|
||||
bool TextBoxHasFocus();
|
||||
bool HasFocus();
|
||||
virtual bool TextBoxHasFocus() const;
|
||||
virtual bool HasFocus() const;
|
||||
|
||||
wxBitmap CreateStickBitmap(int x, int y);
|
||||
|
||||
|
|
|
@ -252,6 +252,14 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
|
|||
wxFlexGridSizer* const szr_display = new wxFlexGridSizer(2, 5, 5);
|
||||
|
||||
{
|
||||
|
||||
#if defined(__APPLE__) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
|
||||
NSView *view = (NSView *) parent->GetHandle();
|
||||
NSWindow *window = [view window];
|
||||
|
||||
if (![window respondsToSelector:@selector(toggleFullScreen:)])
|
||||
#endif
|
||||
|
||||
// display resolution
|
||||
{
|
||||
wxArrayString res_list = GetListOfResolutions();
|
||||
|
|
Loading…
Reference in New Issue