diff --git a/source/glest_map_editor/main.cpp b/source/glest_map_editor/main.cpp index e67a085d..48199785 100755 --- a/source/glest_map_editor/main.cpp +++ b/source/glest_map_editor/main.cpp @@ -54,8 +54,7 @@ MainWindow::MainWindow() , enabledGroup(ctHeight) , fileModified(false) , menuBar(NULL) - , panel(NULL) - , timer(NULL) { + , panel(NULL) { this->panel = new wxPanel(this, wxID_ANY); @@ -305,10 +304,6 @@ MainWindow::MainWindow() lastPaintEvent.start(); -//#ifndef WIN32 - //timer = new wxTimer(this); - //timer->Start(250); -//#endif glCanvas->SetFocus(); } @@ -333,18 +328,10 @@ void MainWindow::init(string fname) { } void MainWindow::onClose(wxCloseEvent &event) { - if(timer != NULL) timer->Stop(); - if(timer != NULL) delete timer; - timer = NULL; - delete this; } MainWindow::~MainWindow() { - if(timer != NULL) timer->Stop(); - if(timer != NULL) delete timer; - timer = NULL; - delete glCanvas; delete program; } @@ -378,14 +365,6 @@ void MainWindow::setExtension() { } } -void MainWindow::onTimer(wxTimerEvent &event) { - wxPaintEvent paintEvent; - onPaint(paintEvent); -#ifdef WIN32 - //Update(); -#endif -} - void MainWindow::onMouseDown(wxMouseEvent &event, int x, int y) { if (event.LeftIsDown()) { program->setUndoPoint(enabledGroup); @@ -433,8 +412,8 @@ void MainWindow::onMouseMove(wxMouseEvent &event, int x, int y) { } void MainWindow::onPaint(wxPaintEvent &event) { - if(lastPaintEvent.getMillis() < 100) { - sleep(5); + if(lastPaintEvent.getMillis() < 70) { + sleep(1); return; } lastPaintEvent.start(); @@ -870,8 +849,6 @@ void MainWindow::uncheckRadius() { BEGIN_EVENT_TABLE(MainWindow, wxFrame) - EVT_TIMER(-1, MainWindow::onTimer) - EVT_CLOSE(MainWindow::onClose) // these are 'handled' by GlCanvas and funneled to these handlers diff --git a/source/glest_map_editor/main.h b/source/glest_map_editor/main.h index 90ef9b24..97515a9a 100644 --- a/source/glest_map_editor/main.h +++ b/source/glest_map_editor/main.h @@ -135,8 +135,6 @@ private: wxPanel *panel; - wxTimer *timer; - wxMenuBar *menuBar; wxMenu *menuFile; wxMenu *menuEdit; @@ -215,8 +213,6 @@ public: void onToolPlayer(wxCommandEvent &event); - void onTimer(wxTimerEvent &event); - void change(int x, int y); void uncheckBrush(); diff --git a/source/shared_lib/sources/platform/sdl/window.cpp b/source/shared_lib/sources/platform/sdl/window.cpp index 29e27b46..ea0bc492 100644 --- a/source/shared_lib/sources/platform/sdl/window.cpp +++ b/source/shared_lib/sources/platform/sdl/window.cpp @@ -479,19 +479,20 @@ void Window::handleMouseDown(SDL_Event event) { int n = (int) button; assert(n >= 0 && n < mbCount); - - if(ticks - lastMouseDown[n] < DOUBLECLICKTIME - && abs(lastMouseX[n] - event.button.x) < DOUBLECLICKDELTA - && abs(lastMouseY[n] - event.button.y) < DOUBLECLICKDELTA) { - eventMouseDown(event.button.x, event.button.y, button); - eventMouseDoubleClick(event.button.x, event.button.y, button); + if(n >= 0 && n < mbCount) { + if(ticks - lastMouseDown[n] < DOUBLECLICKTIME + && abs(lastMouseX[n] - event.button.x) < DOUBLECLICKDELTA + && abs(lastMouseY[n] - event.button.y) < DOUBLECLICKDELTA) { + eventMouseDown(event.button.x, event.button.y, button); + eventMouseDoubleClick(event.button.x, event.button.y, button); + } + else { + eventMouseDown(event.button.x, event.button.y, button); + } + lastMouseDown[n] = ticks; + lastMouseX[n] = event.button.x; + lastMouseY[n] = event.button.y; } - else { - eventMouseDown(event.button.x, event.button.y, button); - } - lastMouseDown[n] = ticks; - lastMouseX[n] = event.button.x; - lastMouseY[n] = event.button.y; } MouseButton Window::getMouseButton(int sdlButton) {