Merge remote-tracking branch 'upstream/master' into newqt2

This commit is contained in:
Cacodemon345
2022-04-24 00:58:08 +06:00
5 changed files with 33 additions and 36 deletions

View File

@@ -35,7 +35,7 @@ if(MUNT_EXTERNAL)
endif() endif()
project(86Box project(86Box
VERSION 3.4 VERSION 3.4.1
DESCRIPTION "Emulator of x86-based systems" DESCRIPTION "Emulator of x86-based systems"
HOMEPAGE_URL "https://86box.net" HOMEPAGE_URL "https://86box.net"
LANGUAGES C CXX) LANGUAGES C CXX)

View File

@@ -22,10 +22,10 @@
#define EMU_VERSION "3.4" #define EMU_VERSION "3.4"
#define EMU_VERSION_W LSTR(EMU_VERSION) #define EMU_VERSION_W LSTR(EMU_VERSION)
#define EMU_VERSION_EX "3.40" #define EMU_VERSION_EX "3.41"
#define EMU_VERSION_MAJ 3 #define EMU_VERSION_MAJ 3
#define EMU_VERSION_MIN 4 #define EMU_VERSION_MIN 4
#define EMU_VERSION_PATCH 0 #define EMU_VERSION_PATCH 1
#define EMU_BUILD_NUM 0 #define EMU_BUILD_NUM 0
@@ -40,7 +40,7 @@
#define EMU_ROMS_URL "https://github.com/86Box/roms/releases/latest" #define EMU_ROMS_URL "https://github.com/86Box/roms/releases/latest"
#define EMU_ROMS_URL_W LSTR(EMU_ROMS_URL) #define EMU_ROMS_URL_W LSTR(EMU_ROMS_URL)
#ifdef RELEASE_BUILD #ifdef RELEASE_BUILD
# define EMU_DOCS_URL "https://86box.readthedocs.io/en/v3.2/" # define EMU_DOCS_URL "https://86box.readthedocs.io/en/v3.4/"
#else #else
# define EMU_DOCS_URL "https://86box.readthedocs.io" # define EMU_DOCS_URL "https://86box.readthedocs.io"
#endif #endif

View File

@@ -207,12 +207,12 @@ MainWindow::MainWindow(QWidget *parent) :
qt_mouse_capture(mouse_capture); qt_mouse_capture(mouse_capture);
if (mouse_capture) { if (mouse_capture) {
this->grabKeyboard(); this->grabKeyboard();
if (ui->stackedWidget->mouse_capture) if (ui->stackedWidget->mouse_capture_func)
ui->stackedWidget->mouse_capture(this->windowHandle()); ui->stackedWidget->mouse_capture_func(this->windowHandle());
} else { } else {
this->releaseKeyboard(); this->releaseKeyboard();
if (ui->stackedWidget->mouse_uncapture) if (ui->stackedWidget->mouse_uncapture_func)
ui->stackedWidget->mouse_uncapture(); ui->stackedWidget->mouse_uncapture_func();
} }
}); });
@@ -514,11 +514,11 @@ void MainWindow::closeEvent(QCloseEvent *event) {
} }
qt_nvr_save(); qt_nvr_save();
config_save(); config_save();
if (ui->stackedWidget->mouse_exit)
ui->stackedWidget->mouse_exit(); if (ui->stackedWidget->mouse_exit_func)
ui->stackedWidget->mouse_exit_func();
ui->stackedWidget->switchRenderer(RendererStack::Renderer::Software); ui->stackedWidget->switchRenderer(RendererStack::Renderer::Software);
event->accept(); event->accept();
} }

View File

