diff --git a/htpt-db-example/1642759082142.jpg b/htpt-db-example/1642759082142.jpg new file mode 100644 index 0000000..6bece86 --- /dev/null +++ b/htpt-db-example/1642759082142.jpg @@ -0,0 +1 @@ +random stuff diff --git a/htpt-db-example/btk-log.c b/htpt-db-example/btk-log.c new file mode 100644 index 0000000..4147b6f --- /dev/null +++ b/htpt-db-example/btk-log.c @@ -0,0 +1,142 @@ +#include +#include + +#include "btk-log.h" +#include "btk-config.h" + +void +btk_log(unsigned int log_id) +{ + if (btk_log_level < 3) + return; + + printf("BTK -> LOG -> "); + switch (log_id) + { + case BTK_LOG_SESSION_CLOSE: + printf("closed btk session"); + break; + case BTK_LOG_SESSION_OPEN: + printf("opened new btk session"); + break; + case BTK_LOG_GENERIC_EVENT_NOTIFY: + printf("generic x event received"); + break; + case BTK_LOG_EVENT_LOOP_IN: + printf("entered event loop"); + break; + case BTK_LOG_EVENT_LOOP_OUT: + printf("exited event loop"); + break; + case BTK_LOG_WINDOW_MAP: + printf("mapped window"); + break; + case BTK_LOG_WINDOW_UNMAP: + printf("unmapped window"); + break; + case BTK_LOG_WINDOW_CREATE: + printf("created new window"); + break; + case BTK_LOG_WINDOW_DESTROY: + printf("destroyed window"); + break; + case BTK_LOG_WINDOW_RENAME: + printf("renamed window"); + break; + case BTK_LOG_WINDOW_RESIZE: + printf("resized window"); + break; + case BTK_LOG_EVENT_EXPOSE: + printf("expose x event received"); + break; + case BTK_LOG_EVENT_BUTTON_PRESS: + printf("button press x event received"); + break; + case BTK_LOG_EVENT_BUTTON_RELEASE: + printf("button release x event received"); + break; + case BTK_LOG_EVENT_BUTTON_COMBO: + printf("button combo"); + break; + case BTK_LOG_EVENT_BUTTON_COMBO_BREAK: + printf("button combo broken"); + break; + case BTK_LOG_EVENT_KEY_PRESS: + printf("key press x event received"); + break; + case BTK_LOG_EVENT_POINTER_MOTION: + printf("pointer motion x event received"); + break; + case BTK_LOG_EVENT_WINDOW_ENTER: + printf("pointer entered new window"); + break; + case BTK_LOG_EVENT_WINDOW_LEAVE: + printf("pointer left window"); + break; + case BTK_LOG_EVENT_CLIENT_MESSAGE: + printf("x client message received"); + break; + default: + break; + } + putchar('\n'); +} + +void +btk_log_error(unsigned int error_id) +{ + if (btk_log_level < 1) + return; + + printf("BTK -> \033[1;31mERROR\033[0m -> "); + switch (error_id) + { + case BTK_ERROR_X_CONNECTION: + printf("failed to connect to X"); + break; + case BTK_ERROR_X_SCREEN: + printf("failed to get display"); + break; + case BTK_ERROR_X_KEYSYMS: + printf("failed to get keysym table"); + break; + case BTK_ERROR_X_VISUAL: + printf("failed to get visual type"); + break; + default: + printf("generid error"); + break; + } + putchar('\n'); + exit(1); +} + +void +btk_log_warning(unsigned int warning_id) +{ + if (btk_log_level < 2) + return; + + printf("BTK -> \033[1;33mWARNING\033[0m -> "); + switch (warning_id) + { + case BTK_WARNING_WINDOW_GET: + printf("couldn't match x window id to btk window"); + break; + case BTK_WARNING_EMPTY_LOOP: + printf("no windows in the event loop"); + break; + case BTK_WARNING_DRAW_NO_FIELD: + printf("attempted to draw a field type without a field"); + break; + case BTK_WARNING_OUT_OF_BOUND_CELL: + printf("attempted to draw a non exisiting cell"); + break; + case BTK_WARNING_WINDOW_DESTROY: + printf("attempted to destroy NULL window"); + break; + default: + break; + } + putchar('\n'); +} diff --git a/htpt-db-example/btk-utils.c b/htpt-db-example/btk-utils.c new file mode 100644 index 0000000..8e4f291 --- /dev/null +++ b/htpt-db-example/btk-utils.c @@ -0,0 +1 @@ +#include "btk-utils.h" diff --git a/htpt-db-example/config.mk b/htpt-db-example/config.mk new file mode 100644 index 0000000..9c239aa --- /dev/null +++ b/htpt-db-example/config.mk @@ -0,0 +1,16 @@ +# bucket version +VERSION = 1.0.0 + +# btk +BTK = btk +BTKFILES = ${BTK}/btk.c ${BTK}/btk-window.c ${BTK}/btk-cell.c ${BTK}/btk-text.c ${BTK}/btk-utils.c ${BTK}/btk-log.c + +# external libraries +LIBS = -lxcb -lcairo -pthread + +# flags +CPPFLAGS = -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" +CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os + +# compiler and linker +CC = cc diff --git a/htpt-db-example/hotpot b/htpt-db-example/hotpot new file mode 100644 index 0000000..28b9eac Binary files /dev/null and b/htpt-db-example/hotpot differ