Cross-Platform OpenGL Windowing Library
Revision | b9d6a42c57201f72d3e534011ed00e11a32185cd (tree) |
---|---|
Time | 2019-09-10 16:05:15 |
Author | AlaskanEmily <emily@alas...> |
Commiter | AlaskanEmily |
Fix non-printable keys on X11
@@ -8,6 +8,7 @@ | ||
8 | 8 | |
9 | 9 | #include <X11/Xlib.h> |
10 | 10 | #include <X11/Xutil.h> |
11 | +#include <X11/keysym.h> | |
11 | 12 | |
12 | 13 | #ifdef __APPLE__ |
13 | 14 |
@@ -24,6 +25,7 @@ | ||
24 | 25 | #include <assert.h> |
25 | 26 | #include <stdio.h> |
26 | 27 | #include <stdlib.h> |
28 | +#include <string.h> | |
27 | 29 | |
28 | 30 | #define GLOW_X_EVENT_MASK\ |
29 | 31 | (StructureNotifyMask\ |
@@ -287,6 +289,23 @@ glow_get_event_start: | ||
287 | 289 | XComposeStatus compose; |
288 | 290 | XLookupString(&event.xkey, out->value.key, |
289 | 291 | GLOW_MAX_KEY_NAME_SIZE, &sym, &compose); |
292 | +#define GLOW_KEYSM(SYM, STR) case XK_ ## SYM: strcpy(out->value.key, ("" GLOW_ ## STR)); break; | |
293 | + switch(sym){ | |
294 | + GLOW_KEYSM(Escape, ESCAPE); | |
295 | + GLOW_KEYSM(Up, UP_ARROW); | |
296 | + GLOW_KEYSM(Down, DOWN_ARROW); | |
297 | + GLOW_KEYSM(Left, LEFT_ARROW); | |
298 | + GLOW_KEYSM(Right, RIGHT_ARROW); | |
299 | + GLOW_KEYSM(Return, RETURN); | |
300 | + GLOW_KEYSM(Tab, TAB); | |
301 | + | |
302 | + case XK_Control_L: /* FALLTHROUGH */ | |
303 | + GLOW_KEYSM(Control_R, CONTROL); | |
304 | + | |
305 | + case XK_Shift_R: /* FALLTHROUGH */ | |
306 | + GLOW_KEYSM(Shift_L, SHIFT); | |
307 | + } | |
308 | + | |
290 | 309 | } |
291 | 310 | out->type = press ? |
292 | 311 | eGlowKeyboardPressed : eGlowKeyboardReleased; |
@@ -399,10 +418,10 @@ int Glow_CreateContext(struct Glow_Window *window, | ||
399 | 418 | |
400 | 419 | window->ctx = out; |
401 | 420 | Glow_MakeCurrent(window->ctx); |
402 | - glClearColor(0.0f, 0.0f, 0.0f, 1.0f); | |
421 | + glClearColor(0.3f, 0.3f, 0.3f, 1.0f); | |
403 | 422 | glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); |
404 | 423 | glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); |
405 | - glClearColor(0.75f, 0.333f, 0.0f, 1.0f); | |
424 | + /* glClearColor(0.75f, 0.333f, 0.0f, 1.0f); */ | |
406 | 425 | glFinish(); |
407 | 426 | |
408 | 427 | return 0; |