@@ -44,6 +44,7 @@ extern "C" {
#include <86box/video.h> #include <86box/video.h>
} }
extern "C" void macos_poll_mouse();
extern MainWindow *main_window; extern MainWindow *main_window;
RendererStack::RendererStack(QWidget *parent) RendererStack::RendererStack(QWidget *parent)
: QStackedWidget(parent) : QStackedWidget(parent)
@@ -67,30 +68,30 @@ RendererStack::RendererStack(QWidget *parent)
# ifdef WAYLAND # ifdef WAYLAND
if (!stricmp(mouse_type, "wayland")) { if (!stricmp(mouse_type, "wayland")) {
this->mouse_init = wl_init; wl_init();
this->mouse_poll = wl_mouse_poll; this->mouse_poll_func = wl_mouse_poll;
this->mouse_capture = wl_mouse_capture; this->mouse_capture_func = wl_mouse_capture;
this->mouse_uncapture = wl_mouse_uncapture; this->mouse_uncapture_func = wl_mouse_uncapture;
} else } else
# endif # endif
# ifdef EVDEV_INPUT # ifdef EVDEV_INPUT
if (!stricmp(mouse_type, "evdev")) { if (!stricmp(mouse_type, "evdev")) {
this->mouse_init = evdev_init; evdev_init();
this->mouse_poll = evdev_mouse_poll; this->mouse_poll_func = evdev_mouse_poll;
} else } else
# endif # endif
if (!stricmp(mouse_type, "xinput2")) { if (!stricmp(mouse_type, "xinput2")) {
extern void xinput2_init(); extern void xinput2_init();
extern void xinput2_poll(); extern void xinput2_poll();
extern void xinput2_exit(); extern void xinput2_exit();
this->mouse_init = xinput2_init; xinput2_init();
this->mouse_poll = xinput2_poll; this->mouse_poll_func = xinput2_poll;
this->mouse_exit = xinput2_exit; this->mouse_exit_func = xinput2_exit;
} }
#endif #endif
#ifdef __APPLE__
if (this->mouse_init) this->mouse_poll_func = macos_poll_mouse;
this->mouse_init(); #endif
} }
RendererStack::~RendererStack() RendererStack::~RendererStack()
@@ -98,7 +99,6 @@ RendererStack::~RendererStack()
delete ui; delete ui;
} }
extern "C" void macos_poll_mouse();
void void
qt_mouse_capture(int on) qt_mouse_capture(int on)
{ {
@@ -121,18 +121,16 @@ qt_mouse_capture(int on)
void void
RendererStack::mousePoll() RendererStack::mousePoll()
{ {
#ifdef __APPLE__ #ifndef __APPLE__
return macos_poll_mouse();
#else /* !defined __APPLE__ */
mouse_x = mousedata.deltax; mouse_x = mousedata.deltax;
mouse_y = mousedata.deltay; mouse_y = mousedata.deltay;
mouse_z = mousedata.deltaz; mouse_z = mousedata.deltaz;
mousedata.deltax = mousedata.deltay = mousedata.deltaz = 0; mousedata.deltax = mousedata.deltay = mousedata.deltaz = 0;
mouse_buttons = mousedata.mousebuttons; mouse_buttons = mousedata.mousebuttons;
if (this->mouse_poll) if (this->mouse_poll_func)
this->mouse_poll(); #endif
#endif /* !defined __APPLE__ */ this->mouse_poll_func();
} }
int ignoreNextMouseEvent = 1; int ignoreNextMouseEvent = 1;

View File

@@ -65,11 +65,10 @@ public:
rendererWindow->onResize(width, height); rendererWindow->onResize(width, height);
} }
void (*mouse_init)() = nullptr; void (*mouse_poll_func)() = nullptr;
void (*mouse_poll)() = nullptr; void (*mouse_capture_func)(QWindow *window) = nullptr;
void (*mouse_capture)(QWindow *window) = nullptr; void (*mouse_uncapture_func)() = nullptr;
void (*mouse_uncapture)() = nullptr; void (*mouse_exit_func)() = nullptr;
void (*mouse_exit)() = nullptr;
signals: signals:
void blitToRenderer(int buf_idx, int x, int y, int w, int h); void blitToRenderer(int buf_idx, int x, int y, int w, int h);