add ctrl support for x11 demos

This commit is contained in:
Jimmi Holst Christensen 2019-09-18 18:27:25 +02:00
parent 5d81d324c4
commit 7fafcb3ac7
5 changed files with 5 additions and 0 deletions

View File

@ -704,6 +704,7 @@ nk_xlib_handle_event(Display *dpy, int screen, Window win, XEvent *evt)
int ret, down = (evt->type == KeyPress);
KeySym *code = XGetKeyboardMapping(xlib.surf->dpy, (KeyCode)evt->xkey.keycode, 1, &ret);
if (*code == XK_Shift_L || *code == XK_Shift_R) nk_input_key(ctx, NK_KEY_SHIFT, down);
else if (*code == XK_Control_L || *code == XK_Control_R) nk_input_key(ctx, NK_KEY_CTRL, down);
else if (*code == XK_Delete) nk_input_key(ctx, NK_KEY_DEL, down);
else if (*code == XK_Return) nk_input_key(ctx, NK_KEY_ENTER, down);
else if (*code == XK_Tab) nk_input_key(ctx, NK_KEY_TAB, down);

View File

@ -249,6 +249,7 @@ nk_x11_handle_event(XEvent *evt)
int ret, down = (evt->type == KeyPress);
KeySym *code = XGetKeyboardMapping(x11.dpy, (KeyCode)evt->xkey.keycode, 1, &ret);
if (*code == XK_Shift_L || *code == XK_Shift_R) nk_input_key(ctx, NK_KEY_SHIFT, down);
else if (*code == XK_Control_L || *code == XK_Control_R) nk_input_key(ctx, NK_KEY_CTRL, down);
else if (*code == XK_Delete) nk_input_key(ctx, NK_KEY_DEL, down);
else if (*code == XK_Return) nk_input_key(ctx, NK_KEY_ENTER, down);
else if (*code == XK_Tab) nk_input_key(ctx, NK_KEY_TAB, down);

View File

@ -618,6 +618,7 @@ nk_x11_handle_event(XEvent *evt)
int ret, down = (evt->type == KeyPress);
KeySym *code = XGetKeyboardMapping(x11.dpy, (KeyCode)evt->xkey.keycode, 1, &ret);
if (*code == XK_Shift_L || *code == XK_Shift_R) nk_input_key(ctx, NK_KEY_SHIFT, down);
else if (*code == XK_Control_L || *code == XK_Control_R) nk_input_key(ctx, NK_KEY_CTRL, down);
else if (*code == XK_Delete) nk_input_key(ctx, NK_KEY_DEL, down);
else if (*code == XK_Return) nk_input_key(ctx, NK_KEY_ENTER, down);
else if (*code == XK_Tab) nk_input_key(ctx, NK_KEY_TAB, down);

View File

@ -175,6 +175,7 @@ nk_xlib_handle_event(Display *dpy, int screen, Window win, XEvent *evt, struct r
int ret, down = (evt->type == KeyPress);
KeySym *code = XGetKeyboardMapping(xlib.dpy, (KeyCode)evt->xkey.keycode, 1, &ret);
if (*code == XK_Shift_L || *code == XK_Shift_R) nk_input_key(&rawfb->ctx, NK_KEY_SHIFT, down);
else if (*code == XK_Control_L || *code == XK_Control_R) nk_input_key(&rawfb->ctx, NK_KEY_CTRL, down);
else if (*code == XK_Delete) nk_input_key(&rawfb->ctx, NK_KEY_DEL, down);
else if (*code == XK_Return) nk_input_key(&rawfb->ctx, NK_KEY_ENTER, down);
else if (*code == XK_Tab) nk_input_key(&rawfb->ctx, NK_KEY_TAB, down);

View File

@ -782,6 +782,7 @@ nk_xlib_handle_event(Display *dpy, int screen, Window win, XEvent *evt)
int ret, down = (evt->type == KeyPress);
KeySym *code = XGetKeyboardMapping(xlib.surf->dpy, (KeyCode)evt->xkey.keycode, 1, &ret);
if (*code == XK_Shift_L || *code == XK_Shift_R) nk_input_key(ctx, NK_KEY_SHIFT, down);
else if (*code == XK_Control_L || *code == XK_Control_R) nk_input_key(ctx, NK_KEY_CTRL, down);
else if (*code == XK_Delete) nk_input_key(ctx, NK_KEY_DEL, down);
else if (*code == XK_Return) nk_input_key(ctx, NK_KEY_ENTER, down);
else if (*code == XK_Tab) nk_input_key(ctx, NK_KEY_TAB, down);