OpenBSD対応

This commit is contained in:
2026-01-18 02:19:31 +09:00
parent bfb1a467a4
commit fdc704a70b
4 changed files with 28 additions and 6 deletions

3
.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
um
*.o
*.core

View File

@@ -45,13 +45,13 @@ CFLAGS += -I/usr/local/include -I/usr/local/include/X11\
CFLAGS += -I/usr/include/freetype2
.endif
LDFLAGS = -lc -lX11 -lXft -lsys
LDFLAGS = -lc -lX11 -lXft
SLIB = -lxcb
.if ${OS} == "openbsd"
SLIB += -lfontconfig -lz -lexpat -lfreetype -lXrender -lXau -lXdmcp
.elif ${OS} == "freebsd"
SLIB += -lthr -lfontconfig -lintl -lfreetype -lXrender -lXau -lXdmcp -lexpat -lz -lbz2\
-lpng16 -lbrotlidec -lm -lbrotlicommon
SLIB += -lsys -lthr -lfontconfig -lintl -lfreetype -lXrender -lXau -lXdmcp -lexpat \
-lz -lbz2 -lpng16 -lbrotlidec -lm -lbrotlicommon
.elif ${OS} == "netbsd"
SLIB += -lfontconfig -lfreetype -lXau -lXdmcp -lgcc -lexpat -lz -lbz2 -lXrandr\
-lXrender -lXext -lX11

14
main.c
View File

@@ -107,15 +107,27 @@ int main() {
exit(1);
}
#if defined(__OpenBSD__)
if (!XftColorAllocName(display, visual, colormap, "#f1ed25", &color)) {
cleanup(display, window, gc, &color, &selcolor, draw, font, colormap, visual);
fprintf(stderr, "色の役割に失敗。\n");
}
if (!XftColorAllocName(display, visual, colormap, "#12120f", &selcolor)) {
cleanup(display, window, gc, &color, &selcolor, draw, font, colormap, visual);
fprintf(stderr, "選択色の役割に失敗。\n");
}
#elif defined(__OpenBSD__)
if (!XftColorAllocName(display, visual, colormap, "#ee4030", &color)) {
cleanup(display, window, gc, &color, &selcolor, draw, font, colormap, visual);
fprintf(stderr, "色の役割に失敗。\n");
}
if (!XftColorAllocName(display, visual, colormap, "#120f12", &selcolor)) {
if (!XftColorAllocName(display, visual, colormap, "#120f0f", &selcolor)) {
cleanup(display, window, gc, &color, &selcolor, draw, font, colormap, visual);
fprintf(stderr, "選択色の役割に失敗。\n");
}
#endif
XMapWindow(display, window);

View File

@@ -8,10 +8,17 @@
#define MAX_NAME_LEN 256
#define MAX_LINE_LENGTH 256
#if defined(__OpenBSD__)
#define FGCOL 0xb8b515
#define FGSEL 0x12120f
#define BGSEL 0xf2ea57
#define BGCOL 0x232320
#elif defined(__FreeBSD__)
#define FGCOL 0xb61729
#define FGSEL 0x120f12
#define FGSEL 0x120f0f
#define BGSEL 0xf35869
#define BGCOL 0x232023
#define BGCOL 0x232020
#endif
typedef struct {
char name[MAX_NAME_LEN];