• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Cross-Platform OpenGL Windowing Library


Commit MetaInfo

Revisionb9d6a42c57201f72d3e534011ed00e11a32185cd (tree)
Time2019-09-10 16:05:15
AuthorAlaskanEmily <emily@alas...>
CommiterAlaskanEmily

Log Message

Fix non-printable keys on X11

Change Summary

Incremental Difference

--- a/glow_x11.c
+++ b/glow_x11.c
@@ -8,6 +8,7 @@
88
99 #include <X11/Xlib.h>
1010 #include <X11/Xutil.h>
11+#include <X11/keysym.h>
1112
1213 #ifdef __APPLE__
1314
@@ -24,6 +25,7 @@
2425 #include <assert.h>
2526 #include <stdio.h>
2627 #include <stdlib.h>
28+#include <string.h>
2729
2830 #define GLOW_X_EVENT_MASK\
2931 (StructureNotifyMask\
@@ -287,6 +289,23 @@ glow_get_event_start:
287289 XComposeStatus compose;
288290 XLookupString(&event.xkey, out->value.key,
289291 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+
290309 }
291310 out->type = press ?
292311 eGlowKeyboardPressed : eGlowKeyboardReleased;
@@ -399,10 +418,10 @@ int Glow_CreateContext(struct Glow_Window *window,
399418
400419 window->ctx = out;
401420 Glow_MakeCurrent(window->ctx);
402- glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
421+ glClearColor(0.3f, 0.3f, 0.3f, 1.0f);
403422 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
404423 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); */
406425 glFinish();
407426
408427 return 0;