mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-13 22:08:34 +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 "../gl_common.h"
|
||||
#include "../gfx_common.h"
|
||||
#include "../../input/input_common.h"
|
||||
#include "x11_common.h"
|
||||
|
||||
#include <signal.h>
|
||||
@ -219,21 +218,7 @@ static void gfx_ctx_check_window(bool *quit,
|
||||
|
||||
case KeyPress:
|
||||
case KeyRelease:
|
||||
if (g_extern.system.key_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);
|
||||
}
|
||||
x11_handle_key_event(&event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <X11/Xatom.h>
|
||||
#include "../image.h"
|
||||
#include "../../general.h"
|
||||
#include "../../input/input_common.h"
|
||||
|
||||
void x11_hide_mouse(Display *dpy, Window win)
|
||||
{
|
||||
@ -285,3 +286,23 @@ unsigned x11_get_xinerama_monitor(Display *dpy, int x, int y,
|
||||
}
|
||||
#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);
|
||||
#endif
|
||||
|
||||
void x11_handle_key_event(XEvent *event);
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user