diff --git a/Makefile.common b/Makefile.common
index fa21d0b0c3..cbb1c91dd3 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -1101,8 +1101,7 @@ ifeq ($(HAVE_OPENDINGUX_FBDEV), 1)
endif
ifeq ($(HAVE_X11), 1)
- OBJ += input/common/input_x11_common.o \
- input/drivers/x11_input.o \
+ OBJ += input/drivers/x11_input.o \
gfx/common/x11_common.o \
gfx/common/xinerama_common.o \
gfx/display_servers/dispserv_x11.o
diff --git a/input/common/input_x11_common.c b/input/common/input_x11_common.c
deleted file mode 100644
index cd3bbcddaf..0000000000
--- a/input/common/input_x11_common.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/* RetroArch - A frontend for libretro.
- * Copyright (C) 2010-2014 - Hans-Kristian Arntzen
- * Copyright (C) 2011-2017 - Daniel De Matteis
- *
- * RetroArch is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Found-
- * ation, either version 3 of the License, or (at your option) any later version.
- *
- * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with RetroArch.
- * If not, see .
- */
-
-#include
-
-#include "input_x11_common.h"
-
-/* TODO/FIXME - static globals */
-static bool x11_mouse_wu;
-static bool x11_mouse_wd;
-static bool x11_mouse_hwu;
-static bool x11_mouse_hwd;
-
-int16_t x_mouse_state_wheel(unsigned id)
-{
- int16_t ret = 0;
-
- switch (id)
- {
- case RETRO_DEVICE_ID_MOUSE_WHEELUP:
- ret = x11_mouse_wu;
- x11_mouse_wu = 0;
- return ret;
- case RETRO_DEVICE_ID_MOUSE_WHEELDOWN:
- ret = x11_mouse_wd;
- x11_mouse_wd = 0;
- return ret;
- case RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELUP:
- ret = x11_mouse_hwu;
- x11_mouse_hwu = 0;
- return ret;
- case RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELDOWN:
- ret = x11_mouse_hwd;
- x11_mouse_hwd = 0;
- return ret;
- }
-
- return 0;
-}
-
-void x_input_poll_wheel(XButtonEvent *event, bool latch)
-{
- switch (event->button)
- {
- case 4:
- x11_mouse_wu = 1;
- break;
- case 5:
- x11_mouse_wd = 1;
- break;
- case 6:
- /* Scroll wheel left == HORIZ_WHEELDOWN */
- x11_mouse_hwd = 1;
- break;
- case 7:
- /* Scroll wheel right == HORIZ_WHEELUP */
- x11_mouse_hwu = 1;
- break;
- }
-}
diff --git a/input/drivers/x11_input.c b/input/drivers/x11_input.c
index ec8ddd84d8..ff679967e5 100644
--- a/input/drivers/x11_input.c
+++ b/input/drivers/x11_input.c
@@ -40,6 +40,10 @@ typedef struct x11_input
Window win;
char state[32];
+ bool mouse_wu;
+ bool mouse_wd;
+ bool mouse_hwu;
+ bool mouse_hwd;
bool mouse_l, mouse_r, mouse_m;
int mouse_x, mouse_y;
int mouse_last_x, mouse_last_y;
@@ -77,6 +81,33 @@ static bool x_keyboard_pressed(x11_input_t *x11, unsigned key)
return x11->state[keycode >> 3] & (1 << (keycode & 7));
}
+static int16_t x_mouse_state_wheel(x11_input_t *x11, unsigned id)
+{
+ int16_t ret = 0;
+
+ switch (id)
+ {
+ case RETRO_DEVICE_ID_MOUSE_WHEELUP:
+ ret = x11->mouse_wu;
+ x11->mouse_wu = 0;
+ return ret;
+ case RETRO_DEVICE_ID_MOUSE_WHEELDOWN:
+ ret = x11->mouse_wd;
+ x11->mouse_wd = 0;
+ return ret;
+ case RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELUP:
+ ret = x11->mouse_hwu;
+ x11->mouse_hwu = 0;
+ return ret;
+ case RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELDOWN:
+ ret = x11->mouse_hwd;
+ x11->mouse_hwd = 0;
+ return ret;
+ }
+
+ return 0;
+}
+
static bool x_mouse_button_pressed(
x11_input_t *x11, unsigned port, unsigned key)
{
@@ -100,7 +131,7 @@ static bool x_mouse_button_pressed(
case RETRO_DEVICE_ID_MOUSE_WHEELDOWN:
case RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELUP:
case RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELDOWN:
- return x_mouse_state_wheel(key);
+ return x_mouse_state_wheel(x11, key);
}
return false;
@@ -199,7 +230,7 @@ static int16_t x_mouse_state(x11_input_t *x11, unsigned id)
case RETRO_DEVICE_ID_MOUSE_WHEELDOWN:
case RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELUP:
case RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELDOWN:
- return x_mouse_state_wheel(id);
+ return x_mouse_state_wheel(x11, id);
case RETRO_DEVICE_ID_MOUSE_MIDDLE:
return x11->mouse_m;
}