mirror of
https://github.com/libretro/RetroArch
synced 2025-03-06 04:13:52 +00:00
Revert "Remove input_x11_common.c and merge into x11_input.c"
This reverts commit a0948c1d9d7a67bce750dcfba16aa1feec7db710.
This commit is contained in:
parent
c4557c9bbc
commit
cd2d4f2248
@ -1101,7 +1101,8 @@ ifeq ($(HAVE_OPENDINGUX_FBDEV), 1)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_X11), 1)
|
||||
OBJ += input/drivers/x11_input.o \
|
||||
OBJ += input/common/input_x11_common.o \
|
||||
input/drivers/x11_input.o \
|
||||
gfx/common/x11_common.o \
|
||||
gfx/common/xinerama_common.o \
|
||||
gfx/display_servers/dispserv_x11.o
|
||||
|
73
input/common/input_x11_common.c
Normal file
73
input/common/input_x11_common.c
Normal file
@ -0,0 +1,73 @@
|
||||
/* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <libretro.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
}
|
@ -40,10 +40,6 @@ 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;
|
||||
@ -81,33 +77,6 @@ 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)
|
||||
{
|
||||
@ -131,7 +100,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(x11, key);
|
||||
return x_mouse_state_wheel(key);
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -230,7 +199,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(x11, id);
|
||||
return x_mouse_state_wheel(id);
|
||||
case RETRO_DEVICE_ID_MOUSE_MIDDLE:
|
||||
return x11->mouse_m;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user