Upload files to 'htpt-db-example'
This commit is contained in:
parent
5b03bf5004
commit
ea85e96feb
1
htpt-db-example/1642759082142.jpg
Normal file
1
htpt-db-example/1642759082142.jpg
Normal file
@ -0,0 +1 @@
|
|||||||
|
random stuff
|
142
htpt-db-example/btk-log.c
Normal file
142
htpt-db-example/btk-log.c
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#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');
|
||||||
|
}
|
1
htpt-db-example/btk-utils.c
Normal file
1
htpt-db-example/btk-utils.c
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include "btk-utils.h"
|
16
htpt-db-example/config.mk
Normal file
16
htpt-db-example/config.mk
Normal file
@ -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
|
BIN
htpt-db-example/hotpot
Normal file
BIN
htpt-db-example/hotpot
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user