1- #include "library.h"
1+ //////////////////////////////// Include /////////////////////////////////
2+ #include <stdio.h>
3+ #include <stdbool.h>
4+
5+ #include <X11/X.h>
6+ #include <X11/Xlib.h>
7+ #include <X11/Xlocale.h>
8+
9+ ///////////////////////////////// Types //////////////////////////////////
10+
11+ typedef long Pointer ;
12+ #define nullptr 0
213
314///////////////////////////////// Debug //////////////////////////////////
415
516bool DEBUG = false;
617
18+ void setDebug (long debug ) {
19+ if (DEBUG != (debug == 0 ? false : true)) {
20+ DEBUG = debug == 0 ? false : true;
21+ printf ("[libkokoa/DEBUG] %sed debug mode\n" , (DEBUG == true ? "enter" : "exit" ));
22+ fflush (stdout );
23+ }
24+ }
25+
726///////////////////////////////// Global /////////////////////////////////
827
928/**
@@ -36,14 +55,10 @@ void setWindow(Pointer w) {
3655
3756//////////////////////// Replace LWJGL Functions /////////////////////////
3857
39- /**
40- * Open IM for specified Display
41- * @return Pointer form of opened XIM pointer.
42- */
4358Pointer openIM () {
4459 xim = XOpenIM (display , NULL , NULL , NULL );
4560 if (DEBUG ) {
46- printf ("[libkokoa] openIM: %p\n" , xim );
61+ printf ("[libkokoa/DEBUG ] openIM: %p\n" , xim );
4762 fflush (stdout );
4863 }
4964 return (Pointer ) xim ;
@@ -66,10 +81,6 @@ Pointer createIC() {
6681 return (Pointer ) xic ;
6782}
6883
69- /**
70- * Close current XIM
71- * This function assumes xim is valid, and protects deleting NULL pointer.
72- */
7384void closeIM () {
7485 if (xim != nullptr ) {
7586 XCloseIM (xim );
@@ -83,10 +94,6 @@ void closeIM() {
8394 }
8495}
8596
86- /**
87- * Destroy current XIC
88- * This function assumes xic is valid, and protects deleting NULL pointer.
89- */
9097void destroyIC () {
9198 if (xic != nullptr ) {
9299 XDestroyIC (xic );
@@ -116,11 +123,3 @@ void prepareLocale() {
116123 XSetLocaleModifiers ("" );
117124 setlocale (LC_CTYPE , "" );
118125}
119-
120- void setDebug (long debug ) {
121- if (DEBUG != (debug == 0 ? false : true)) {
122- DEBUG = debug == 0 ? false : true;
123- printf ("[libkokoa/DEBUG] %sed debug mode\n" , (DEBUG == true ? "enter" : "exit" ));
124- fflush (stdout );
125- }
126- }
0 commit comments