Merge branch '86Box:master' into nec-v20
This commit is contained in:
22
src/86box.c
22
src/86box.c
@@ -398,9 +398,6 @@ pc_init(int argc, char *argv[])
|
||||
{
|
||||
char *ppath = NULL, *rpath = NULL;
|
||||
char *cfg = NULL, *p;
|
||||
#if !defined(__APPLE__) && !defined(_WIN32)
|
||||
char *appimage;
|
||||
#endif
|
||||
char temp[2048];
|
||||
struct tm *info;
|
||||
time_t now;
|
||||
@@ -413,15 +410,20 @@ pc_init(int argc, char *argv[])
|
||||
|
||||
/* Grab the executable's full path. */
|
||||
plat_get_exe_name(exe_path, sizeof(exe_path)-1);
|
||||
p = path_get_filename(exe_path);
|
||||
p = path_get_filename(exe_path);
|
||||
*p = '\0';
|
||||
|
||||
#if !defined(_WIN32) && !defined(__APPLE__)
|
||||
/* Grab the actual path if we are an AppImage. */
|
||||
appimage = getenv("APPIMAGE");
|
||||
if (appimage && (appimage[0] != '\0')) {
|
||||
path_get_dirname(exe_path, appimage);
|
||||
#if defined(__APPLE__)
|
||||
c = strlen(exe_path);
|
||||
if ((c >= 16) && !strcmp(&exe_path[c - 16], "/Contents/MacOS/")) {
|
||||
exe_path[c - 16] = '\0';
|
||||
p = path_get_filename(exe_path);
|
||||
*p = '\0';
|
||||
}
|
||||
#elif !defined(_WIN32)
|
||||
/* Grab the actual path if we are an AppImage. */
|
||||
p = getenv("APPIMAGE");
|
||||
if (p && (p[0] != '\0'))
|
||||
path_get_dirname(exe_path, p);
|
||||
#endif
|
||||
|
||||
path_slash(exe_path);
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
|
||||
#define EMU_VERSION "3.4"
|
||||
#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_MIN 4
|
||||
#define EMU_VERSION_PATCH 0
|
||||
#define EMU_VERSION_PATCH 1
|
||||
|
||||
#define EMU_BUILD_NUM 0
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#define EMU_ROMS_URL "https://github.com/86Box/roms/releases/latest"
|
||||
#define EMU_ROMS_URL_W LSTR(EMU_ROMS_URL)
|
||||
#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
|
||||
# define EMU_DOCS_URL "https://86box.readthedocs.io"
|
||||
#endif
|
||||
|
||||
@@ -207,18 +207,12 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
qt_mouse_capture(mouse_capture);
|
||||
if (mouse_capture) {
|
||||
this->grabKeyboard();
|
||||
#ifdef WAYLAND
|
||||
if (QGuiApplication::platformName().contains("wayland")) {
|
||||
wl_mouse_capture(this->windowHandle());
|
||||
}
|
||||
#endif
|
||||
if (ui->stackedWidget->mouse_capture_func)
|
||||
ui->stackedWidget->mouse_capture_func(this->windowHandle());
|
||||
} else {
|
||||
this->releaseKeyboard();
|
||||
#ifdef WAYLAND
|
||||
if (QGuiApplication::platformName().contains("wayland")) {
|
||||
wl_mouse_uncapture();
|
||||
}
|
||||
#endif
|
||||
if (ui->stackedWidget->mouse_uncapture_func)
|
||||
ui->stackedWidget->mouse_uncapture_func();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -515,10 +509,8 @@ void MainWindow::closeEvent(QCloseEvent *event) {
|
||||
}
|
||||
qt_nvr_save();
|
||||
config_save();
|
||||
#if defined __unix__ && !defined __HAIKU__
|
||||
extern void xinput2_exit();
|
||||
if (QApplication::platformName() == "xcb") xinput2_exit();
|
||||
#endif
|
||||
if (ui->stackedWidget->mouse_exit_func)
|
||||
ui->stackedWidget->mouse_exit_func();
|
||||
event->accept();
|
||||
}
|
||||
|
||||
|
||||
@@ -184,7 +184,12 @@ plat_dir_check(char *path)
|
||||
int
|
||||
plat_getcwd(char *bufp, int max)
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
/* Working directory for .app bundles is undefined. */
|
||||
strncpy(bufp, exe_path, max);
|
||||
#else
|
||||
CharPointer(bufp, max) = QDir::currentPath().toUtf8();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ extern "C" {
|
||||
#include <86box/video.h>
|
||||
}
|
||||
|
||||
extern "C" void macos_poll_mouse();
|
||||
extern MainWindow *main_window;
|
||||
RendererStack::RendererStack(QWidget *parent)
|
||||
: QStackedWidget(parent)
|
||||
@@ -50,21 +51,45 @@ RendererStack::RendererStack(QWidget *parent)
|
||||
ui->setupUi(this);
|
||||
|
||||
#if defined __unix__ && !defined __HAIKU__
|
||||
# ifdef WAYLAND
|
||||
if (QApplication::platformName().contains("wayland")) {
|
||||
wl_init();
|
||||
char *mouse_type = getenv("EMU86BOX_MOUSE"), auto_mouse_type[16];
|
||||
if (!mouse_type || (mouse_type[0] == '\0') || !stricmp(mouse_type, "auto")) {
|
||||
if (QApplication::platformName().contains("wayland"))
|
||||
strcpy(auto_mouse_type, "wayland");
|
||||
else if (QApplication::platformName() == "eglfs")
|
||||
strcpy(auto_mouse_type, "evdev");
|
||||
else if (QApplication::platformName() == "xcb")
|
||||
strcpy(auto_mouse_type, "xinput2");
|
||||
else
|
||||
auto_mouse_type[0] = '\0';
|
||||
mouse_type = auto_mouse_type;
|
||||
}
|
||||
|
||||
# ifdef WAYLAND
|
||||
if (!stricmp(mouse_type, "wayland")) {
|
||||
wl_init();
|
||||
this->mouse_poll_func = wl_mouse_poll;
|
||||
this->mouse_capture_func = wl_mouse_capture;
|
||||
this->mouse_uncapture_func = wl_mouse_uncapture;
|
||||
} else
|
||||
# endif
|
||||
# ifdef EVDEV_INPUT
|
||||
if (QApplication::platformName() == "eglfs") {
|
||||
if (!stricmp(mouse_type, "evdev")) {
|
||||
evdev_init();
|
||||
}
|
||||
this->mouse_poll_func = evdev_mouse_poll;
|
||||
} else
|
||||
# endif
|
||||
if (QApplication::platformName() == "xcb") {
|
||||
if (!stricmp(mouse_type, "xinput2")) {
|
||||
extern void xinput2_init();
|
||||
extern void xinput2_poll();
|
||||
extern void xinput2_exit();
|
||||
xinput2_init();
|
||||
this->mouse_poll_func = xinput2_poll;
|
||||
this->mouse_exit_func = xinput2_exit;
|
||||
}
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
this->mouse_poll_func = macos_poll_mouse;
|
||||
#endif
|
||||
}
|
||||
|
||||
RendererStack::~RendererStack()
|
||||
@@ -72,7 +97,6 @@ RendererStack::~RendererStack()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
extern "C" void macos_poll_mouse();
|
||||
void
|
||||
qt_mouse_capture(int on)
|
||||
{
|
||||
@@ -95,32 +119,16 @@ qt_mouse_capture(int on)
|
||||
void
|
||||
RendererStack::mousePoll()
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
return macos_poll_mouse();
|
||||
#else /* !defined __APPLE__ */
|
||||
#ifndef __APPLE__
|
||||
mouse_x = mousedata.deltax;
|
||||
mouse_y = mousedata.deltay;
|
||||
mouse_z = mousedata.deltaz;
|
||||
mousedata.deltax = mousedata.deltay = mousedata.deltaz = 0;
|
||||
mouse_buttons = mousedata.mousebuttons;
|
||||
mouse_buttons = mousedata.mousebuttons;
|
||||
|
||||
# if defined __unix__ && !defined __HAIKU__
|
||||
# ifdef WAYLAND
|
||||
if (QApplication::platformName().contains("wayland"))
|
||||
wl_mouse_poll();
|
||||
# endif
|
||||
|
||||
# ifdef EVDEV_INPUT
|
||||
if (QApplication::platformName() == "eglfs")
|
||||
evdev_mouse_poll();
|
||||
else
|
||||
# endif
|
||||
if (QApplication::platformName() == "xcb") {
|
||||
extern void xinput2_poll();
|
||||
xinput2_poll();
|
||||
}
|
||||
# endif /* defined __unix__ */
|
||||
#endif /* !defined __APPLE__ */
|
||||
if (this->mouse_poll_func)
|
||||
#endif
|
||||
this->mouse_poll_func();
|
||||
}
|
||||
|
||||
int ignoreNextMouseEvent = 1;
|
||||
|
||||
@@ -64,6 +64,11 @@ public:
|
||||
rendererWindow->onResize(width, height);
|
||||
}
|
||||
|
||||
void (*mouse_poll_func)() = nullptr;
|
||||
void (*mouse_capture_func)(QWindow *window) = nullptr;
|
||||
void (*mouse_uncapture_func)() = nullptr;
|
||||
void (*mouse_exit_func)() = nullptr;
|
||||
|
||||
signals:
|
||||
void blitToRenderer(int buf_idx, int x, int y, int w, int h);
|
||||
void rendererChanged();
|
||||
|
||||
Reference in New Issue
Block a user