mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-24 02:03:06 -05:00
65 lines
1.5 KiB
Diff
65 lines
1.5 KiB
Diff
--- MilkyTracker-1.03.00/src/tracker/sdl/SDL_Main.cpp 2021-04-27 15:17:42.529000000 +1000
|
|
+++ MilkyTracker-1.03.00/src/tracker/sdl/SDL_Main.cpp 2021-04-27 15:17:42.529000000 +1000
|
|
@@ -68,6 +68,8 @@
|
|
|
|
#include <SDL.h>
|
|
#include "SDL_KeyTranslation.h"
|
|
+
|
|
+#include <LibCore/Timer.h>
|
|
// ---------------------------- Tracker includes ----------------------------
|
|
#include "PPUI.h"
|
|
#include "DisplayDevice_SDL.h"
|
|
@@ -83,7 +85,7 @@
|
|
#endif
|
|
// --------------------------------------------------------------------------
|
|
|
|
-static SDL_TimerID timer;
|
|
+RefPtr<Core::Timer> m_timer;
|
|
|
|
// Tracker globals
|
|
static PPScreen* myTrackerScreen = NULL;
|
|
@@ -163,11 +165,11 @@
|
|
SDLUserEventMidiKeyUp,
|
|
};
|
|
|
|
-static Uint32 SDLCALL timerCallback(Uint32 interval, void* param)
|
|
+static void timerCallback()
|
|
{
|
|
if (!myTrackerScreen || !myTracker || !ticking)
|
|
{
|
|
- return interval;
|
|
+ return;
|
|
}
|
|
|
|
SDL_UserEvent ev;
|
|
@@ -219,8 +221,6 @@
|
|
//PPEvent myEvent(eRMouseRepeat, &p, sizeof(PPPoint));
|
|
//RaiseEventSerialized(&myEvent);
|
|
}
|
|
-
|
|
- return interval;
|
|
}
|
|
|
|
#ifdef HAVE_LIBRTMIDI
|
|
@@ -834,7 +834,12 @@
|
|
#endif
|
|
|
|
// Try to create timer
|
|
- timer = SDL_AddTimer(20, timerCallback, NULL);
|
|
+ m_timer = Core::Timer::construct();
|
|
+ m_timer->on_timeout = [&]() {
|
|
+ timerCallback();
|
|
+ };
|
|
+ m_timer->set_interval(20);
|
|
+ m_timer->start();
|
|
|
|
// Start capturing text input events
|
|
SDL_StartTextInput();
|
|
@@ -1033,7 +1038,6 @@
|
|
}
|
|
|
|
ticking = false;
|
|
- SDL_RemoveTimer(timer);
|
|
|
|
globalMutex->lock();
|
|
#ifdef HAVE_LIBRTMIDI
|