mirror of
https://github.com/libretro/RetroArch
synced 2025-03-31 10:20:41 +00:00
Move X11 keyboard event to x11_common.
TODO: Add to xegl and xvideo.
This commit is contained in:
parent
5185524b46
commit
671697a211
@ -20,7 +20,6 @@
|
|||||||
#include "../gfx_context.h"
|
#include "../gfx_context.h"
|
||||||
#include "../gl_common.h"
|
#include "../gl_common.h"
|
||||||
#include "../gfx_common.h"
|
#include "../gfx_common.h"
|
||||||
#include "../../input/input_common.h"
|
|
||||||
#include "x11_common.h"
|
#include "x11_common.h"
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
@ -219,21 +218,7 @@ static void gfx_ctx_check_window(bool *quit,
|
|||||||
|
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
case KeyRelease:
|
case KeyRelease:
|
||||||
if (g_extern.system.key_event)
|
x11_handle_key_event(&event);
|
||||||
{
|
|
||||||
static XComposeStatus state;
|
|
||||||
char keybuf[32];
|
|
||||||
|
|
||||||
bool down = event.type == KeyPress;
|
|
||||||
uint32_t character = 0;
|
|
||||||
unsigned key = input_translate_keysym_to_rk(XLookupKeysym(&event.xkey, 0));
|
|
||||||
|
|
||||||
// FIXME: UTF-8.
|
|
||||||
if (down && XLookupString(&event.xkey, keybuf, sizeof(keybuf), 0, &state))
|
|
||||||
character = keybuf[0];
|
|
||||||
|
|
||||||
g_extern.system.key_event(down, key, character, 0);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
#include "../image.h"
|
#include "../image.h"
|
||||||
#include "../../general.h"
|
#include "../../general.h"
|
||||||
|
#include "../../input/input_common.h"
|
||||||
|
|
||||||
void x11_hide_mouse(Display *dpy, Window win)
|
void x11_hide_mouse(Display *dpy, Window win)
|
||||||
{
|
{
|
||||||
@ -285,3 +286,23 @@ unsigned x11_get_xinerama_monitor(Display *dpy, int x, int y,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void x11_handle_key_event(XEvent *event)
|
||||||
|
{
|
||||||
|
if (!g_extern.system.key_event)
|
||||||
|
return;
|
||||||
|
|
||||||
|
static XComposeStatus state;
|
||||||
|
char keybuf[32];
|
||||||
|
|
||||||
|
bool down = event->type == KeyPress;
|
||||||
|
uint32_t character = 0;
|
||||||
|
unsigned key = input_translate_keysym_to_rk(XLookupKeysym(&event->xkey, 0));
|
||||||
|
|
||||||
|
// FIXME: UTF-8.
|
||||||
|
if (down && XLookupString(&event->xkey, keybuf, sizeof(keybuf), 0, &state))
|
||||||
|
character = keybuf[0];
|
||||||
|
|
||||||
|
// FIXME: Mod handling.
|
||||||
|
g_extern.system.key_event(down, key, character, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -49,5 +49,7 @@ unsigned x11_get_xinerama_monitor(Display *dpy,
|
|||||||
int x, int y, int w, int h);
|
int x, int y, int w, int h);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void x11_handle_key_event(XEvent *event);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user