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

@ -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();
@ -182,7 +187,11 @@ void CConfigMain::InitializeGUILists()
arrayStringFor_WiiSystemLang.Add(wxT("Korean"));
// 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;