Move fullscreen display resolution control to the GUI with the rest of the fullscreen toggling code. This removes redundancy of code that was in several places through the various video plugins. Unfortunately it means the fullscreen resolution setting also had to be moved to the main configuration dialog. I am sure that will meet some resistance.

Also added a window size setting for windowed mode.

Also pulled some X11 specific code out into a separate file.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5395 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice 2010-04-22 04:28:34 +00:00
parent 8eb21d1bac
commit 140332c02e
30 changed files with 634 additions and 556 deletions

View File

@ -378,6 +378,7 @@ if sys.platform == 'darwin':
else:
env['HAVE_X11'] = conf.CheckPKG('x11')
env['HAVE_XRANDR'] = env['HAVE_X11'] and conf.CheckPKG('xrandr')
env['HAVE_COCOA'] = 0
# handling wx flags CCFLAGS should be created before
@ -423,6 +424,7 @@ conf.Define('HAVE_ALSA', env['HAVE_ALSA'])
conf.Define('HAVE_WX', env['HAVE_WX'])
conf.Define('USE_WX', env['USE_WX'])
conf.Define('HAVE_X11', env['HAVE_X11'])
conf.Define('HAVE_XRANDR', env['HAVE_XRANDR'])
conf.Define('HAVE_COCOA', env['HAVE_COCOA'])
conf.Define('HAVE_PORTAUDIO', env['HAVE_PORTAUDIO'])
conf.Define('SHARED_SOIL', env['SHARED_SOIL'])

View File

@ -98,6 +98,7 @@ void SConfig::SaveSettings()
ini.Set("Hotkeys", "StopModifier", m_LocalCoreStartupParameter.iHotkeyModifier[HK_STOP]);
// Display
ini.Set("Display", "FullscreenResolution", m_LocalCoreStartupParameter.strFullscreenResolution);
ini.Set("Display", "Fullscreen", m_LocalCoreStartupParameter.bFullscreen);
ini.Set("Display", "RenderToMain", m_LocalCoreStartupParameter.bRenderToMain);
ini.Set("Display", "RenderWindowXPos", m_LocalCoreStartupParameter.iRenderWindowXPos);
@ -224,8 +225,8 @@ void SConfig::LoadSettings()
// Display
ini.Get("Display", "Fullscreen", &m_LocalCoreStartupParameter.bFullscreen, false);
ini.Get("Display", "FullscreenResolution", &m_LocalCoreStartupParameter.strFullscreenResolution, "640x480");
ini.Get("Display", "RenderToMain", &m_LocalCoreStartupParameter.bRenderToMain, false);
std::string temp;
ini.Get("Display", "RenderWindowXPos", &m_LocalCoreStartupParameter.iRenderWindowXPos, 0);
ini.Get("Display", "RenderWindowYPos", &m_LocalCoreStartupParameter.iRenderWindowYPos, 0);
ini.Get("Display", "RenderWindowWidth", &m_LocalCoreStartupParameter.iRenderWindowWidth, 640);

View File

@ -91,6 +91,7 @@ struct SCoreStartupParameter
// Display settings
bool bFullscreen, bRenderToMain;
std::string strFullscreenResolution;
int iRenderWindowXPos, iRenderWindowYPos;
int iRenderWindowWidth, iRenderWindowHeight;

View File

