Selectable mouse type on Linux, part 2
This commit is contained in:
@@ -50,21 +50,43 @@ RendererStack::RendererStack(QWidget *parent)
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
#if defined __unix__ && !defined __HAIKU__
|
#if defined __unix__ && !defined __HAIKU__
|
||||||
# ifdef WAYLAND
|
char *mouse_type = getenv("EMU86BOX_MOUSE"), auto_mouse_type[16];
|
||||||
if (QApplication::platformName().contains("wayland")) {
|
if (!mouse_type || (mouse_type[0] == '\0') || !stricmp(mouse_type, "auto")) {
|
||||||
wl_init();
|
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")) {
|
||||||
|
this->mouse_init = wl_init;
|
||||||
|
this->mouse_poll = wl_mouse_poll;
|
||||||
|
this->mouse_capture = wl_mouse_capture;
|
||||||
|
this->mouse_uncapture = wl_mouse_uncapture;
|
||||||
|
} else
|
||||||
# endif
|
# endif
|
||||||
# ifdef EVDEV_INPUT
|
# ifdef EVDEV_INPUT
|
||||||
if (QApplication::platformName() == "eglfs") {
|
if (!stricmp(mouse_type, "evdev")) {
|
||||||
evdev_init();
|
this->mouse_init = evdev_init;
|
||||||
}
|
this->mouse_poll = evdev_mouse_poll;
|
||||||
|
} else
|
||||||
# endif
|
# endif
|
||||||
if (QApplication::platformName() == "xcb") {
|
if (!stricmp(mouse_type, "xinput2")) {
|
||||||
extern void xinput2_init();
|
extern void xinput2_init();
|
||||||
xinput2_init();
|
extern void xinput2_poll();
|
||||||
|
this->mouse_init = xinput2_init;
|
||||||
|
this->mouse_poll = xinput2_poll;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (this->mouse_init)
|
||||||
|
this->mouse_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
RendererStack::~RendererStack()
|
RendererStack::~RendererStack()
|
||||||
@@ -104,22 +126,8 @@ RendererStack::mousePoll()
|
|||||||
mousedata.deltax = mousedata.deltay = mousedata.deltaz = 0;
|
mousedata.deltax = mousedata.deltay = mousedata.deltaz = 0;
|
||||||
mouse_buttons = mousedata.mousebuttons;
|
mouse_buttons = mousedata.mousebuttons;
|
||||||
|
|
||||||
# if defined __unix__ && !defined __HAIKU__
|
if (this->mouse_poll)
|
||||||
# ifdef WAYLAND
|
this->mouse_poll();
|
||||||
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__ */
|
#endif /* !defined __APPLE__ */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user