From db0c90a835ebdfae465885d2666c27192c2c1982 Mon Sep 17 00:00:00 2001 From: "Joakim L. Gilje" Date: Mon, 6 Dec 2021 21:33:25 +0100 Subject: [PATCH] replaced sdl_timer with a qtimer, resulting in a binary which does not link sdl --- src/qt/CMakeLists.txt | 1 - src/qt/qt.c | 2 -- src/qt/qt_main.cpp | 17 +++++------------ src/qt/qt_mainwindow.cpp | 2 -- 4 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/qt/CMakeLists.txt b/src/qt/CMakeLists.txt index a07887e80..a577bcddc 100644 --- a/src/qt/CMakeLists.txt +++ b/src/qt/CMakeLists.txt @@ -10,7 +10,6 @@ add_library(plat STATIC qt.c qt_main.cpp qt_platform.cpp cpp11_thread.cpp) add_library(ui STATIC qt_ui.cpp qt_cdrom.c - qt_sdl.c qt_mainwindow.cpp qt_mainwindow.hpp diff --git a/src/qt/qt.c b/src/qt/qt.c index 40f25135c..5aca045dc 100644 --- a/src/qt/qt.c +++ b/src/qt/qt.c @@ -13,8 +13,6 @@ #include <86box/timer.h> #include <86box/nvr.h> -#include "qt_sdl.h" - int qt_nvr_save(void) { return nvr_save(); } diff --git a/src/qt/qt_main.cpp b/src/qt/qt_main.cpp index fcd317e54..1f0d3ea72 100644 --- a/src/qt/qt_main.cpp +++ b/src/qt/qt_main.cpp @@ -11,11 +11,7 @@ #include -#include "SDL.h" -#include "SDL_mutex.h" -#include "SDL_timer.h" #include "qt_mainwindow.hpp" -#include "qt_sdl.h" #include "cocoa_mouse.hpp" @@ -77,12 +73,6 @@ main_thread_fn() is_quit = 1; } -uint32_t timer_onesec(uint32_t interval, void* param) -{ - pc_onesec(); - return interval; -} - int main(int argc, char* argv[]) { QApplication app(argc, argv); #ifdef __APPLE__ @@ -90,7 +80,6 @@ int main(int argc, char* argv[]) { app.installNativeEventFilter(&cocoafilter); #endif elapsed_timer.start(); - SDL_Init(SDL_INIT_TIMER); pc_init(argc, argv); if (! pc_init_modules()) { @@ -113,7 +102,11 @@ int main(int argc, char* argv[]) { /* Set the PAUSE mode depending on the renderer. */ // plat_pause(0); - SDL_AddTimer(1000, timer_onesec, nullptr); + QTimer onesec; + QObject::connect(&onesec, &QTimer::timeout, &app, [] { + pc_onesec(); + }); + onesec.start(1000); /* Initialize the rendering window, or fullscreen. */ QTimer::singleShot(50, []() { plat_resize(640, 480); } ); diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index fb426ec8d..e0a19a49b 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -7,8 +7,6 @@ extern "C" { #include <86box/keyboard.h> #include <86box/plat.h> #include <86box/video.h> - -#include "qt_sdl.h" }; #include