mirror of
https://github.com/libretro/RetroArch
synced 2025-02-20 06:40:18 +00:00
Create input_driver_keyboard_mapping_is_blocked/input_driver_keyboard_mapping_set_block
This commit is contained in:
parent
0d0e050676
commit
0e046c2fbb
1
driver.h
1
driver.h
@ -267,7 +267,6 @@ typedef struct driver
|
||||
rarch_cmd_t *command;
|
||||
#endif
|
||||
bool block_hotkey;
|
||||
bool block_input;
|
||||
bool block_libretro_input;
|
||||
bool flushing_input;
|
||||
bool nonblock_state;
|
||||
|
@ -80,6 +80,7 @@ typedef struct state_device
|
||||
|
||||
typedef struct android_input
|
||||
{
|
||||
bool blocked;
|
||||
unsigned pads_connected;
|
||||
state_device_t pad_states[MAX_PADS];
|
||||
uint8_t pad_state[MAX_PADS][(LAST_KEYCODE + 7) / 8];
|
||||
@ -1034,6 +1035,22 @@ static const input_device_driver_t *android_input_get_joypad_driver(void *data)
|
||||
return android->joypad;
|
||||
}
|
||||
|
||||
static bool android_input_keyboard_mapping_is_blocked(void *data)
|
||||
{
|
||||
android_input_t *android = (android_input_t*)data;
|
||||
if (!android)
|
||||
return false;
|
||||
return android->blocked;
|
||||
}
|
||||
|
||||
static void android_input_keyboard_mapping_set_block(void *data, bool value)
|
||||
{
|
||||
android_input_t *android = (android_input_t*)data;
|
||||
if (!android)
|
||||
return;
|
||||
android->blocked = value;
|
||||
}
|
||||
|
||||
static void android_input_grab_mouse(void *data, bool state)
|
||||
{
|
||||
(void)data;
|
||||
@ -1066,4 +1083,6 @@ input_driver_t input_android = {
|
||||
NULL,
|
||||
android_input_set_rumble,
|
||||
android_input_get_joypad_driver,
|
||||
android_input_keyboard_mapping_is_blocked,
|
||||
android_input_keyboard_mapping_set_block,
|
||||
};
|
||||
|
@ -423,6 +423,22 @@ static const input_device_driver_t *cocoa_input_get_joypad_driver(void *data)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static bool cocoa_input_keyboard_mapping_is_blocked(void *data)
|
||||
{
|
||||
cocoa_input_data_t *apple = (cocoa_input_data_t*)data;
|
||||
if (!apple)
|
||||
return false;
|
||||
return apple->blocked;
|
||||
}
|
||||
|
||||
static void cocoa_input_keyboard_mapping_set_block(void *data, bool value)
|
||||
{
|
||||
cocoa_input_data_t *apple = (cocoa_input_data_t*)data;
|
||||
if (!apple)
|
||||
return;
|
||||
apple->blocked = value;
|
||||
}
|
||||
|
||||
input_driver_t input_cocoa = {
|
||||
cocoa_input_init,
|
||||
cocoa_input_poll,
|
||||
@ -437,4 +453,6 @@ input_driver_t input_cocoa = {
|
||||
NULL,
|
||||
cocoa_input_set_rumble,
|
||||
cocoa_input_get_joypad_driver
|
||||
cocoa_input_keyboard_mapping_is_blocked,
|
||||
cocoa_input_keyboard_mapping_set_block,
|
||||
};
|
||||
|
@ -18,6 +18,7 @@
|
||||
#define __COCOA_INPUT_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <boolean.h>
|
||||
#include "../../general.h"
|
||||
|
||||
/* Input responder */
|
||||
@ -37,6 +38,7 @@ typedef struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool blocked;
|
||||
cocoa_touch_data_t touches[MAX_TOUCHES];
|
||||
uint32_t touch_count;
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <boolean.h>
|
||||
|
||||
#include "../../driver.h"
|
||||
#include "../../libretro.h"
|
||||
@ -26,6 +27,7 @@
|
||||
|
||||
typedef struct ctr_input
|
||||
{
|
||||
bool blocked;
|
||||
const input_device_driver_t *joypad;
|
||||
} ctr_input_t;
|
||||
|
||||
@ -121,6 +123,22 @@ static bool ctr_input_set_rumble(void *data, unsigned port,
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool ctr_input_keyboard_mapping_is_blocked(void *data)
|
||||
{
|
||||
ctr_input_t *ctr = (ctr_input_t*)data;
|
||||
if (!ctr)
|
||||
return false;
|
||||
return ctr->blocked;
|
||||
}
|
||||
|
||||
static void ctr_input_keyboard_mapping_set_block(void *data, bool value)
|
||||
{
|
||||
ctr_input_t *ctr = (ctr_input_t*)data;
|
||||
if (!ctr)
|
||||
return;
|
||||
ctr->blocked = value;
|
||||
}
|
||||
|
||||
input_driver_t input_ctr = {
|
||||
ctr_input_initialize,
|
||||
ctr_input_poll,
|
||||
@ -135,4 +153,6 @@ input_driver_t input_ctr = {
|
||||
NULL,
|
||||
ctr_input_set_rumble,
|
||||
ctr_input_get_joypad_driver,
|
||||
ctr_input_keyboard_mapping_is_blocked,
|
||||
ctr_input_keyboard_mapping_set_block,
|
||||
};
|
||||
|
@ -27,17 +27,19 @@
|
||||
|
||||
#include <dinput.h>
|
||||
|
||||
#include "../../general.h"
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <boolean.h>
|
||||
|
||||
#include <windowsx.h>
|
||||
|
||||
#include "../../general.h"
|
||||
#include "../input_autodetect.h"
|
||||
#include "../input_common.h"
|
||||
#include "../input_joypad.h"
|
||||
#include "../input_keymaps.h"
|
||||
#include "../../retroarch_logger.h"
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <windowsx.h>
|
||||
|
||||
/* Keep track of which pad indexes are 360 controllers.
|
||||
* Not static, will be read in xinput_joypad.c
|
||||
@ -60,6 +62,7 @@ struct pointer_status
|
||||
|
||||
struct dinput_input
|
||||
{
|
||||
bool blocked;
|
||||
LPDIRECTINPUTDEVICE8 keyboard;
|
||||
LPDIRECTINPUTDEVICE8 mouse;
|
||||
const input_device_driver_t *joypad;
|
||||
@ -673,6 +676,22 @@ static uint64_t dinput_get_capabilities(void *data)
|
||||
return caps;
|
||||
}
|
||||
|
||||
static bool dinput_keyboard_mapping_is_blocked(void *data)
|
||||
{
|
||||
struct dinput_input *di = (struct dinput_input*)data;
|
||||
if (!di)
|
||||
return false;
|
||||
return di->blocked;
|
||||
}
|
||||
|
||||
static void dinput_keyboard_mapping_set_block(void *data, bool value)
|
||||
{
|
||||
struct dinput_input *di = (struct dinput_input*)data;
|
||||
if (!di)
|
||||
return;
|
||||
di->blocked = value;
|
||||
}
|
||||
|
||||
input_driver_t input_dinput = {
|
||||
dinput_init,
|
||||
dinput_poll,
|
||||
@ -688,5 +707,6 @@ input_driver_t input_dinput = {
|
||||
NULL,
|
||||
dinput_set_rumble,
|
||||
dinput_get_joypad_driver,
|
||||
dinput_keyboard_mapping_is_blocked,
|
||||
dinput_keyboard_mapping_set_block,
|
||||
};
|
||||
|
||||
|
@ -16,16 +16,18 @@
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846264338327
|
||||
#endif
|
||||
|
||||
#include "../../driver.h"
|
||||
#include "../../libretro.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef MAX_PADS
|
||||
#define MAX_PADS 4
|
||||
@ -33,6 +35,7 @@
|
||||
|
||||
typedef struct gx_input
|
||||
{
|
||||
bool blocked;
|
||||
const input_device_driver_t *joypad;
|
||||
} gx_input_t;
|
||||
|
||||
@ -129,6 +132,22 @@ static bool gx_input_set_rumble(void *data, unsigned port,
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool gx_input_keyboard_mapping_is_blocked(void *data)
|
||||
{
|
||||
gx_input_t *gx = (gx_input_t*)data;
|
||||
if (!gx)
|
||||
return false;
|
||||
return gx->blocked;
|
||||
}
|
||||
|
||||
static void ctr_input_keyboard_mapping_set_block(void *data, bool value)
|
||||
{
|
||||
gx_input_t *gx = (gx_input_t*)data;
|
||||
if (!gx)
|
||||
return;
|
||||
gx->blocked = value;
|
||||
}
|
||||
|
||||
input_driver_t input_gx = {
|
||||
gx_input_init,
|
||||
gx_input_poll,
|
||||
@ -144,4 +163,6 @@ input_driver_t input_gx = {
|
||||
NULL,
|
||||
gx_input_set_rumble,
|
||||
gx_input_get_joypad_driver,
|
||||
gx_input_keyboard_mapping_is_blocked,
|
||||
gx_input_keyboard_mapping_set_block,
|
||||
};
|
||||
|
@ -14,12 +14,15 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/kd.h>
|
||||
#include <termios.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#include "../../general.h"
|
||||
|
||||
@ -33,6 +36,7 @@ static struct termios oldTerm, newTerm;
|
||||
|
||||
typedef struct linuxraw_input
|
||||
{
|
||||
bool blocked;
|
||||
const input_device_driver_t *joypad;
|
||||
bool state[0x80];
|
||||
} linuxraw_input_t;
|
||||
@ -277,6 +281,22 @@ static void linuxraw_grab_mouse(void *data, bool state)
|
||||
(void)state;
|
||||
}
|
||||
|
||||
static bool linuxraw_keyboard_mapping_is_blocked(void *data)
|
||||
{
|
||||
linuxraw_input_t *linuxraw = (linuxraw_input_t*)data;
|
||||
if (!linuxraw)
|
||||
return false;
|
||||
return linuxraw->blocked;
|
||||
}
|
||||
|
||||
static void linuxraw_keyboard_mapping_set_block(void *data, bool value)
|
||||
{
|
||||
linuxraw_input_t *linuxraw = (linuxraw_input_t*)data;
|
||||
if (!linuxraw)
|
||||
return false;
|
||||
linuxraw->blocked = value;
|
||||
}
|
||||
|
||||
input_driver_t input_linuxraw = {
|
||||
linuxraw_input_init,
|
||||
linuxraw_input_poll,
|
||||
@ -291,4 +311,6 @@ input_driver_t input_linuxraw = {
|
||||
linuxraw_grab_stdin,
|
||||
linuxraw_set_rumble,
|
||||
linuxraw_get_joypad_driver,
|
||||
linuxraw_keyboard_mapping_is_blocked,
|
||||
linuxraw_keyboard_mapping_set_block,
|
||||
};
|
||||
|
@ -99,4 +99,6 @@ input_driver_t input_null = {
|
||||
nullinput_grab_mouse,
|
||||
NULL,
|
||||
nullinput_set_rumble,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
@ -17,9 +17,10 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <sdk_version.h>
|
||||
#include <boolean.h>
|
||||
|
||||
#include <sdk_version.h>
|
||||
|
||||
#include "../../ps3/sdk_defines.h"
|
||||
|
||||
#include "../../driver.h"
|
||||
@ -45,6 +46,7 @@ typedef struct
|
||||
|
||||
typedef struct ps3_input
|
||||
{
|
||||
bool blocked;
|
||||
#ifdef HAVE_MOUSE
|
||||
unsigned mice_connected;
|
||||
#endif
|
||||
@ -247,6 +249,22 @@ static void ps3_input_grab_mouse(void *data, bool state)
|
||||
(void)state;
|
||||
}
|
||||
|
||||
static bool ps3_input_keyboard_mapping_is_blocked(void *data)
|
||||
{
|
||||
ps3_input_t *ps3 = (ps3_input_t*)data;
|
||||
if (!ps3)
|
||||
return false;
|
||||
return ps3->blocked;
|
||||
}
|
||||
|
||||
static void ps3_input_keyboard_mapping_set_block(void *data, bool value)
|
||||
{
|
||||
ps3_input_t *ps3 = (ps3_input_t*)data;
|
||||
if (!ps3)
|
||||
return;
|
||||
ps3->blocked = value;
|
||||
}
|
||||
|
||||
input_driver_t input_ps3 = {
|
||||
ps3_input_init,
|
||||
ps3_input_poll,
|
||||
@ -262,4 +280,6 @@ input_driver_t input_ps3 = {
|
||||
NULL,
|
||||
ps3_input_set_rumble,
|
||||
ps3_input_get_joypad_driver,
|
||||
ps3_input_keyboard_mapping_is_blocked,
|
||||
ps3_input_keyboard_mapping_set_block,
|
||||
};
|
||||
|
@ -17,6 +17,8 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#if defined(SN_TARGET_PSP2)
|
||||
#include <sceerror.h>
|
||||
#include <kernel.h>
|
||||
@ -39,6 +41,7 @@
|
||||
|
||||
typedef struct psp_input
|
||||
{
|
||||
bool blocked;
|
||||
const input_device_driver_t *joypad;
|
||||
} psp_input_t;
|
||||
|
||||
@ -135,6 +138,22 @@ static bool psp_input_set_rumble(void *data, unsigned port,
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool psp_input_keyboard_mapping_is_blocked(void *data)
|
||||
{
|
||||
psp_input_t *psp = (psp_input_t*)data;
|
||||
if (!psp)
|
||||
return false;
|
||||
return psp->blocked;
|
||||
}
|
||||
|
||||
static void psp_input_keyboard_mapping_set_block(void *data, bool value)
|
||||
{
|
||||
psp_input_t *psp = (psp_input_t*)data;
|
||||
if (!psp)
|
||||
return;
|
||||
psp->blocked = value;
|
||||
}
|
||||
|
||||
input_driver_t input_psp = {
|
||||
psp_input_initialize,
|
||||
psp_input_poll,
|
||||
@ -150,4 +169,6 @@ input_driver_t input_psp = {
|
||||
NULL,
|
||||
psp_input_set_rumble,
|
||||
psp_input_get_joypad_driver,
|
||||
psp_input_keyboard_mapping_is_blocked,
|
||||
psp_input_keyboard_mapping_set_block,
|
||||
};
|
||||
|
@ -15,12 +15,15 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../../general.h"
|
||||
#include "../../driver.h"
|
||||
#include <screen/screen.h>
|
||||
#include <bps/event.h>
|
||||
#include <bps/navigator.h>
|
||||
#include <sys/keycodes.h>
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#include "../../general.h"
|
||||
#include "../../driver.h"
|
||||
#include "../input_autodetect.h"
|
||||
|
||||
#define MAX_PADS 8
|
||||
@ -33,6 +36,7 @@
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool blocked;
|
||||
#ifdef HAVE_BB10
|
||||
screen_device_t handle;
|
||||
#endif
|
||||
@ -839,6 +843,22 @@ static bool qnx_input_set_rumble(void *data, unsigned port,
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool qnx_input_keyboard_mapping_is_blocked(void *data)
|
||||
{
|
||||
qnx_input_t *qnx = (qnx_input_t*)data;
|
||||
if (!qnx)
|
||||
return false;
|
||||
return qnx->blocked;
|
||||
}
|
||||
|
||||
static void qnx_input_keyboard_mapping_set_block(void *data, bool value)
|
||||
{
|
||||
qnx_input_t *qnx = (qnx_input_t*)data;
|
||||
if (!qnx)
|
||||
return;
|
||||
qnx->blocked = value;
|
||||
}
|
||||
|
||||
input_driver_t input_qnx = {
|
||||
qnx_input_init,
|
||||
qnx_input_poll,
|
||||
@ -853,4 +873,6 @@ input_driver_t input_qnx = {
|
||||
NULL,
|
||||
qnx_input_set_rumble,
|
||||
qnx_input_get_joypad_driver,
|
||||
qnx_input_keyboard_mapping_is_blocked,
|
||||
qnx_input_keyboard_mapping_set_block,
|
||||
};
|
||||
|
@ -13,14 +13,16 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <boolean.h>
|
||||
|
||||
#include "../input_autodetect.h"
|
||||
#include "../input_common.h"
|
||||
#include "../input_keymaps.h"
|
||||
|
||||
#include "../../driver.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <boolean.h>
|
||||
#include "../../general.h"
|
||||
#include "../keyboard_line.h"
|
||||
#include "../input_joypad.h"
|
||||
@ -226,6 +228,22 @@ static uint64_t rwebinput_get_capabilities(void *data)
|
||||
return caps;
|
||||
}
|
||||
|
||||
static bool rwebinput_keyboard_mapping_is_blocked(void *data)
|
||||
{
|
||||
rwebinput_input_t *rwebinput = (rwebinput_input_t*)data;
|
||||
if (!rwebinput)
|
||||
return false;
|
||||
return rwebinput->blocked;
|
||||
}
|
||||
|
||||
static void rwebinput_keyboard_mapping_set_block(void *data, bool value)
|
||||
{
|
||||
rwebinput_input_t *rwebinput = (rwebinput_input_t*)data;
|
||||
if (!rwebinput)
|
||||
return;
|
||||
rwebinput->blocked = value;
|
||||
}
|
||||
|
||||
input_driver_t input_rwebinput = {
|
||||
rwebinput_input_init,
|
||||
rwebinput_input_poll,
|
||||
@ -239,4 +257,6 @@ input_driver_t input_rwebinput = {
|
||||
rwebinput_grab_mouse,
|
||||
NULL,
|
||||
rwebinput_set_rumble,
|
||||
rwebinput_keyboard_mapping_is_blocked,
|
||||
rwebinput_keyboard_mapping_set_block,
|
||||
};
|
||||
|
@ -14,14 +14,16 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#include "../../driver.h"
|
||||
|
||||
#include "SDL.h"
|
||||
#include "../../gfx/video_context_driver.h"
|
||||
#include <boolean.h>
|
||||
#include "../../general.h"
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include "../../libretro.h"
|
||||
#include "../input_autodetect.h"
|
||||
#include "../input_common.h"
|
||||
@ -31,6 +33,7 @@
|
||||
|
||||
typedef struct sdl_input
|
||||
{
|
||||
bool blocked;
|
||||
const input_device_driver_t *joypad;
|
||||
|
||||
int mouse_x, mouse_y;
|
||||
@ -380,6 +383,22 @@ static uint64_t sdl_get_capabilities(void *data)
|
||||
return caps;
|
||||
}
|
||||
|
||||
static bool sdl_keyboard_mapping_is_blocked(void *data)
|
||||
{
|
||||
sdl_input_t *sdl = (sdl_input_t*)data;
|
||||
if (!sdl)
|
||||
return false;
|
||||
return sdl->blocked;
|
||||
}
|
||||
|
||||
static void sdl_keyboard_mapping_set_block(void *data, bool value)
|
||||
{
|
||||
sdl_input_t *sdl = (sdl_input_t*)data;
|
||||
if (!sdl)
|
||||
return;
|
||||
sdl->blocked = value;
|
||||
}
|
||||
|
||||
input_driver_t input_sdl = {
|
||||
sdl_input_init,
|
||||
sdl_input_poll,
|
||||
@ -398,4 +417,6 @@ input_driver_t input_sdl = {
|
||||
NULL,
|
||||
sdl_set_rumble,
|
||||
sdl_get_joypad_driver,
|
||||
sdl_keyboard_mapping_is_blocked,
|
||||
sdl_keyboard_mapping_set_block,
|
||||
};
|
||||
|
@ -82,6 +82,7 @@ struct input_device
|
||||
|
||||
struct udev_input
|
||||
{
|
||||
bool blocked;
|
||||
struct udev *udev;
|
||||
struct udev_monitor *monitor;
|
||||
|
||||
@ -863,6 +864,22 @@ static const input_device_driver_t *udev_input_get_joypad_driver(void *data)
|
||||
return udev->joypad;
|
||||
}
|
||||
|
||||
static bool udev_input_keyboard_mapping_is_blocked(void *data)
|
||||
{
|
||||
udev_input_t *udev = (udev_input_t*)data;
|
||||
if (!udev)
|
||||
return false;
|
||||
return udev->blocked;
|
||||
}
|
||||
|
||||
static void udev_input_keyboard_mapping_set_block(void *data, bool value)
|
||||
{
|
||||
udev_input_t *udev = (udev_input_t*)data;
|
||||
if (!udev)
|
||||
return;
|
||||
udev->blocked = value;
|
||||
}
|
||||
|
||||
input_driver_t input_udev = {
|
||||
udev_input_init,
|
||||
udev_input_poll,
|
||||
@ -877,4 +894,6 @@ input_driver_t input_udev = {
|
||||
NULL,
|
||||
udev_input_set_rumble,
|
||||
udev_input_get_joypad_driver,
|
||||
udev_input_keyboard_mapping_is_blocked,
|
||||
udev_input_keyboard_mapping_set_block,
|
||||
};
|
||||
|
@ -13,16 +13,6 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../input_common.h"
|
||||
#include "../input_joypad.h"
|
||||
#include "../input_keymaps.h"
|
||||
|
||||
#include "../../driver.h"
|
||||
|
||||
#include "../../gfx/video_viewport.h"
|
||||
|
||||
#include <boolean.h>
|
||||
#include "../../general.h"
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@ -30,8 +20,19 @@
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/keysym.h>
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#include "../input_common.h"
|
||||
#include "../input_joypad.h"
|
||||
#include "../input_keymaps.h"
|
||||
|
||||
#include "../../driver.h"
|
||||
#include "../../gfx/video_viewport.h"
|
||||
#include "../../general.h"
|
||||
|
||||
typedef struct x11_input
|
||||
{
|
||||
bool blocked;
|
||||
const input_device_driver_t *joypad;
|
||||
|
||||
Display *display;
|
||||
@ -385,6 +386,22 @@ static uint64_t x_input_get_capabilities(void *data)
|
||||
return caps;
|
||||
}
|
||||
|
||||
static bool x_keyboard_mapping_is_blocked(void *data)
|
||||
{
|
||||
x11_input_t *x11 = (x11_input_t*)data;
|
||||
if (!x11)
|
||||
return false;
|
||||
return x11->blocked;
|
||||
}
|
||||
|
||||
static void x_keyboard_mapping_set_block(void *data, bool value)
|
||||
{
|
||||
x11_input_t *x11 = (x11_input_t*)data;
|
||||
if (!x11)
|
||||
return;
|
||||
x11->blocked = value;
|
||||
}
|
||||
|
||||
input_driver_t input_x = {
|
||||
x_input_init,
|
||||
x_input_poll,
|
||||
@ -399,4 +416,6 @@ input_driver_t input_x = {
|
||||
NULL,
|
||||
x_set_rumble,
|
||||
x_get_joypad_driver,
|
||||
x_keyboard_mapping_is_blocked,
|
||||
x_keyboard_mapping_set_block,
|
||||
};
|
||||
|
@ -17,6 +17,8 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#ifdef _XBOX
|
||||
#include <xtl.h>
|
||||
#endif
|
||||
@ -29,6 +31,7 @@
|
||||
|
||||
typedef struct xdk_input
|
||||
{
|
||||
bool blocked;
|
||||
const input_device_driver_t *joypad;
|
||||
} xdk_input_t;
|
||||
|
||||
@ -151,6 +154,22 @@ static void xdk_input_grab_mouse(void *data, bool state)
|
||||
(void)state;
|
||||
}
|
||||
|
||||
static bool xdk_keyboard_mapping_is_blocked(void *data)
|
||||
{
|
||||
xdk_input_t *xdk = (xdk_input_t*)data;
|
||||
if (!xdk)
|
||||
return false;
|
||||
return xdk->blocked;
|
||||
}
|
||||
|
||||
static void xdk_keyboard_mapping_set_block(void *data, bool value)
|
||||
{
|
||||
xdk_input_t *xdk = (xdk_input_t*)data;
|
||||
if (!xdk)
|
||||
return;
|
||||
xdk->blocked = value;
|
||||
}
|
||||
|
||||
input_driver_t input_xinput = {
|
||||
xdk_input_init,
|
||||
xdk_input_poll,
|
||||
@ -165,4 +184,6 @@ input_driver_t input_xinput = {
|
||||
NULL,
|
||||
xdk_input_set_rumble,
|
||||
xdk_input_get_joypad_driver,
|
||||
xdk_keyboard_mapping_is_blocked,
|
||||
xdk_keyboard_mapping_set_block,
|
||||
};
|
||||
|
@ -133,4 +133,6 @@ input_driver_t input_xenon360 = {
|
||||
xenon360_input_grab_mouse,
|
||||
NULL,
|
||||
xenon360_input_set_rumble,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
@ -199,6 +199,7 @@ bool input_driver_set_rumble_state(unsigned port,
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool input_driver_key_pressed(int key)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
@ -316,3 +317,23 @@ void input_driver_free(void)
|
||||
if (driver && driver->input)
|
||||
driver->input->free(driver->input_data);
|
||||
}
|
||||
|
||||
bool input_driver_keyboard_mapping_is_blocked(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const input_driver_t *input = input_get_ptr(driver);
|
||||
|
||||
if (input->keyboard_mapping_is_blocked)
|
||||
return driver->input->keyboard_mapping_is_blocked(
|
||||
driver->input_data);
|
||||
return false;
|
||||
}
|
||||
|
||||
void input_driver_keyboard_mapping_set_block(bool value)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
const input_driver_t *input = input_get_ptr(driver);
|
||||
|
||||
if (input->keyboard_mapping_set_block)
|
||||
driver->input->keyboard_mapping_set_block(driver->input_data, value);
|
||||
}
|
||||
|
@ -76,6 +76,8 @@ typedef struct input_driver
|
||||
bool (*set_rumble)(void *data, unsigned port,
|
||||
enum retro_rumble_effect effect, uint16_t state);
|
||||
const input_device_driver_t *(*get_joypad_driver)(void *data);
|
||||
bool (*keyboard_mapping_is_blocked)(void *data);
|
||||
void (*keyboard_mapping_set_block)(void *data, bool value);
|
||||
} input_driver_t;
|
||||
|
||||
extern input_driver_t input_android;
|
||||
@ -158,6 +160,10 @@ void *input_driver_init(void);
|
||||
|
||||
void input_driver_free(void);
|
||||
|
||||
bool input_driver_keyboard_mapping_is_blocked(void);
|
||||
|
||||
void input_driver_keyboard_mapping_set_block(bool value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -182,14 +182,13 @@ static void *g_keyboard_press_data;
|
||||
const char **input_keyboard_start_line(void *userdata,
|
||||
input_keyboard_line_complete_t cb)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
if (g_keyboard_line)
|
||||
input_keyboard_line_free(g_keyboard_line);
|
||||
|
||||
g_keyboard_line = input_keyboard_line_new(userdata, cb);
|
||||
|
||||
/* While reading keyboard line input, we have to block all hotkeys. */
|
||||
driver->block_input = true;
|
||||
input_driver_keyboard_mapping_set_block(true);
|
||||
|
||||
return input_keyboard_line_get_buffer(g_keyboard_line);
|
||||
}
|
||||
@ -204,13 +203,11 @@ const char **input_keyboard_start_line(void *userdata,
|
||||
**/
|
||||
void input_keyboard_wait_keys(void *userdata, input_keyboard_press_t cb)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
||||
g_keyboard_press_cb = cb;
|
||||
g_keyboard_press_data = userdata;
|
||||
|
||||
/* While waiting for input, we have to block all hotkeys. */
|
||||
driver->block_input = true;
|
||||
input_driver_keyboard_mapping_set_block(true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -220,11 +217,9 @@ void input_keyboard_wait_keys(void *userdata, input_keyboard_press_t cb)
|
||||
**/
|
||||
void input_keyboard_wait_keys_cancel(void)
|
||||
{
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
||||
g_keyboard_press_cb = NULL;
|
||||
g_keyboard_press_cb = NULL;
|
||||
g_keyboard_press_data = NULL;
|
||||
driver->block_input = false;
|
||||
input_driver_keyboard_mapping_set_block(false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -241,7 +236,6 @@ void input_keyboard_event(bool down, unsigned code,
|
||||
uint32_t character, uint16_t mod, unsigned device)
|
||||
{
|
||||
static bool deferred_wait_keys;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
|
||||
if (deferred_wait_keys)
|
||||
@ -284,7 +278,7 @@ void input_keyboard_event(bool down, unsigned code,
|
||||
g_keyboard_line = NULL;
|
||||
|
||||
/* Unblock all hotkeys. */
|
||||
driver->block_input = false;
|
||||
input_driver_keyboard_mapping_set_block(false);
|
||||
}
|
||||
else if (global->system.key_event)
|
||||
global->system.key_event(down, code, character, mod);
|
||||
|
@ -49,6 +49,8 @@ static const char *menu_hash_to_str_english(uint32_t hash)
|
||||
{
|
||||
case MENU_LABEL_VALUE_USE_THIS_DIRECTORY:
|
||||
return "<Use this directory>";
|
||||
case MENU_LABEL_USE_THIS_DIRECTORY:
|
||||
return "use_this_directory";
|
||||
case MENU_LABEL_VALUE_RDB_ENTRY_START_CONTENT:
|
||||
return "Start Content";
|
||||
case MENU_LABEL_RDB_ENTRY_START_CONTENT:
|
||||
|
@ -561,13 +561,13 @@ int menu_input_bind_iterate(void)
|
||||
|
||||
binds = menu_input->binds;
|
||||
|
||||
driver->block_input = true;
|
||||
input_driver_keyboard_mapping_set_block(true);
|
||||
menu_input_poll_bind_state(&binds);
|
||||
|
||||
if ((binds.skip && !menu_input->binds.skip) ||
|
||||
menu_input_poll_find_trigger(&menu_input->binds, &binds))
|
||||
{
|
||||
driver->block_input = false;
|
||||
input_driver_keyboard_mapping_set_block(false);
|
||||
|
||||
/* Avoid new binds triggering things right away. */
|
||||
driver->flushing_input = true;
|
||||
@ -1017,7 +1017,7 @@ unsigned menu_input_frame(retro_input_t input, retro_input_t trigger_input)
|
||||
|
||||
menu_input->delay.count += disp->animation->delta_time / IDEAL_DT;
|
||||
|
||||
if (driver->block_input)
|
||||
if (input_driver_keyboard_mapping_is_blocked())
|
||||
trigger_input = 0;
|
||||
if (trigger_input & (1ULL << RETRO_DEVICE_ID_JOYPAD_UP))
|
||||
ret = MENU_ACTION_UP;
|
||||
|
@ -715,7 +715,8 @@ static bool check_block_hotkey(bool enable_hotkey)
|
||||
|
||||
/* Don't block the check to RARCH_ENABLE_HOTKEY
|
||||
* unless we're really supposed to. */
|
||||
driver->block_hotkey = driver->block_input;
|
||||
driver->block_hotkey =
|
||||
input_driver_keyboard_mapping_is_blocked();
|
||||
|
||||
/* If we haven't bound anything to this,
|
||||
* always allow hotkeys. */
|
||||
@ -727,7 +728,8 @@ static bool check_block_hotkey(bool enable_hotkey)
|
||||
autoconf_bind->joykey != NO_BTN ||
|
||||
autoconf_bind->joyaxis != AXIS_NONE;
|
||||
|
||||
driver->block_hotkey = driver->block_input ||
|
||||
driver->block_hotkey =
|
||||
input_driver_keyboard_mapping_is_blocked() ||
|
||||
(use_hotkey_enable && !enable_hotkey);
|
||||
|
||||
/* If we hold ENABLE_HOTKEY button, block all libretro input to allow
|
||||
|
Loading…
x
Reference in New Issue
Block a user