@ -53,8 +53,11 @@ EVT_BUTTON(wxID_CLOSE, CConfigMain::CloseClick)
EVT_CHECKBOX(ID_INTERFACE_CONFIRMSTOP, CConfigMain::CoreSettingsChanged)
EVT_CHECKBOX(ID_INTERFACE_USEPANICHANDLERS, CConfigMain::CoreSettingsChanged)
EVT_CHECKBOX(ID_FRAMELIMIT_USEFPSFORLIMITING, CConfigMain::CoreSettingsChanged)
EVT_CHECKBOX(ID_DISPLAY_HIDECURSOR, CConfigMain::CoreSettingsChanged)
EVT_CHOICE(ID_DISPLAY_FULLSCREENRES, CConfigMain::CoreSettingsChanged)
EVT_CHECKBOX(ID_DISPLAY_FULLSCREEN, CConfigMain::CoreSettingsChanged)
EVT_TEXT(ID_DISPLAY_WINDOWWIDTH, CConfigMain::CoreSettingsChanged)
EVT_TEXT(ID_DISPLAY_WINDOWHEIGHT, CConfigMain::CoreSettingsChanged)
EVT_CHECKBOX(ID_DISPLAY_HIDECURSOR, CConfigMain::CoreSettingsChanged)
EVT_CHECKBOX(ID_DISPLAY_RENDERTOMAIN, CConfigMain::CoreSettingsChanged)
EVT_RADIOBOX(ID_INTERFACE_THEME, CConfigMain::CoreSettingsChanged)
EVT_CHOICE(ID_INTERFACE_LANG, CConfigMain::CoreSettingsChanged)
@ -116,6 +119,7 @@ CConfigMain::CConfigMain(wxWindow* parent, wxWindowID id, const wxString& title,
// Control refreshing of the ISOs list
bRefreshList = false;
AddResolutions();
CreateGUIControls();
// Update selected ISO paths
@ -145,6 +149,7 @@ void CConfigMain::UpdateGUI()
SkipIdle->Disable();
EnableCheats->Disable();
RenderToMain->Disable();
FullscreenResolution->Disable();
GCSystemLang->Disable();
@ -183,6 +188,10 @@ void CConfigMain::InitializeGUILists()
// GUI
arrayStringFor_InterfaceLang = arrayStringFor_GCSystemLang;
// Resolutions
if (arrayStringFor_FullscreenResolution.empty())
arrayStringFor_FullscreenResolution.Add(wxT("<No resolutions found>"));
// Framelimit
arrayStringFor_Framelimit.Add(wxT("Off"));
arrayStringFor_Framelimit.Add(wxT("Auto"));
@ -232,6 +241,11 @@ void CConfigMain::InitializeGUIValues()
InterfaceLang->SetSelection(SConfig::GetInstance().m_InterfaceLanguage);
// General - Display
int num = 0;
num = FullscreenResolution->FindString(wxString::FromAscii(SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution.c_str()));
FullscreenResolution->SetSelection(num);
WindowWidth->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth);
WindowHeight->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight);
Fullscreen->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen);
HideCursor->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor);
RenderToMain->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain);
@ -295,9 +309,10 @@ void CConfigMain::InitializeGUITooltips()
Theme->SetItemToolTip(3, wxT("Created by KDE-Look.org"));
// General - Display
Fullscreen->SetToolTip(
wxT("Start the rendering window in fullscreen mode.")
wxT(" Press Alt+Enter to switch between Fullscreen and Windowed mode."));
FullscreenResolution->SetToolTip(wxT("Select resolution for fullscreen mode"));
WindowWidth->SetToolTip(wxT("Window width for windowed mode"));
WindowHeight->SetToolTip(wxT("Window height for windowed mode"));
Fullscreen->SetToolTip(wxT("Start the rendering window in fullscreen mode."));
HideCursor->SetToolTip(wxT("Hide the cursor when it is over the rendering window")
wxT("\n and the rendering window has focus."));
RenderToMain->SetToolTip(wxT("Render to main window."));
@ -305,6 +320,7 @@ void CConfigMain::InitializeGUITooltips()
// Wii
WiiKeyboard->SetToolTip(wxT("This could cause slow down in Wii Menu and some games."));
}
void CConfigMain::CreateGUIControls()
{
InitializeGUILists();
@ -365,6 +381,14 @@ void CConfigMain::CreateGUIControls()
Theme = new wxRadioBox(GeneralPage, ID_INTERFACE_THEME, wxT("Theme"),wxDefaultPosition, wxDefaultSize, arrayStringFor_Themes, 1, wxRA_SPECIFY_ROWS);
// General display settings
wxStaticText *FullscreenResolutionText = new wxStaticText(GeneralPage, wxID_ANY, wxT("Fullscreen Display Resolution:"), wxDefaultPosition, wxDefaultSize, 0);
FullscreenResolution = new wxChoice(GeneralPage, ID_DISPLAY_FULLSCREENRES, wxDefaultPosition, wxDefaultSize, arrayStringFor_FullscreenResolution, 0, wxDefaultValidator, arrayStringFor_FullscreenResolution[0]);
wxStaticText *WindowSizeText = new wxStaticText(GeneralPage, wxID_ANY, wxT("Window Size:"), wxDefaultPosition, wxDefaultSize, 0);
WindowWidth = new wxSpinCtrl(GeneralPage, ID_DISPLAY_WINDOWWIDTH, wxEmptyString, wxDefaultPosition, wxDefaultSize);
wxStaticText *WindowXText = new wxStaticText(GeneralPage, wxID_ANY, wxT("x"), wxDefaultPosition, wxDefaultSize, 0);
WindowWidth->SetRange(0,3280);
WindowHeight = new wxSpinCtrl(GeneralPage, ID_DISPLAY_WINDOWHEIGHT, wxEmptyString, wxDefaultPosition, wxDefaultSize);
WindowHeight->SetRange(0,2048);
Fullscreen = new wxCheckBox(GeneralPage, ID_DISPLAY_FULLSCREEN, wxT("Start Renderer in Fullscreen"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
HideCursor = new wxCheckBox(GeneralPage, ID_DISPLAY_HIDECURSOR, wxT("Hide Mouse Cursor"));
RenderToMain = new wxCheckBox(GeneralPage, ID_DISPLAY_RENDERTOMAIN, wxT("Render to Main Window"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
@ -401,6 +425,16 @@ void CConfigMain::CreateGUIControls()
sInterface->Add(HotkeyConfig, 0, wxALIGN_RIGHT | wxALL, 5);
sbInterface->Add(sInterface, 0, wxEXPAND | wxALL, 5);
wxBoxSizer *sDisplayRes = new wxBoxSizer(wxHORIZONTAL);
sDisplayRes->Add(FullscreenResolutionText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
sDisplayRes->Add(FullscreenResolution, 0, wxEXPAND | wxALL, 5);
sbDisplay->Add(sDisplayRes, 0, wxALL, 5);
wxBoxSizer *sDisplaySize = new wxBoxSizer(wxHORIZONTAL);
sDisplaySize->Add(WindowSizeText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
sDisplaySize->Add(WindowWidth, 0, wxEXPAND | wxALL, 5);
sDisplaySize->Add(WindowXText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
sDisplaySize->Add(WindowHeight, 0, wxEXPAND | wxALL, 5);
sbDisplay->Add(sDisplaySize, 0, wxALL, 5);
sbDisplay->Add(Fullscreen, 0, wxEXPAND | wxALL, 5);
sbDisplay->Add(HideCursor, 0, wxALL, 5);
sbDisplay->Add(RenderToMain, 0, wxEXPAND | wxALL, 5);
@ -701,7 +735,6 @@ void CConfigMain::CloseClick(wxCommandEvent& WXUNUSED (event))
Close();
}
// Core AND Interface settings
void CConfigMain::CoreSettingsChanged(wxCommandEvent& event)
{
@ -767,6 +800,19 @@ void CConfigMain::CoreSettingsChanged(wxCommandEvent& event)
case ID_ENABLECHEATS:
SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableCheats = EnableCheats->IsChecked();
break;
case ID_DISPLAY_FULLSCREENRES:
SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution =
FullscreenResolution->GetStringSelection().mb_str();
#if defined(HAVE_XRANDR) && HAVE_XRANDR
main_frame->m_XRRConfig->Update();
#endif
break;
case ID_DISPLAY_WINDOWWIDTH:
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth = WindowWidth->GetValue();
break;
case ID_DISPLAY_WINDOWHEIGHT:
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight = WindowHeight->GetValue();
break;
case ID_DISPLAY_FULLSCREEN: // Display
SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen = Fullscreen->IsChecked();
break;
@ -1104,3 +1150,66 @@ bool CConfigMain::GetFilename(wxChoice* _pChoice, std::string& _rFilename)
return(false);
}
// Search for avaliable resolutions
void CConfigMain::AddResolutions()
{
#ifdef _WIN32
DWORD iModeNum = 0;
DEVMODE dmi;
ZeroMemory(&dmi, sizeof(dmi));
dmi.dmSize = sizeof(dmi);
std::vector<std::string> resos;
while (EnumDisplaySettings(NULL, iModeNum++, &dmi) != 0)
{
char res[100];
sprintf(res, "%dx%d", dmi.dmPelsWidth, dmi.dmPelsHeight);
std::string strRes(res);
// Only add unique resolutions
if (std::find(resos.begin(), resos.end(), strRes) == resos.end())
{
resos.push_back(strRes);
arrayStringFor_FullscreenResolution.Add(wxString::FromAscii(res));
}
ZeroMemory(&dmi, sizeof(dmi));
}
#elif defined(HAVE_XRANDR) && HAVE_XRANDR
main_frame->m_XRRConfig->AddResolutions(arrayStringFor_FullscreenResolution);
#elif defined(HAVE_COCOA) && HAVE_COCOA
CGDisplayModeRef mode;
CFArrayRef array;
CFIndex n, i;
int w, h;
std::vector<std::string> resos;
array = CGDisplayCopyAllDisplayModes(CGMainDisplayID(), NULL);
n = CFArrayGetCount(array);
for (i = 0; i < n; i++)
{
mode = (CGDisplayModeRef)CFArrayGetValueAtIndex(array, i);
w = CGDisplayModeGetWidth(mode);
h = CGDisplayModeGetHeight(mode);
char res[32];
sprintf(res,"%dx%d", w, h);
std::string strRes(res);
// Only add unique resolutions
if (std::find(resos.begin(), resos.end(), strRes) == resos.end())
{
resos.push_back(strRes);
arrayStringFor_FullscreenResolution.Add(wxString::FromAscii(res));
}
}
CFRelease(array);
#endif
}

View File

@ -23,6 +23,9 @@
#include <wx/notebook.h>
#include <wx/filepicker.h>
#include "ConfigManager.h"
#if defined(HAVE_XRANDR) && HAVE_XRANDR
#include "X11Utils.h"
#endif
class CConfigMain : public wxDialog
{
@ -54,6 +57,9 @@ private:
wxChoice* Framelimit;
wxRadioBox* Theme;
wxCheckBox* Fullscreen;
wxChoice* FullscreenResolution;
wxSpinCtrl *WindowWidth;
wxSpinCtrl *WindowHeight;
wxCheckBox* RenderToMain;
wxButton* HotkeyConfig;
@ -150,6 +156,7 @@ private:
wxArrayString arrayStringFor_WiiSystemLang;
wxArrayString arrayStringFor_ISOPaths;
wxArrayString arrayStringFor_Themes;
wxArrayString arrayStringFor_FullscreenResolution;
enum
{
@ -172,6 +179,9 @@ private:
ID_INTERFACE_CONFIRMSTOP, // Interface settings
ID_INTERFACE_USEPANICHANDLERS,
ID_DISPLAY_FULLSCREENRES,
ID_DISPLAY_WINDOWWIDTH,
ID_DISPLAY_WINDOWHEIGHT,
ID_DISPLAY_FULLSCREEN,
ID_DISPLAY_HIDECURSOR,
ID_DISPLAY_RENDERTOMAIN,
@ -246,6 +256,7 @@ private:
void CreateGUIControls();
void UpdateGUI();
void OnClose(wxCloseEvent& event);
void OnSpin(wxSpinEvent& event);
void CoreSettingsChanged(wxCommandEvent& event);
void GCSettingsChanged(wxCommandEvent& event);
void ChooseMemcardPath(std::string& strMemcard, bool isSlotA);
@ -262,5 +273,6 @@ private:
void FillChoiceBox(wxChoice* _pChoice, int _PluginType, const std::string& _SelectFilename);
void CallConfig(wxChoice* _pChoice);
bool GetFilename(wxChoice* _pChoice, std::string& _rFilename);
void AddResolutions();
};
#endif

View File

@ -48,10 +48,6 @@
#include <wx/datetime.h> // wxWidgets
#if defined HAVE_X11 && HAVE_X11
#include <X11/Xlib.h>
#endif
// Resources
extern "C" {
@ -142,7 +138,6 @@ CPanel::CPanel(
break;
case WM_USER_CREATE:
main_frame->DoFullscreen(SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen);
break;
case WM_USER_SETCURSOR:
@ -485,6 +480,11 @@ CFrame::CFrame(wxFrame* parent,
CreateCursor();
#endif
#if defined(HAVE_XRANDR) && HAVE_XRANDR
m_XRRConfig = new X11Utils::XRRConfiguration(X11Utils::XDisplayFromHandle(GetHandle()),
X11Utils::XWindowFromHandle(GetHandle()));
#endif
// -------------------------
// Connect event handlers
@ -524,6 +524,10 @@ CFrame::~CFrame()
if (m_timer.IsRunning()) m_timer.Stop();
#endif
#if defined(HAVE_XRANDR) && HAVE_XRANDR
delete m_XRRConfig;
#endif
ClosePages();
delete m_Mgr;
@ -543,46 +547,6 @@ void CFrame::OnQuit(wxCommandEvent& WXUNUSED (event))
Close(true);
}
#if defined HAVE_X11 && HAVE_X11
void CFrame::X11_SendClientEvent(const char *message,
int data1, int data2, int data3, int data4)
{
XEvent event;
Display *dpy = (Display *)Core::GetWindowHandle();
Window win = *(Window *)Core::GetXWindow();
// Init X event structure for client message
event.xclient.type = ClientMessage;
event.xclient.format = 32;
event.xclient.data.l[0] = XInternAtom(dpy, message, False);
event.xclient.data.l[1] = data1;
event.xclient.data.l[2] = data2;
event.xclient.data.l[3] = data3;
event.xclient.data.l[4] = data4;
// Send the event
if (!XSendEvent(dpy, win, False, False, &event))
ERROR_LOG(VIDEO, "Failed to send message %s to the emulator window.\n", message);
}
void X11_SendKeyEvent(int key)
{
XEvent event;
Display *dpy = (Display *)Core::GetWindowHandle();
Window win = *(Window *)Core::GetXWindow();
// Init X event structure for key press event
event.xkey.type = KeyPress;
// WARNING: This works for ASCII keys. If in the future other keys are needed
// convert with InputCommon::wxCharCodeWXToX from X11InputBase.cpp.
event.xkey.keycode = XKeysymToKeycode(dpy, key);
// Send the event
if (!XSendEvent(dpy, win, False, False, &event))
ERROR_LOG(VIDEO, "Failed to send key press event to the emulator window.\n");
}
#endif
// --------
// Events
void CFrame::OnActive(wxActivateEvent& event)
@ -731,7 +695,6 @@ void CFrame::OnHostMessage(wxCommandEvent& event)
break;
case WM_USER_CREATE:
DoFullscreen(SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen);
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
m_RenderParent->SetCursor(wxCURSOR_BLANK);
break;
@ -776,8 +739,10 @@ void CFrame::OnCustomHostMessage(int Id)
void CFrame::OnSizeRequest(int& x, int& y, int& width, int& height)
{
wxMutexGuiEnter();
m_RenderParent->GetSize(&width, &height);
m_RenderParent->GetPosition(&x, &y);
wxMutexGuiLeave();
}
bool CFrame::RendererHasFocus()
@ -892,7 +857,7 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
#ifdef _WIN32
PostMessage((HWND)Core::GetWindowHandle(), WM_USER, WM_USER_KEYDOWN, event.GetKeyCode());
#elif defined(HAVE_X11) && HAVE_X11
X11_SendKeyEvent(event.GetKeyCode());
X11Utils::SendKeyEvent(event.GetKeyCode());
#endif
}
#ifdef _WIN32
@ -981,34 +946,25 @@ wxAuiNotebook* CFrame::CreateEmptyNotebook()
void CFrame::DoFullscreen(bool bF)
{
// Only switch this to fullscreen if we're rendering to main AND if we're running a game
// plus if a modal dialog is open, this will still process the keyboard events, and may cause
// the main window to become unresponsive, so we have to avoid that.
if ((Core::GetState() == Core::CORE_RUN) || (Core::GetState() == Core::CORE_PAUSE))
ToggleDisplayMode(bF);
m_RenderFrame->ShowFullScreen(bF);
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain)
{
#if defined(HAVE_X11) && HAVE_X11
X11_SendClientEvent("TOGGLE_DISPLAYMODE", bF);
#elif defined(_WIN32)
PostMessage((HWND)Core::GetWindowHandle(), WM_USER, TOGGLE_DISPLAYMODE, bF);
#endif
m_RenderFrame->ShowFullScreen(bF);
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain)
if (bF)
{
if (bF)
{
// Save the current mode before going to fullscreen
AuiCurrent = m_Mgr->SavePerspective();
m_Mgr->LoadPerspective(AuiFullscreen, true);
}
else
{
// Restore saved perspective
m_Mgr->LoadPerspective(AuiCurrent, true);
}
// Save the current mode before going to fullscreen
AuiCurrent = m_Mgr->SavePerspective();
m_Mgr->LoadPerspective(AuiFullscreen, true);
}
else
m_RenderFrame->Raise();
{
// Restore saved perspective
m_Mgr->LoadPerspective(AuiCurrent, true);
}
}
else
m_RenderFrame->Raise();
}
// Debugging, show loose windows

View File

@ -36,8 +36,7 @@
#include "CodeWindow.h"
#include "LogWindow.h"
#if defined(HAVE_X11) && HAVE_X11
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include "X11Utils.h"
#endif
// A shortcut to access the bitmaps
@ -99,19 +98,19 @@ class CFrame : public CRenderFrame
bool ShowLogWindow = false,
long style = wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE);
virtual ~CFrame();
void* GetRenderHandle()
{
#ifdef _WIN32
return (void *)m_RenderParent->GetHandle();
#elif defined(HAVE_X11) && HAVE_X11
return (void *)GDK_WINDOW_XID(GTK_WIDGET(m_RenderParent->GetHandle())->window);
return (void *)X11Utils::XWindowFromHandle(m_RenderParent->GetHandle());
#else
return m_RenderParent;
#endif
}
virtual ~CFrame();
// These have to be public
CCodeWindow* g_pCodeWindow;
wxMenuBar* m_MenuBar;
@ -136,6 +135,11 @@ class CFrame : public CRenderFrame
void OnRenderParentMove(wxMoveEvent& event);
bool RendererHasFocus();
void DoFullscreen(bool bF);
void ToggleDisplayMode (bool bFullscreen);
#if defined(HAVE_XRANDR) && HAVE_XRANDR
X11Utils::XRRConfiguration *m_XRRConfig;
#endif
// AUI
wxAuiManager *m_Mgr;
@ -351,10 +355,6 @@ class CFrame : public CRenderFrame
void OnRenderParentResize(wxSizeEvent& event);
bool RendererIsFullscreen();
void StartGame(const std::string& filename);
#if defined HAVE_X11 && HAVE_X11
void X11_SendClientEvent(const char *message,
int data1 = 0, int data2 = 0, int data3 = 0, int data4 = 0);
#endif
// MenuBar
// File - Drive

View File

@ -661,7 +661,8 @@ void CFrame::OnRenderParentClose(wxCloseEvent& event)
void CFrame::OnRenderParentMove(wxMoveEvent& event)
{
if (!RendererIsFullscreen() && !m_RenderFrame->IsMaximized())
if (Core::GetState() != Core::CORE_UNINITIALIZED &&
!RendererIsFullscreen() && !m_RenderFrame->IsMaximized())
{
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowXPos = m_RenderFrame->GetPosition().x;
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowYPos = m_RenderFrame->GetPosition().y;
@ -671,23 +672,52 @@ void CFrame::OnRenderParentMove(wxMoveEvent& event)
void CFrame::OnRenderParentResize(wxSizeEvent& event)
{
int width, height;
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain &&
!RendererIsFullscreen() && !m_RenderFrame->IsMaximized())
if (Core::GetState() != Core::CORE_UNINITIALIZED)
{
m_RenderFrame->GetSize(&width, &height);
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth = width;
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight = height;
}
int width, height;
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain &&
!RendererIsFullscreen() && !m_RenderFrame->IsMaximized())
{
m_RenderFrame->GetSize(&width, &height);
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth = width;
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight = height;
}
#if defined(HAVE_X11) && HAVE_X11
int x, y;
m_RenderParent->GetSize(&width, &height);
m_RenderParent->GetPosition(&x, &y);
X11_SendClientEvent("RESIZE", x, y, width, height);
int x, y;
m_RenderParent->GetSize(&width, &height);
m_RenderParent->GetPosition(&x, &y);
X11Utils::SendClientEvent("RESIZE", x, y, width, height);
#endif
}
event.Skip();
}
void CFrame::ToggleDisplayMode (bool bFullscreen)
{
#ifdef _WIN32
if (bFullscreen)
{
DEVMODE dmScreenSettings;
memset(&dmScreenSettings,0,sizeof(dmScreenSettings));
dmScreenSettings.dmSize = sizeof(dmScreenSettings);
sscanf(SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution.c_str(),
"%dx%d", &dmScreenSettings.dmPelsWidth, &dmScreenSettings.dmPelsHeight);
dmScreenSettings.dmBitsPerPel = 32;
dmScreenSettings.dmFields = DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;
// Try To Set Selected Mode And Get Results. NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar.
ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN);
}
else
{
// Change to default resolution
ChangeDisplaySettings(NULL, CDS_FULLSCREEN);
}
#elif defined(HAVE_XRANDR) && HAVE_XRANDR
m_XRRConfig->ToggleDisplayMode(bFullscreen);
#endif
}
// Prepare the GUI to start the game.
void CFrame::StartGame(const std::string& filename)
{
@ -728,11 +758,6 @@ void CFrame::StartGame(const std::string& filename)
m_RenderParent = new CPanel(m_RenderFrame, wxID_ANY);
m_RenderFrame->Show();
}
#ifdef _WIN32
::SetFocus((HWND)m_RenderParent->GetHandle());
#else
m_RenderParent->SetFocus();
#endif
if (!BootManager::BootCore(filename))
{
@ -745,6 +770,14 @@ void CFrame::StartGame(const std::string& filename)
}
else
{
DoFullscreen(SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen);
#ifdef _WIN32
::SetFocus((HWND)m_RenderParent->GetHandle());
#else
m_RenderParent->SetFocus();
#endif
wxTheApp->Connect(wxID_ANY, wxEVT_KEY_DOWN, // Keyboard
wxKeyEventHandler(CFrame::OnKeyDown),
(wxObject*)0, this);
@ -847,15 +880,9 @@ void CFrame::DoStop()
(wxObject*)0, this);
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
m_RenderParent->SetCursor(wxCURSOR_ARROW);
DoFullscreen(FALSE);
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain)
{
#ifdef _WIN32
if (!RendererIsFullscreen() && !m_RenderFrame->IsMaximized())
m_RenderFrame->GetSize(&SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth,
&SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight);
#endif
m_RenderFrame->Destroy();
}
m_RenderParent = NULL;
// Clean framerate indications from the status bar.

View File

@ -33,15 +33,9 @@
#endif
#if defined HAVE_X11 && HAVE_X11
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include "X11InputBase.h"
#include "State.h"
// EWMH state actions, see
// http://freedesktop.org/wiki/Specifications/wm-spec?action=show&redirect=Standards%2Fwm-spec
#define _NET_WM_STATE_REMOVE 0 /* remove/unset property */
#define _NET_WM_STATE_ADD 1 /* add/set property */
#define _NET_WM_STATE_TOGGLE 2 /* toggle property */
#include "X11Utils.h"
#endif
#if defined(HAVE_COCOA) && HAVE_COCOA
@ -71,52 +65,6 @@ void Host_NotifyMapLoaded(){}
void Host_ShowJitResults(unsigned int address){}
#if defined(HAVE_X11) && HAVE_X11
void X11_SendClientEvent(const char *message,
int data1 = 0, int data2 = 0, int data3 = 0, int data4 = 0)
{
XEvent event;
Display *dpy = (Display *)Core::GetWindowHandle();
Window win = *(Window *)Core::GetXWindow();
// Init X event structure for client message
event.xclient.type = ClientMessage;
event.xclient.format = 32;
event.xclient.data.l[0] = XInternAtom(dpy, message, False);
event.xclient.data.l[1] = data1;
event.xclient.data.l[2] = data2;
event.xclient.data.l[3] = data3;
event.xclient.data.l[4] = data4;
// Send the event
if (!XSendEvent(dpy, win, False, False, &event))
ERROR_LOG(VIDEO, "Failed to send message %s to the emulator window.\n", message);
}
void X11_EWMH_Fullscreen(int action)
{
_assert_(action == _NET_WM_STATE_REMOVE || action == _NET_WM_STATE_ADD
|| action == _NET_WM_STATE_TOGGLE);
Display *dpy = (Display *)Core::GetWindowHandle();
Window win = *(Window *)Core::GetXWindow();
// Init X event structure for _NET_WM_STATE_FULLSCREEN client message
XEvent event;
event.xclient.type = ClientMessage;
event.xclient.message_type = XInternAtom(dpy, "_NET_WM_STATE", False);
event.xclient.window = win;
event.xclient.format = 32;
event.xclient.data.l[0] = action;
event.xclient.data.l[1] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False);
// Send the event
if (!XSendEvent(dpy, DefaultRootWindow(dpy), False,
SubstructureRedirectMask | SubstructureNotifyMask, &event))
ERROR_LOG(VIDEO, "Failed to switch fullscreen/windowed mode.\n");
}
#endif
Common::Event updateMainFrameEvent;
void Host_Message(int Id)
{
@ -188,6 +136,133 @@ void Host_SysMessage(const char *fmt, ...)
void Host_SetWiiMoteConnectionState(int _State) {}
#if defined(HAVE_X11) && HAVE_X11
void X11_MainLoop()
{
bool fullscreen = SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen;
while (Core::GetState() == Core::CORE_UNINITIALIZED)
updateMainFrameEvent.Wait();
Display *dpy = XOpenDisplay(0);
Window win = *(Window *)Core::GetXWindow();
XSelectInput(dpy, win, KeyPressMask | KeyReleaseMask | FocusChangeMask);
#if defined(HAVE_XRANDR) && HAVE_XRANDR
X11Utils::XRRConfiguration *XRRConfig = new X11Utils::XRRConfiguration(dpy, win);
#endif
Cursor blankCursor = NULL;
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
{
// make a blank cursor
Pixmap Blank;
XColor DummyColor;
char ZeroData[1] = {0};
Blank = XCreateBitmapFromData (dpy, win, ZeroData, 1, 1);
blankCursor = XCreatePixmapCursor(dpy, Blank, Blank, &DummyColor, &DummyColor, 0, 0);
XFreePixmap (dpy, Blank);
XDefineCursor(dpy, win, blankCursor);
}
if (fullscreen)
{
X11Utils::EWMH_Fullscreen(_NET_WM_STATE_TOGGLE);
#if defined(HAVE_XRANDR) && HAVE_XRANDR
XRRConfig->ToggleDisplayMode(True);
#endif
}
// The actual loop
while (running)
{
XEvent event;
KeySym key;
for (int num_events = XPending(dpy); num_events > 0; num_events--)
{
XNextEvent(dpy, &event);
switch(event.type)
{
case KeyPress:
key = XLookupKeysym((XKeyEvent*)&event, 0);
if (key == XK_Escape)
{
if (Core::GetState() == Core::CORE_RUN)
{
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
XUndefineCursor(dpy, win);
Core::SetState(Core::CORE_PAUSE);
}
else
{
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
XDefineCursor(dpy, win, blankCursor);
Core::SetState(Core::CORE_RUN);
}
}
else if ((key == XK_Return) && (event.xkey.state & Mod1Mask))
{
fullscreen = !fullscreen;
X11Utils::EWMH_Fullscreen(_NET_WM_STATE_TOGGLE);
#if defined(HAVE_XRANDR) && HAVE_XRANDR
XRRConfig->ToggleDisplayMode(fullscreen);
#endif
}
else if (key >= XK_F1 && key <= XK_F8)
{
int slot_number = key - XK_F1 + 1;
if (event.xkey.state & ShiftMask)
State_Save(slot_number);
else
State_Load(slot_number);
}
else if (key == XK_F9)
Core::ScreenShot();
else if (key == XK_F11)
State_LoadLastSaved();
else if (key == XK_F12)
{
if (event.xkey.state & ShiftMask)
State_UndoLoadState();
else
State_UndoSaveState();
}
break;
case FocusIn:
rendererHasFocus = true;
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor &&
Core::GetState() != Core::CORE_PAUSE)
XDefineCursor(dpy, win, blankCursor);
break;
case FocusOut:
rendererHasFocus = false;
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
XUndefineCursor(dpy, win);
break;
}
}
if (!fullscreen)
{
Window winDummy;
unsigned int borderDummy, depthDummy;
XGetGeometry(dpy, win, &winDummy,
&SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowXPos,
&SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowYPos,
(unsigned int *)&SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth,
(unsigned int *)&SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight,
&borderDummy, &depthDummy);
}
usleep(100000);
}
#if defined(HAVE_XRANDR) && HAVE_XRANDR
delete XRRConfig;
#endif
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
XFreeCursor(dpy, blankCursor);
XCloseDisplay(dpy);
Core::Stop();
}
#endif
//for cocoa we need to hijack the main to get event
#if defined(HAVE_COCOA) && HAVE_COCOA
@ -322,112 +397,7 @@ int main(int argc, char* argv[])
if (BootManager::BootCore(bootFile)) //no use running the loop when booting fails
{
#if defined(HAVE_X11) && HAVE_X11
bool fullscreen = SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen;
printf("gopt here\n");
while (Core::GetState() == Core::CORE_UNINITIALIZED)
updateMainFrameEvent.Wait();
Display *dpy = XOpenDisplay(0);
Window win = *(Window *)Core::GetXWindow();
XSelectInput(dpy, win, KeyPressMask | KeyReleaseMask | FocusChangeMask);
Cursor blankCursor = NULL;
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
{
// make a blank cursor
Pixmap Blank;
XColor DummyColor;
char ZeroData[1] = {0};
Blank = XCreateBitmapFromData (dpy, win, ZeroData, 1, 1);
blankCursor = XCreatePixmapCursor(dpy, Blank, Blank, &DummyColor, &DummyColor, 0, 0);
XFreePixmap (dpy, Blank);
XDefineCursor(dpy, win, blankCursor);
}
if (fullscreen)
{
X11_SendClientEvent("TOGGLE_DISPLAYMODE", fullscreen);
X11_EWMH_Fullscreen(_NET_WM_STATE_TOGGLE);
}
while (running)
{
XEvent event;
KeySym key;
for (int num_events = XPending(dpy); num_events > 0; num_events--)
{
XNextEvent(dpy, &event);
switch(event.type)
{
case KeyPress:
key = XLookupKeysym((XKeyEvent*)&event, 0);
if (key == XK_Escape)
{
if (Core::GetState() == Core::CORE_RUN)
{
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
XUndefineCursor(dpy, win);
Core::SetState(Core::CORE_PAUSE);
}
else
{
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
XDefineCursor(dpy, win, blankCursor);
Core::SetState(Core::CORE_RUN);
}
}
else if ((key == XK_Return) && (event.xkey.state & Mod1Mask))
{
fullscreen = !fullscreen;
X11_SendClientEvent("TOGGLE_DISPLAYMODE", fullscreen);
X11_EWMH_Fullscreen(_NET_WM_STATE_TOGGLE);
}
else if (key >= XK_F1 && key <= XK_F8)
{
int slot_number = key - XK_F1 + 1;
if (event.xkey.state & ShiftMask)
State_Save(slot_number);
else
State_Load(slot_number);
}
else if (key == XK_F9)
Core::ScreenShot();
else if (key == XK_F11)
State_LoadLastSaved();
else if (key == XK_F12)
{
if (event.xkey.state & ShiftMask)
State_UndoLoadState();
else
State_UndoSaveState();
}
break;
case FocusIn:
rendererHasFocus = true;
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor &&
Core::GetState() != Core::CORE_PAUSE)
XDefineCursor(dpy, win, blankCursor);
break;
case FocusOut:
rendererHasFocus = false;
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
XUndefineCursor(dpy, win);
break;
}
}
if (!fullscreen)
{
Window winDummy;
unsigned int borderDummy, depthDummy;
XGetGeometry(dpy, win, &winDummy,
&SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowXPos,
&SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowYPos,
(unsigned int *)&SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth,
(unsigned int *)&SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight,
&borderDummy, &depthDummy);
}
usleep(100000);
}
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
XFreeCursor(dpy, blankCursor);
XCloseDisplay(dpy);
Core::Stop();
X11_MainLoop();
#else
while (PowerPC::GetState() != PowerPC::CPU_POWERDOWN)
updateMainFrameEvent.Wait();

View File

@ -103,6 +103,9 @@ else:
exeGUI = env['binary_dir'] + 'dolphin-emu'
exeNoGUI = env['binary_dir'] + 'dolphin-emu-nogui'
if wxenv['HAVE_X11']:
files += [ 'X11Utils.cpp' ]
#objects = [ wxenv.Object(srcFile) for srcFile in files ]
if wxenv['HAVE_WX']:

View File

@ -0,0 +1,184 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "X11Utils.h"
#if defined(HAVE_XRANDR) && HAVE_XRANDR
#endif
namespace X11Utils
{
void SendClientEvent(const char *message,
int data1, int data2, int data3, int data4)
{
XEvent event;
Display *dpy = (Display *)Core::GetWindowHandle();
Window win = *(Window *)Core::GetXWindow();
// Init X event structure for client message
event.xclient.type = ClientMessage;
event.xclient.format = 32;
event.xclient.data.l[0] = XInternAtom(dpy, message, False);
event.xclient.data.l[1] = data1;
event.xclient.data.l[2] = data2;
event.xclient.data.l[3] = data3;
event.xclient.data.l[4] = data4;
// Send the event
if (!XSendEvent(dpy, win, False, False, &event))
ERROR_LOG(VIDEO, "Failed to send message %s to the emulator window.\n", message);
}
void SendKeyEvent(int key)
{
XEvent event;
Display *dpy = (Display *)Core::GetWindowHandle();
Window win = *(Window *)Core::GetXWindow();
// Init X event structure for key press event
event.xkey.type = KeyPress;
// WARNING: This works for ASCII keys. If in the future other keys are needed
// convert with InputCommon::wxCharCodeWXToX from X11InputBase.cpp.
event.xkey.keycode = XKeysymToKeycode(dpy, key);
// Send the event
if (!XSendEvent(dpy, win, False, False, &event))
ERROR_LOG(VIDEO, "Failed to send key press event to the emulator window.\n");
}
void EWMH_Fullscreen(int action)
{
_assert_(action == _NET_WM_STATE_REMOVE || action == _NET_WM_STATE_ADD
|| action == _NET_WM_STATE_TOGGLE);
Display *dpy = (Display *)Core::GetWindowHandle();
Window win = *(Window *)Core::GetXWindow();
// Init X event structure for _NET_WM_STATE_FULLSCREEN client message
XEvent event;
event.xclient.type = ClientMessage;
event.xclient.message_type = XInternAtom(dpy, "_NET_WM_STATE", False);
event.xclient.window = win;
event.xclient.format = 32;
event.xclient.data.l[0] = action;
event.xclient.data.l[1] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False);
// Send the event
if (!XSendEvent(dpy, DefaultRootWindow(dpy), False,
SubstructureRedirectMask | SubstructureNotifyMask, &event))
ERROR_LOG(VIDEO, "Failed to switch fullscreen/windowed mode.\n");
}
#if defined(HAVE_WX) && HAVE_WX
Window XWindowFromHandle(void *Handle)
{
return GDK_WINDOW_XID(GTK_WIDGET(Handle)->window);
}
Display *XDisplayFromHandle(void *Handle)
{
return GDK_WINDOW_XDISPLAY(GTK_WIDGET(Handle)->window);
}
#endif
#if defined(HAVE_XRANDR) && HAVE_XRANDR
XRRConfiguration::XRRConfiguration(Display *_dpy, Window _win)
: dpy(_dpy)
, win(_win)
, deskSize(-1), fullSize(-1)
{
int vidModeMajorVersion, vidModeMinorVersion;
XRRQueryVersion(dpy, &vidModeMajorVersion, &vidModeMinorVersion);
NOTICE_LOG(VIDEO, "XRRExtension-Version %d.%d", vidModeMajorVersion, vidModeMinorVersion);
Update();
}
XRRConfiguration::~XRRConfiguration()
{
ToggleDisplayMode(False);
XRRFreeScreenConfigInfo(screenConfig);
}
void XRRConfiguration::Update()
{
// Get the resolution setings for fullscreen mode
int fullWidth, fullHeight;
sscanf(SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution.c_str(),
"%dx%d", &fullWidth, &fullHeight);
XRRScreenSize *sizes;
int numSizes;
screenConfig = XRRGetScreenInfo(dpy, win);
/* save desktop resolution */
deskSize = XRRConfigCurrentConfiguration(screenConfig, &screenRotation);
/* Set the desktop resolution as the default */
fullSize = deskSize;
/* Find the index of the fullscreen resolution from config */
sizes = XRRConfigSizes(screenConfig, &numSizes);
if (numSizes > 0 && sizes != NULL) {
for (int i = 0; i < numSizes; i++) {
if ((sizes[i].width == fullWidth) && (sizes[i].height == fullHeight)) {
fullSize = i;
}
}
NOTICE_LOG(VIDEO, "Fullscreen Resolution %dx%d",
sizes[fullSize].width, sizes[fullSize].height);
}
else {
ERROR_LOG(VIDEO, "Failed to obtain fullscreen size.\n"
"Using current desktop resolution for fullscreen.\n");
}
}
void XRRConfiguration::ToggleDisplayMode(bool bFullscreen)
{
if (bFullscreen)
XRRSetScreenConfig(dpy, screenConfig, win,
fullSize, screenRotation, CurrentTime);
else
XRRSetScreenConfig(dpy, screenConfig, win,
deskSize, screenRotation, CurrentTime);
}
#if defined(HAVE_WX) && HAVE_WX
void XRRConfiguration::AddResolutions(wxArrayString& arrayStringFor_FullscreenResolution)
{
int screen;
screen = DefaultScreen(dpy);
//Get all full screen resos for the config dialog
XRRScreenSize *sizes = NULL;
int modeNum = 0;
sizes = XRRSizes(dpy, screen, &modeNum);
if (modeNum > 0 && sizes != NULL)
{
for (int i = 0; i < modeNum; i++)
arrayStringFor_FullscreenResolution.Add(wxString::Format(wxT("%dx%d"),
sizes[i].width, sizes[i].height));
}
}
#endif
#endif
}

View File

@ -0,0 +1,80 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef __X11UTILS_H_
#define __X11UTILS_H_
#include "Common.h"
#if defined(HAVE_WX) && HAVE_WX
#include <wx/wx.h>
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#endif
#include <X11/Xlib.h>
#if defined(HAVE_XRANDR) && HAVE_XRANDR
#include <X11/extensions/Xrandr.h>
#endif
#include "Core.h"
#include "ConfigManager.h"
// EWMH state actions, see
// http://freedesktop.org/wiki/Specifications/wm-spec?action=show&redirect=Standards%2Fwm-spec
#define _NET_WM_STATE_REMOVE 0 /* remove/unset property */
#define _NET_WM_STATE_ADD 1 /* add/set property */
#define _NET_WM_STATE_TOGGLE 2 /* toggle property */
namespace X11Utils
{
void SendClientEvent(const char *message,
int data1, int data2, int data3, int data4);
void SendKeyEvent(int key);
void EWMH_Fullscreen(int action);
#if defined(HAVE_WX) && HAVE_WX
Window XWindowFromHandle(void *Handle);
Display *XDisplayFromHandle(void *Handle);
#endif
#if defined(HAVE_XRANDR) && HAVE_XRANDR
class XRRConfiguration
{
public:
XRRConfiguration(Display *_dpy, Window _win);
~XRRConfiguration();
void Update();
void ToggleDisplayMode(bool bFullscreen);
#if defined(HAVE_WX) && HAVE_WX
void AddResolutions(wxArrayString& arrayStringFor_FullscreenResolution);
#endif
private:
Display *dpy;
Window win;
XRRScreenConfiguration *screenConfig;
Rotation screenRotation;
int deskSize, fullSize;
};
#endif
}
#endif

View File

@ -47,10 +47,6 @@ void VideoConfig::Load(const char *ini_file)
IniFile iniFile;
iniFile.Load(ini_file);
// get resolution
iniFile.Get("Hardware", "FullscreenRes", &temp, "640x480");
strncpy(cFSResolution, temp.c_str(), 16);
iniFile.Get("Hardware", "VSync", &bVSync, 0); // Hardware
iniFile.Get("Settings", "StretchToFit", &bNativeResolution, true);
iniFile.Get("Settings", "2xResolution", &b2xResolution, false);
@ -151,7 +147,6 @@ void VideoConfig::Save(const char *ini_file)
{
IniFile iniFile;
iniFile.Load(ini_file);
iniFile.Set("Hardware", "FullscreenRes", cFSResolution);
iniFile.Set("Hardware", "VSync", bVSync);
iniFile.Set("Settings", "StretchToFit", bNativeResolution);
iniFile.Set("Settings", "2xResolution", b2xResolution);

View File

@ -69,9 +69,6 @@ struct VideoConfig
// General
bool bVSync;
// Resolution control
char cFSResolution[16];
bool bNativeResolution, b2xResolution, bRunning; // Should possibly be augmented with 2x, 4x native.
bool bWidescreenHack;
int iAspectRatio;

View File

@ -24,8 +24,6 @@ enum PLUGIN_COMM
WM_USER_SETCURSOR,
WM_USER_KEYDOWN,
WM_USER_VIDEO_STOP,
TOGGLE_DISPLAYMODE,
TOGGLE_FULLSCREEN,
VIDEO_DESTROY, // The video debugging window was destroyed
AUDIO_DESTROY, // The audio debugging window was destroyed
WIIMOTE_DISCONNECT, // Disconnect Wiimote

View File

@ -107,9 +107,6 @@ void EnableAlphaToCoverage()
void InitPP(int adapter, int f, int aa_mode, D3DPRESENT_PARAMETERS *pp)
{
int FSResX = adapters[adapter].resolutions[resolution].xres;
int FSResY = adapters[adapter].resolutions[resolution].yres;
ZeroMemory(pp, sizeof(D3DPRESENT_PARAMETERS));
pp->hDeviceWindow = hWnd;
if (auto_depth_stencil)

View File

@ -72,18 +72,6 @@ struct TabDirect3D : public W32Util::Tab
}
ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_ASPECTRATIO), g_Config.iAspectRatio);
for (int i = 0; i < (int)adapter.resolutions.size(); i++)
{
const D3D::Resolution &r = adapter.resolutions[i];
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, r.name, -1, tempwstr, 2000);
ComboBox_AddString(GetDlgItem(hDlg, IDC_RESOLUTION), tempwstr);
}
for (int i = 0; i < 16; i++) {
tempwstr[i] = g_Config.cFSResolution[i];
}
ComboBox_SelectString(GetDlgItem(hDlg,IDC_RESOLUTION), -1, tempwstr);
Button_SetCheck(GetDlgItem(hDlg, IDC_VSYNC), g_Config.bVSync);
Button_SetCheck(GetDlgItem(hDlg, IDC_WIDESCREEN_HACK), g_Config.bWidescreenHack);
Button_SetCheck(GetDlgItem(hDlg, IDC_SAFE_TEXTURE_CACHE), g_Config.bSafeTextureCache);
@ -136,8 +124,6 @@ struct TabDirect3D : public W32Util::Tab
void Apply(HWND hDlg)
{
ComboBox_GetTextA(GetDlgItem(hDlg, IDC_RESOLUTION), g_Config.cFSResolution, 16);
g_Config.iAdapter = ComboBox_GetCurSel(GetDlgItem(hDlg, IDC_ADAPTER));
g_Config.iMultisampleMode = ComboBox_GetCurSel(GetDlgItem(hDlg, IDC_ANTIALIASMODE));
g_Config.bVSync = Button_GetCheck(GetDlgItem(hDlg, IDC_VSYNC)) ? true : false;

View File

@ -70,27 +70,6 @@ void OnKeyDown(WPARAM wParam)
}
// ---------------------------------------------------------------------
void ToggleDisplayMode (int bFullscreen)
{
if (bFullscreen)
{
DEVMODE dmScreenSettings;
memset(&dmScreenSettings,0,sizeof(dmScreenSettings));
dmScreenSettings.dmSize = sizeof(dmScreenSettings);
sscanf(g_Config.cFSResolution, "%dx%d", &dmScreenSettings.dmPelsWidth, &dmScreenSettings.dmPelsHeight);
dmScreenSettings.dmBitsPerPel = 32;
dmScreenSettings.dmFields = DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;
// Try To Set Selected Mode And Get Results. NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar.
ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN);
}
else
{
// Change to default resolution
ChangeDisplaySettings(NULL, CDS_FULLSCREEN);
}
}
LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
{
switch( iMsg )
@ -132,8 +111,6 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
OnKeyDown(lParam);
else if (wParam == WIIMOTE_DISCONNECT)
PostMessage(m_hParent, WM_USER, wParam, lParam);
else if (wParam == TOGGLE_DISPLAYMODE)
ToggleDisplayMode(lParam);
break;
case WM_SYSCOMMAND:

View File

@ -14,7 +14,6 @@ void Close();
void SetSize(int displayWidth, int displayHeight);
bool IsSizing();
void OSDMenu(WPARAM wParam);
void ToggleDisplayMode (int bFullscreen);
}

