From fdc704a70baa0b1a125ac74b83ea58d7eba783b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AB=8F=E8=A8=AA=E5=AD=90?= Date: Sun, 18 Jan 2026 02:19:31 +0900 Subject: [PATCH] =?UTF-8?q?OpenBSD=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +++ Makefile | 6 +++--- main.c | 14 +++++++++++++- src/program.h | 11 +++++++++-- 4 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b26a2cc --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +um +*.o +*.core diff --git a/Makefile b/Makefile index 6c3731f..83da358 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/main.c b/main.c index da8eed4..c8c1162 100644 --- a/main.c +++ b/main.c @@ -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); diff --git a/src/program.h b/src/program.h index d257e89..fc94b83 100644 --- a/src/program.h +++ b/src/program.h @@ -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];