Skip to content

Commit ae79de6

Browse files
committed
Libkokoa code format
1 parent 5c97ab4 commit ae79de6

File tree

3 files changed

+22
-45
lines changed

3 files changed

+22
-45
lines changed

libkokoa/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ project(kokoa C)
33

44
set(CMAKE_C_STANDARD 11)
55

6-
add_library(kokoa SHARED library.c library.h)
6+
add_library(kokoa SHARED library.c)

libkokoa/library.c

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,28 @@
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

516
bool 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-
*/
4358
Pointer 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-
*/
7384
void 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-
*/
9097
void 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-
}

libkokoa/library.h

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)