In linux process events from the main frame regularly to update statusbar text

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5018 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice 2010-02-06 01:08:36 +00:00
parent c65bfbdf7b
commit d979532c00
3 changed files with 26 additions and 10 deletions

View File

@ -285,7 +285,7 @@ EVT_SIZE(CFrame::OnResize)
EVT_MOVE(CFrame::OnMove) EVT_MOVE(CFrame::OnMove)
EVT_LIST_ITEM_ACTIVATED(LIST_CTRL, CFrame::OnGameListCtrl_ItemActivated) EVT_LIST_ITEM_ACTIVATED(LIST_CTRL, CFrame::OnGameListCtrl_ItemActivated)
EVT_HOST_COMMAND(wxID_ANY, CFrame::OnHostMessage) EVT_HOST_COMMAND(wxID_ANY, CFrame::OnHostMessage)
#if wxUSE_TIMER && defined _WIN32 #if wxUSE_TIMER
EVT_TIMER(wxID_ANY, CFrame::OnTimer) EVT_TIMER(wxID_ANY, CFrame::OnTimer)
#endif #endif
@ -324,8 +324,10 @@ CFrame::CFrame(wxFrame* parent,
, bRenderToMain(false), bFloatLogWindow(false), bFloatConsoleWindow(false) , bRenderToMain(false), bFloatLogWindow(false), bFloatConsoleWindow(false)
, HaveLeds(false), HaveSpeakers(false) , HaveLeds(false), HaveSpeakers(false)
, m_bControlsCreated(false), bNoWiimoteMsg(false), m_StopDlg(NULL) , m_bControlsCreated(false), bNoWiimoteMsg(false), m_StopDlg(NULL)
#if wxUSE_TIMER && defined _WIN32 #if wxUSE_TIMER
#ifdef _WIN32
, m_fLastClickTime(0), m_iLastMotionTime(0), LastMouseX(0), LastMouseY(0) , m_fLastClickTime(0), m_iLastMotionTime(0), LastMouseX(0), LastMouseY(0)
#endif
, m_timer(this) , m_timer(this)
#endif #endif
@ -348,7 +350,7 @@ CFrame::CFrame(wxFrame* parent,
} }
// Create timer // Create timer
#if wxUSE_TIMER && defined _WIN32 #if wxUSE_TIMER
int TimesPerSecond = 10; // We don't need more than this int TimesPerSecond = 10; // We don't need more than this
m_timer.Start( floor((double)(1000 / TimesPerSecond)) ); m_timer.Start( floor((double)(1000 / TimesPerSecond)) );
#endif #endif
@ -506,7 +508,7 @@ CFrame::~CFrame()
cdio_free_device_list(drives); cdio_free_device_list(drives);
/* The statbar sample has this so I add this to, but I guess timer will be deleted after /* The statbar sample has this so I add this to, but I guess timer will be deleted after
this anyway */ this anyway */
#if wxUSE_TIMER && defined _WIN32 #if wxUSE_TIMER
if (m_timer.IsRunning()) m_timer.Stop(); if (m_timer.IsRunning()) m_timer.Stop();
#endif #endif
@ -612,6 +614,18 @@ WXLRESULT CFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
} }
#endif #endif
void CFrame::OnTimer(wxTimerEvent& WXUNUSED(event))
{
#ifdef _WIN32
Update();
#else
// Process events in linux. Primarily to update the statusbar text.
// This should be unnecessary if we ever get WXGL and render to main working
if (wxGetApp().Pending())
wxGetApp().ProcessPendingEvents();
#endif
}
void CFrame::OnHostMessage(wxCommandEvent& event) void CFrame::OnHostMessage(wxCommandEvent& event)
{ {
switch (event.GetId()) switch (event.GetId())

View File

@ -337,14 +337,17 @@ class CFrame : public wxFrame
void BootGame(const std::string& filename); void BootGame(const std::string& filename);
// Double click and mouse move options // Double click and mouse move options
#if wxUSE_TIMER && defined _WIN32 #if wxUSE_TIMER
#ifdef _WIN32
double m_fLastClickTime, m_iLastMotionTime; double m_fLastClickTime, m_iLastMotionTime;
int LastMouseX, LastMouseY; int LastMouseX, LastMouseY;
void Update(); void Update();
void OnTimer(wxTimerEvent& WXUNUSED(event)) { Update(); } #endif
wxTimer m_timer; // Used in linux to process command events
#endif void OnTimer(wxTimerEvent& WXUNUSED(event));
wxTimer m_timer;
#endif
// Event table // Event table
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();

View File

@ -567,7 +567,6 @@ void OpenGL_Update()
// Close plugin // Close plugin
void OpenGL_Shutdown() void OpenGL_Shutdown()
{ {
printf("Deleting\n");
#if defined(USE_WX) && USE_WX #if defined(USE_WX) && USE_WX
delete GLWin.glCanvas; delete GLWin.glCanvas;
delete GLWin.frame; delete GLWin.frame;