OpenBSD対応
This commit is contained in:
13
Makefile
13
Makefile
@@ -25,9 +25,16 @@ CFLAGS = -Wall -Wextra \
|
|||||||
-L./dep/lib/${OS} -L/usr/lib -L/usr/local/lib -L/usr/X11R6/lib \
|
-L./dep/lib/${OS} -L/usr/lib -L/usr/local/lib -L/usr/X11R6/lib \
|
||||||
-I/usr/X11R6/include/freetype2 -I/usr/local/include/freetype2
|
-I/usr/X11R6/include/freetype2 -I/usr/local/include/freetype2
|
||||||
|
|
||||||
LDFLAGS = -lc -lX11 -lXft -lsys
|
LDFLAGS = -lc -lX11 -lXft
|
||||||
SLIB = -lxcb -lthr -lfontconfig -lfreetype -lXrender -lXau -lXdmcp -lexpat -lintl \
|
.if ${UNAME_S} == "FreeBSD"
|
||||||
-lbz2 -lpng16 -lbrotlidec -lz -lm -lbrotlicommon
|
LDFLAGS += -lsys
|
||||||
|
.endif
|
||||||
|
.if ${UNAME_S} == "FreeBSD"
|
||||||
|
SLIB += -lxcb -lthr -lfontconfig -lfreetype -lXrender -lXau -lXdmcp -lexpat -lintl \
|
||||||
|
-lbz2 -lpng16 -lbrotlidec -lz -lm -lbrotlicommon
|
||||||
|
.elif ${UNAME_S} == "OpenBSD"
|
||||||
|
SLIB += -lxcb -lpthread -lfontconfig -lz -lexpat -lfreetype -lXrender -lXau -lXdmcp
|
||||||
|
.endif
|
||||||
|
|
||||||
all: debug
|
all: debug
|
||||||
|
|
||||||
|
|||||||
24
main.c
24
main.c
@@ -110,7 +110,11 @@ int main() {
|
|||||||
int w = attr.width;
|
int w = attr.width;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
#if defined(__OpenBSD__)
|
||||||
|
ui.resLabel.font = XftFontOpenName(ui.display, screen, "Noto Sans CJK-48");
|
||||||
|
#elif defined(__FreeBSD__)
|
||||||
ui.resLabel.font = XftFontOpenName(ui.display, screen, "Noto Sans CJK-72");
|
ui.resLabel.font = XftFontOpenName(ui.display, screen, "Noto Sans CJK-72");
|
||||||
|
#endif
|
||||||
if (!ui.resLabel.font) {
|
if (!ui.resLabel.font) {
|
||||||
cleanup(&ui);
|
cleanup(&ui);
|
||||||
fprintf(stderr, "解決フォントの読み込みに失敗。\n");
|
fprintf(stderr, "解決フォントの読み込みに失敗。\n");
|
||||||
@@ -131,7 +135,11 @@ int main() {
|
|||||||
if (!XftColorAllocName(ui.display,
|
if (!XftColorAllocName(ui.display,
|
||||||
DefaultVisual(ui.display, DefaultScreen(ui.display)),
|
DefaultVisual(ui.display, DefaultScreen(ui.display)),
|
||||||
DefaultColormap(ui.display, DefaultScreen(ui.display)),
|
DefaultColormap(ui.display, DefaultScreen(ui.display)),
|
||||||
|
#if defined(__OpenBSD__)
|
||||||
|
"#f1ed25", &ui.resLabel.fg_color)) {
|
||||||
|
#elif defined(__FreeBSD__)
|
||||||
"#ee4030", &ui.resLabel.fg_color)) {
|
"#ee4030", &ui.resLabel.fg_color)) {
|
||||||
|
#endif
|
||||||
cleanup(&ui);
|
cleanup(&ui);
|
||||||
fprintf(stderr, "色の役割に失敗。\n");
|
fprintf(stderr, "色の役割に失敗。\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
@@ -139,7 +147,11 @@ int main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
#if defined(__OpenBSD__)
|
||||||
|
ui.problemLabel.font = XftFontOpenName(ui.display, screen, "Noto Sans CJK-12");
|
||||||
|
#elif defined(__FreeBSD__)
|
||||||
ui.problemLabel.font = XftFontOpenName(ui.display, screen, "Noto Sans CJK-24");
|
ui.problemLabel.font = XftFontOpenName(ui.display, screen, "Noto Sans CJK-24");
|
||||||
|
#endif
|
||||||
if (!ui.problemLabel.font) {
|
if (!ui.problemLabel.font) {
|
||||||
cleanup(&ui);
|
cleanup(&ui);
|
||||||
fprintf(stderr, "問題フォントの読み込みに失敗。\n");
|
fprintf(stderr, "問題フォントの読み込みに失敗。\n");
|
||||||
@@ -159,21 +171,33 @@ int main() {
|
|||||||
if (!XftColorAllocName(ui.display,
|
if (!XftColorAllocName(ui.display,
|
||||||
DefaultVisual(ui.display, DefaultScreen(ui.display)),
|
DefaultVisual(ui.display, DefaultScreen(ui.display)),
|
||||||
DefaultColormap(ui.display, DefaultScreen(ui.display)),
|
DefaultColormap(ui.display, DefaultScreen(ui.display)),
|
||||||
|
#if defined(__OpenBSD__)
|
||||||
|
"#b8b515", &ui.problemLabel.fg_color)) {
|
||||||
|
#elif defined(__FreeBSD__)
|
||||||
"#b61729", &ui.problemLabel.fg_color)) {
|
"#b61729", &ui.problemLabel.fg_color)) {
|
||||||
|
#endif
|
||||||
cleanup(&ui);
|
cleanup(&ui);
|
||||||
fprintf(stderr, "色の役割に失敗。\n");
|
fprintf(stderr, "色の役割に失敗。\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(__OpenBSD__)
|
||||||
|
ui.font = XftFontOpenName(ui.display, screen, "Noto Sans CJK-8");
|
||||||
|
#elif defined(__FreeBSD__)
|
||||||
ui.font = XftFontOpenName(ui.display, screen, "Noto Sans CJK-12");
|
ui.font = XftFontOpenName(ui.display, screen, "Noto Sans CJK-12");
|
||||||
|
#endif
|
||||||
if (!ui.font) {
|
if (!ui.font) {
|
||||||
cleanup(&ui);
|
cleanup(&ui);
|
||||||
fprintf(stderr, "フォントの読み込みに失敗。\n");
|
fprintf(stderr, "フォントの読み込みに失敗。\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(__OpenBSD__)
|
||||||
|
if (!XftColorAllocName(ui.display, &ui.visual, ui.colormap, "#232320", &ui.color)) {
|
||||||
|
#elif defined(__FreeBSD__)
|
||||||
if (!XftColorAllocName(ui.display, &ui.visual, ui.colormap, "#232020", &ui.color)) {
|
if (!XftColorAllocName(ui.display, &ui.visual, ui.colormap, "#232020", &ui.color)) {
|
||||||
|
#endif
|
||||||
cleanup(&ui);
|
cleanup(&ui);
|
||||||
fprintf(stderr, "色の役割に失敗。\n");
|
fprintf(stderr, "色の役割に失敗。\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|||||||
BIN
scrot1.png
BIN
scrot1.png
Binary file not shown.
|
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 71 KiB |
BIN
scrot2.png
BIN
scrot2.png
Binary file not shown.
|
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 101 KiB |
@@ -215,7 +215,11 @@ void control_expose(UiSystem *ui, XEvent *e) {
|
|||||||
XftColorAllocName(ui->display,
|
XftColorAllocName(ui->display,
|
||||||
DefaultVisual(ui->display, DefaultScreen(ui->display)),
|
DefaultVisual(ui->display, DefaultScreen(ui->display)),
|
||||||
DefaultColormap(ui->display, DefaultScreen(ui->display)),
|
DefaultColormap(ui->display, DefaultScreen(ui->display)),
|
||||||
|
#if defined(__OpenBSD__)
|
||||||
|
"#232320", &buttonColor);
|
||||||
|
#elif defined(__FreeBSD__)
|
||||||
"#232020", &buttonColor);
|
"#232020", &buttonColor);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
initialized = 1;
|
initialized = 1;
|
||||||
|
|
||||||
|
|||||||
7
src/ui.h
7
src/ui.h
@@ -4,10 +4,17 @@
|
|||||||
#include <X11/Xft/Xft.h>
|
#include <X11/Xft/Xft.h>
|
||||||
|
|
||||||
#define FGCOL 0xfcfcfc
|
#define FGCOL 0xfcfcfc
|
||||||
|
#if defined(__OpenBSD__)
|
||||||
|
#define BGCOL 0x232320
|
||||||
|
#define BTSEL 0xb8b515
|
||||||
|
#define BTCOL 0xf1ed25
|
||||||
|
#define BTHVR 0xecea71
|
||||||
|
#elif defined(__OpenBSD__)
|
||||||
#define BGCOL 0x232020
|
#define BGCOL 0x232020
|
||||||
#define BTSEL 0xb61729
|
#define BTSEL 0xb61729
|
||||||
#define BTCOL 0xee4030
|
#define BTCOL 0xee4030
|
||||||
#define BTHVR 0xf35869
|
#define BTHVR 0xf35869
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int x, y, width, height;
|
int x, y, width, height;
|
||||||
|
|||||||
Reference in New Issue
Block a user