View File

@ -264,12 +264,12 @@ void TeardownDeviceObjects()
bool Renderer::Init()
{
UpdateActiveConfig();
int fullScreenRes, w_temp, h_temp;
int fullScreenRes, x, y, w_temp, h_temp;
s_blendMode = 0;
// Multisample Anti-aliasing hasn't been implemented yet
int backbuffer_ms_mode = 0; // g_ActiveConfig.iMultisampleMode;
sscanf(g_Config.cFSResolution, "%dx%d", &w_temp, &h_temp);
g_VideoInitialize.pRequestWindowSize(x, y, w_temp, h_temp);
for (fullScreenRes = 0; fullScreenRes < (int)D3D::GetAdapter(g_ActiveConfig.iAdapter).resolutions.size(); fullScreenRes++)
{

View File

@ -287,7 +287,6 @@ void Shutdown()
OpcodeDecoder_Shutdown();
Renderer::Shutdown();
D3D::Shutdown();
EmuWindow::ToggleDisplayMode(false);
EmuWindow::Close();
s_PluginInitialized = false;
}

View File

@ -46,16 +46,14 @@ BEGIN
CONTROL "&Widescreen Hack",IDC_WIDESCREEN_HACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,25,67,10
LTEXT "&Aspect Ratio:",IDC_STATIC,9,40,48,8
COMBOBOX IDC_ASPECTRATIO,68,39,89,57,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "Full&screen Resolution:",IDC_STATIC,9,56,230,8
COMBOBOX IDC_RESOLUTION,68,67,162,73,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "&Anti-alias mode:",IDC_STATIC,9,87,51,8
COMBOBOX IDC_ANTIALIASMODE,68,85,162,73,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "&Enable CPU->EFB access ",IDC_EFB_ACCESS_ENABLE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,103,94,11
GROUPBOX "Safe Texture Cache Mode",IDC_STATIC,109,119,125,27
CONTROL "&Safe Texture Cache",IDC_SAFE_TEXTURE_CACHE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,129,80,11
CONTROL "Safe",IDC_SAFE_TEXTURE_CACHE_SAFE,"Button",BS_AUTORADIOBUTTON,117,130,27,10
CONTROL "Normal",IDC_SAFE_TEXTURE_CACHE_NORMAL,"Button",BS_AUTORADIOBUTTON,154,130,38,10
CONTROL "Fast",IDC_SAFE_TEXTURE_CACHE_FAST,"Button",BS_AUTORADIOBUTTON,198,130,30,10
LTEXT "&Anti-alias mode:",IDC_STATIC,9,59,51,8
COMBOBOX IDC_ANTIALIASMODE,68,59,162,73,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "&Enable CPU->EFB access ",IDC_EFB_ACCESS_ENABLE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,80,94,11
GROUPBOX "Safe Texture Cache Mode",IDC_STATIC,109,94,125,27
CONTROL "&Safe Texture Cache",IDC_SAFE_TEXTURE_CACHE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,104,80,11
CONTROL "Safe",IDC_SAFE_TEXTURE_CACHE_SAFE,"Button",BS_AUTORADIOBUTTON,117,105,27,10
CONTROL "Normal",IDC_SAFE_TEXTURE_CACHE_NORMAL,"Button",BS_AUTORADIOBUTTON,154,105,38,10
CONTROL "Fast",IDC_SAFE_TEXTURE_CACHE_FAST,"Button",BS_AUTORADIOBUTTON,198,105,30,10
END
IDD_ADVANCED DIALOGEX 0, 0, 244, 200

View File

@ -122,49 +122,8 @@ THREAD_RETURN XEventThread(void *pArg);
void CreateXWindow (void)
{
#if defined(HAVE_XRANDR) && HAVE_XRANDR
// Get the resolution setings for fullscreen mode
int fullWidth, fullHeight;
sscanf(g_Config.cFSResolution, "%dx%d", &fullWidth, &fullHeight);
int vidModeMajorVersion, vidModeMinorVersion;
XRRScreenSize *sizes;
int numSizes;
XRRQueryVersion(GLWin.dpy, &vidModeMajorVersion, &vidModeMinorVersion);
NOTICE_LOG(VIDEO, "XRRExtension-Version %d.%d", vidModeMajorVersion, vidModeMinorVersion);
GLWin.screenConfig = XRRGetScreenInfo(GLWin.dpy, GLWin.parent);
/* save desktop resolution */
GLWin.deskSize = XRRConfigCurrentConfiguration(GLWin.screenConfig, &GLWin.screenRotation);
/* Set the desktop resolution as the default */
GLWin.fullSize = GLWin.deskSize;
/* Find the index of the fullscreen resolution from config */
sizes = XRRConfigSizes(GLWin.screenConfig, &numSizes);
if (numSizes > 0 && sizes != NULL) {
for (int i = 0; i < numSizes; i++) {
if ((sizes[i].width == fullWidth) && (sizes[i].height == fullHeight)) {
GLWin.fullSize = i;
}
}
NOTICE_LOG(VIDEO, "Fullscreen Resolution %dx%d", sizes[GLWin.fullSize].width, sizes[GLWin.fullSize].height);
}
else {
ERROR_LOG(VIDEO, "Failed to obtain fullscreen sizes.\n"
"Using current desktop resolution for fullscreen.\n");
}
#endif
Atom wmProtocols[1];
g_VideoInitialize.pRequestWindowSize(GLWin.x, GLWin.y, (int&)GLWin.width, (int&)GLWin.height);
// Control window size and picture scaling
s_backbuffer_width = GLWin.width;
s_backbuffer_height = GLWin.height;
// Setup window attributes
GLWin.attr.colormap = XCreateColormap(GLWin.dpy,
GLWin.parent, GLWin.vi->visual, AllocNone);
@ -188,33 +147,15 @@ void CreateXWindow (void)
GLWin.xEventThread = new Common::Thread(XEventThread, NULL);
}
void ToggleDisplayMode (bool bFullscreen)
{
#if defined(HAVE_XRANDR) && HAVE_XRANDR
if (bFullscreen)
XRRSetScreenConfig(GLWin.dpy, GLWin.screenConfig, GLWin.parent,
GLWin.fullSize, GLWin.screenRotation, CurrentTime);
else
XRRSetScreenConfig(GLWin.dpy, GLWin.screenConfig, GLWin.parent,
GLWin.deskSize, GLWin.screenRotation, CurrentTime);
#endif
}
void DestroyXWindow(void)
{
/* switch back to original desktop resolution if we were in fullscreen */
#if defined(HAVE_XRANDR) && HAVE_XRANDR
ToggleDisplayMode(False);
#endif
XUnmapWindow(GLWin.dpy, GLWin.win);
GLWin.win = 0;
XFreeColormap(GLWin.dpy, GLWin.attr.colormap);
if (GLWin.xEventThread)
GLWin.xEventThread->WaitForDeath();
GLWin.xEventThread = NULL;
#if defined(HAVE_XRANDR) && HAVE_XRANDR
XRRFreeScreenConfigInfo(GLWin.screenConfig);
#endif
}
THREAD_RETURN XEventThread(void *pArg)
@ -285,8 +226,6 @@ THREAD_RETURN XEventThread(void *pArg)
case ClientMessage:
if ((ulong) event.xclient.data.l[0] == XInternAtom(GLWin.dpy, "WM_DELETE_WINDOW", False))
g_VideoInitialize.pCoreMessage(WM_USER_STOP);
if ((ulong) event.xclient.data.l[0] == XInternAtom(GLWin.dpy, "TOGGLE_DISPLAYMODE", False))
ToggleDisplayMode(event.xclient.data.l[1]);
if ((ulong) event.xclient.data.l[0] == XInternAtom(GLWin.dpy, "RESIZE", False))
XMoveResizeWindow(GLWin.dpy, GLWin.win, event.xclient.data.l[1],
event.xclient.data.l[2], event.xclient.data.l[3], event.xclient.data.l[4]);
@ -305,14 +244,12 @@ THREAD_RETURN XEventThread(void *pArg)
// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize()
bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight)
{
#if (!defined(HAVE_X11) || !HAVE_X11)
int _tx, _ty, _twidth, _theight;
g_VideoInitialize.pRequestWindowSize(_tx, _ty, _twidth, _theight);
// Control window size and picture scaling
s_backbuffer_width = _twidth;
s_backbuffer_height = _theight;
#endif
g_VideoInitialize.pPeekMessages = &Callback_PeekMessages;
g_VideoInitialize.pUpdateFPSDisplay = &UpdateFPSDisplay;
@ -439,6 +376,11 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
exit(0); // TODO: Don't bring down entire Emu
}
GLWin.x = _tx;
GLWin.y = _ty;
GLWin.width = _twidth;
GLWin.height = _theight;
CreateXWindow();
g_VideoInitialize.pXWindow = (Window *) &GLWin.win;
#endif
@ -455,6 +397,8 @@ bool OpenGL_MakeCurrent()
#elif defined(_WIN32)
return wglMakeCurrent(hDC,hRC);
#elif defined(HAVE_X11) && HAVE_X11
g_VideoInitialize.pRequestWindowSize(GLWin.x, GLWin.y, (int&)GLWin.width, (int&)GLWin.height);
XMoveResizeWindow(GLWin.dpy, GLWin.win, GLWin.x, GLWin.y, GLWin.width, GLWin.height);
return glXMakeCurrent(GLWin.dpy, GLWin.win, GLWin.ctx);
#endif
return true;
@ -519,7 +463,6 @@ void OpenGL_Shutdown()
cocoaGLDelete(GLWin.cocoaCtx);
#elif defined(_WIN32)
EmuWindow::ToggleDisplayMode(false);
if (hRC) // Do We Have A Rendering Context?
{
if (!wglMakeCurrent(NULL,NULL)) // Are We Able To Release The DC And RC Contexts?

View File

@ -44,9 +44,6 @@
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include "Thread.h"
#if defined(HAVE_XRANDR) && HAVE_XRANDR
#include <X11/extensions/Xrandr.h>
#endif // XRANDR
#elif defined(USE_SDL) && USE_SDL
#include <GL/glew.h>
@ -90,11 +87,6 @@ typedef struct {
GLXContext ctx;
XSetWindowAttributes attr;
Common::Thread *xEventThread;
#if defined(HAVE_XRANDR) && HAVE_XRANDR
XRRScreenConfiguration *screenConfig;
Rotation screenRotation;
int deskSize, fullSize;
#endif // XRANDR
#endif // X11
#if defined(USE_WX) && USE_WX
wxGLCanvas *glCanvas;

View File

@ -37,7 +37,6 @@ BEGIN_EVENT_TABLE(GFXConfigDialogOGL,wxDialog)
EVT_BUTTON(wxID_CLOSE, GFXConfigDialogOGL::CloseClick)
EVT_BUTTON(wxID_ABOUT, GFXConfigDialogOGL::AboutClick)
EVT_CHECKBOX(ID_VSYNC, GFXConfigDialogOGL::GeneralSettingsChanged)
EVT_CHOICE(ID_FULLSCREENRESOLUTION, GFXConfigDialogOGL::GeneralSettingsChanged)
EVT_CHOICE(ID_MAXANISOTROPY, GFXConfigDialogOGL::GeneralSettingsChanged)
EVT_CHOICE(ID_MSAAMODECB, GFXConfigDialogOGL::GeneralSettingsChanged)
EVT_CHECKBOX(ID_NATIVERESOLUTION, GFXConfigDialogOGL::GeneralSettingsChanged)
@ -125,13 +124,6 @@ void GFXConfigDialogOGL::CloseClick(wxCommandEvent& WXUNUSED (event))
// Add avaliable resolutions and other settings
// ---------------
void GFXConfigDialogOGL::AddFSReso(const char *reso)
{
arrayStringFor_FullscreenCB.Add(wxString::FromAscii(reso));
}
// This one could be used to reload shaders while dolphin is running...
void GFXConfigDialogOGL::LoadShaders()
{
@ -158,10 +150,6 @@ void GFXConfigDialogOGL::LoadShaders()
void GFXConfigDialogOGL::InitializeGUILists()
{
// Resolutions
if (arrayStringFor_FullscreenCB.empty())
AddFSReso("<No resolutions found>");
// Keep Aspect Ratio
arrayStringFor_AspectRatio.Add(wxT("Auto Aspect (recommended)"));
arrayStringFor_AspectRatio.Add(wxT("Force 16:9 Widescreen"));
@ -202,9 +190,6 @@ void GFXConfigDialogOGL::InitializeGUIValues()
m_NativeResolution->SetValue(g_Config.bNativeResolution);
m_2xResolution->SetValue(g_Config.b2xResolution);
int num = 0;
num = m_WindowFSResolutionCB->FindString(wxString::FromAscii(g_Config.cFSResolution));
m_WindowFSResolutionCB->SetSelection(num);
m_KeepAR->SetSelection(g_Config.iAspectRatio);
m_Crop->SetValue(g_Config.bCrop);
@ -285,9 +270,6 @@ void GFXConfigDialogOGL::InitializeGUITooltips()
wxT("\nis of the 5:4 format if you have selected the 4:3 aspect ratio. It will assume")
wxT("\nthat your screen is of the 16:10 format if you have selected the 16:9 aspect ratio.")
wxT("\n\nApplies instanty during gameplay: <Yes>"));
m_WindowFSResolutionCB->SetToolTip(
wxT("Select resolution for fullscreen mode")
wxT("\n\nApplies instantly during gameplay: <No>"));
m_MSAAModeCB->SetToolTip(wxT(
"Applies instanty during gameplay: <No>"));
m_OSDHotKey->SetToolTip(
@ -369,8 +351,6 @@ void GFXConfigDialogOGL::CreateGUIControls()
wxStaticText *IRText = new wxStaticText(m_PageGeneral, wxID_ANY, wxT("Resolution:"), wxDefaultPosition, wxDefaultSize, 0);
m_NativeResolution = new wxCheckBox(m_PageGeneral, ID_NATIVERESOLUTION, wxT("Native"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_2xResolution = new wxCheckBox(m_PageGeneral, ID_2X_RESOLUTION, wxT("2x"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
wxStaticText *RText = new wxStaticText(m_PageGeneral, wxID_ANY, wxT("Fullscreen Display Resolution:"), wxDefaultPosition, wxDefaultSize, 0);
m_WindowFSResolutionCB = new wxChoice(m_PageGeneral, ID_FULLSCREENRESOLUTION, wxDefaultPosition, wxDefaultSize, arrayStringFor_FullscreenCB, 0, wxDefaultValidator, arrayStringFor_FullscreenCB[0]);
// Aspect ratio / positioning controls
wxStaticText *KeepARText = new wxStaticText(m_PageGeneral, wxID_ANY, wxT("Keep aspect ratio:"), wxDefaultPosition, wxDefaultSize, 0);
m_KeepAR = new wxChoice(m_PageGeneral, ID_ASPECT, wxDefaultPosition, wxDefaultSize, arrayStringFor_AspectRatio);
@ -410,12 +390,9 @@ void GFXConfigDialogOGL::CreateGUIControls()
sBasic->Add(m_NativeResolution, wxGBPosition(0, 1), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL | wxALL, 5);
sBasic->Add(m_2xResolution, wxGBPosition(0, 2), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL | wxALL, 5);
sBasic->Add(RText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL | wxALL, 5);
sBasic->Add(m_WindowFSResolutionCB, wxGBPosition(1, 1), wxGBSpan(1, 1), wxALL, 5);
sBasic->Add(KeepARText, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL | wxALL, 5);
sBasic->Add(m_KeepAR, wxGBPosition(2, 1), wxGBSpan(1, 1), wxALL, 5);
sBasic->Add(m_Crop, wxGBPosition(2, 2), wxGBSpan(1, 1), wxALL | wxALIGN_CENTER_VERTICAL, 5);
sBasic->Add(KeepARText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL | wxALL, 5);
sBasic->Add(m_KeepAR, wxGBPosition(1, 1), wxGBSpan(1, 1), wxALL, 5);
sBasic->Add(m_Crop, wxGBPosition(1, 2), wxGBSpan(1, 1), wxALL | wxALIGN_CENTER_VERTICAL, 5);
sbBasic->Add(sBasic);
sGeneral->Add(sbBasic, 0, wxEXPAND|wxALL, 5);
@ -629,9 +606,6 @@ void GFXConfigDialogOGL::GeneralSettingsChanged(wxCommandEvent& event)
case ID_FORCEFILTERING:
g_Config.bForceFiltering = m_ForceFiltering->IsChecked();
break;
case ID_FULLSCREENRESOLUTION:
strcpy(g_Config.cFSResolution, m_WindowFSResolutionCB->GetStringSelection().mb_str() );
break;
case ID_MAXANISOTROPY:
g_Config.iMaxAnisotropy = m_MaxAnisotropyCB->GetSelection() + 1;
break;
@ -786,7 +760,6 @@ void GFXConfigDialogOGL::UpdateGUI()
//besides, it would look odd if one disabled native, and it came back on again.
m_NativeResolution->Enable(!g_Config.bUseRealXFB);
m_2xResolution->Enable(!g_Config.bUseRealXFB && (!g_Config.bRunning || Renderer::Allow2x()));
m_WindowFSResolutionCB->Enable(!g_Config.bRunning);
// Disable the Copy to options when EFBCopy is disabled
m_Radio_CopyEFBToRAM->Enable(!(g_Config.bEFBCopyDisable));

View File

@ -60,7 +60,6 @@ class GFXConfigDialogOGL : public wxDialog
virtual ~GFXConfigDialogOGL();
void CloseClick(wxCommandEvent& event);
void AddFSReso(const char *reso);
void CreateGUIControls();
void GameIniLoad();
@ -98,7 +97,6 @@ class GFXConfigDialogOGL : public wxDialog
wxCheckBox *m_UseXFB;
wxCheckBox *m_UseRealXFB;
wxCheckBox *m_AutoScale;
wxChoice *m_WindowFSResolutionCB;
wxChoice *m_MaxAnisotropyCB;
wxChoice *m_MSAAModeCB, *m_PhackvalueCB, *m_PostShaderCB, *m_KeepAR;
@ -155,7 +153,6 @@ class GFXConfigDialogOGL : public wxDialog
ID_AUTOSCALE,
ID_WIDESCREENHACK,
ID_FULLSCREENRESOLUTION,
ID_FORCEFILTERING,
ID_MAXANISOTROPY,
ID_MAXANISOTROPYTEXT,

View File

@ -230,27 +230,6 @@ void OnKeyDown(WPARAM wParam)
}
// ---------------------------------------------------------------------
void ToggleDisplayMode (int bFullscreen)
{
if (bFullscreen)
{
DEVMODE dmScreenSettings;
memset(&dmScreenSettings,0,sizeof(dmScreenSettings));
dmScreenSettings.dmSize = sizeof(dmScreenSettings);
sscanf(g_Config.cFSResolution, "%dx%d", &dmScreenSettings.dmPelsWidth, &dmScreenSettings.dmPelsHeight);
dmScreenSettings.dmBitsPerPel = 32;
dmScreenSettings.dmFields = DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;
// Try To Set Selected Mode And Get Results. NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar.
ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN);
}
else
{
// Change to default resolution
ChangeDisplaySettings(NULL, CDS_FULLSCREEN);
}
}
// Should really take a look at the mouse stuff in here - some of it is weird.
LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
@ -289,8 +268,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
PostMessage(m_hParent, WM_USER, wParam, lParam);
}
else if (wParam == TOGGLE_DISPLAYMODE)
ToggleDisplayMode(lParam);
break;
// This is called when we close the window when we render to a separate window

View File

@ -99,11 +99,6 @@ if sys.platform == 'win32':
]
gfxenv['CPPPATH'] += libs
# check for Xrandr
gfxenv['HAVE_XRANDR'] = gfxenv['HAVE_X11'] and conf.CheckPKG('xrandr')
conf.Define('HAVE_XRANDR', gfxenv['HAVE_XRANDR'])
conf.Finish()
# Sanity check

View File

@ -170,88 +170,6 @@ void DllDebugger(HWND _hParent, bool Show)
#endif
}
// Search for avaliable resolutions
void AddResolutions()
{
#ifdef _WIN32
DWORD iModeNum = 0;
DEVMODE dmi;
ZeroMemory(&dmi, sizeof(dmi));
dmi.dmSize = sizeof(dmi);
std::vector<std::string> resos;
while (EnumDisplaySettings(NULL, iModeNum++, &dmi) != 0)
{
char res[100];
sprintf(res, "%dx%d", dmi.dmPelsWidth, dmi.dmPelsHeight);
std::string strRes(res);
// Only add unique resolutions
if (std::find(resos.begin(), resos.end(), strRes) == resos.end())
{
resos.push_back(strRes);
m_ConfigFrame->AddFSReso(res);
}
ZeroMemory(&dmi, sizeof(dmi));
}
#elif defined(HAVE_X11) && HAVE_X11 && defined(HAVE_XRANDR) \
&& HAVE_XRANDR && defined(HAVE_WX) && HAVE_WX
// Don't modify GLWin.dpy here.
// If the emulator is running that is bad.
Display *dpy;
int screen;
dpy = XOpenDisplay(0);
screen = DefaultScreen(dpy);
//Get all full screen resos for the config dialog
XRRScreenSize *sizes = NULL;
int modeNum = 0;
sizes = XRRSizes(dpy, screen, &modeNum);
XCloseDisplay(dpy);
if (modeNum > 0 && sizes != NULL)
{
for (int i = 0; i < modeNum; i++)
{
char temp[32];
sprintf(temp,"%dx%d", sizes[i].width, sizes[i].height);
m_ConfigFrame->AddFSReso(temp);
}
}
#elif defined(HAVE_COCOA) && HAVE_COCOA && defined(HAVE_WX) && HAVE_WX
CGDisplayModeRef mode;
CFArrayRef array;
CFIndex n, i;
int w, h;
std::vector<std::string> resos;
array = CGDisplayCopyAllDisplayModes(CGMainDisplayID(), NULL);
n = CFArrayGetCount(array);
for (i = 0; i < n; i++)
{
mode = (CGDisplayModeRef)CFArrayGetValueAtIndex(array, i);
w = CGDisplayModeGetWidth(mode);
h = CGDisplayModeGetHeight(mode);
char res[32];
sprintf(res,"%dx%d", w, h);
std::string strRes(res);
// Only add unique resolutions
if (std::find(resos.begin(), resos.end(), strRes) == resos.end())
{
resos.push_back(strRes);
m_ConfigFrame->AddFSReso(res);
}
}
CFRelease(array);
#endif
}
void DllConfig(HWND _hParent)
{
g_Config.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_opengl.ini").c_str());
@ -262,8 +180,6 @@ void DllConfig(HWND _hParent)
wxWindow *frame = GetParentedWxWindow(_hParent);
m_ConfigFrame = new GFXConfigDialogOGL(frame);
AddResolutions();
// Prevent user to show more than 1 config window at same time
#ifdef _WIN32
frame->Disable();

View File

@ -87,12 +87,6 @@ if sys.platform == 'win32':
]
gfxenv['CPPPATH'] += libs
# check for Xrandr
gfxenv['HAVE_XRANDR'] = gfxenv['HAVE_X11'] and conf.CheckPKG('xrandr')
conf.Define('HAVE_XRANDR', gfxenv['HAVE_XRANDR'])
conf.Finish()
# Sanity check