Disable FreeBSD console mouse when initializing evdev input Enable it again after quitting evdev input.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
diff --git a/src/core/freebsd/SDL_evdev_kbd_freebsd.c b/src/core/freebsd/SDL_evdev_kbd_freebsd.c
index 059b5ec..69496ab 100644
--- a/src/core/freebsd/SDL_evdev_kbd_freebsd.c
+++ b/src/core/freebsd/SDL_evdev_kbd_freebsd.c
@@ -87,15 +87,17 @@ static int fatal_signals[] =
static void kbd_cleanup(void)
{
+ struct mouse_info mData;
SDL_EVDEV_keyboard_state* kbd = kbd_cleanup_state;
if (kbd == NULL) {
return;
}
kbd_cleanup_state = NULL;
-
+ mData.operation = MOUSE_SHOW;
ioctl(kbd->keyboard_fd, KDSKBMODE, kbd->old_kbd_mode);
if (kbd->keyboard_fd != kbd->console_fd) close(kbd->keyboard_fd);
ioctl(kbd->console_fd, CONS_SETKBD, (unsigned long)(kbd->kbInfo->kb_index));
+ ioctl(kbd->console_fd, CONS_MOUSECTL, &mData);
}
void
@@ -221,9 +223,12 @@ SDL_EVDEV_keyboard_state *
SDL_EVDEV_kbd_init(void)
{
SDL_EVDEV_keyboard_state *kbd;
+ struct mouse_info mData;
char flag_state;
char* devicePath;
+ memset(&mData, 0, sizeof(struct mouse_info));
+ mData.operation = MOUSE_HIDE;
kbd = (SDL_EVDEV_keyboard_state *)SDL_calloc(1, sizeof(SDL_EVDEV_keyboard_state));
if (!kbd) {
return NULL;
@@ -241,7 +246,8 @@ SDL_EVDEV_kbd_init(void)
kbd->kbInfo = SDL_calloc(sizeof(keyboard_info_t), 1);
ioctl(kbd->console_fd, KDGKBINFO, kbd->kbInfo);
-
+ ioctl(kbd->console_fd, CONS_MOUSECTL, &mData);
+
if (ioctl(kbd->console_fd, KDGKBSTATE, &flag_state) == 0) {
kbd->ledflagstate = flag_state;
}
@@ -292,9 +298,14 @@ SDL_EVDEV_kbd_init(void)
void
SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *kbd)
{
+ struct mouse_info mData;
+
if (!kbd) {
return;
}
+ memset(&mData, 0, sizeof(struct mouse_data));
+ mData.operation = MOUSE_SHOW;
+ ioctl(kbd->console_fd, CONS_MOUSECTL, &mData);
kbd_unregister_emerg_cleanup();