Skip to content

Commit

Permalink
Merge pull request vurtun#904 from Hejsil/add-ctrl-support-for-x11-demos
Browse files Browse the repository at this point in the history
Add ctrl support for x11 demos
  • Loading branch information
dumblob authored Sep 18, 2019
2 parents 326f11e + 7fafcb3 commit c43600b
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions demo/x11/nuklear_xlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions demo/x11_opengl2/nuklear_xlib_gl2.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions demo/x11_opengl3/nuklear_xlib_gl3.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions demo/x11_rawfb/nuklear_xlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions demo/x11_xft/nuklear_xlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c43600b

Please sign in to comment.