要らない物の削除、FreeBSDの対応

このコミットが含まれているのは:
守矢諏訪子 2024-02-26 12:48:31 +09:00
コミット f707d98ca8
3個のファイルの変更29行の追加39行の削除

ファイルの表示

@ -6,15 +6,7 @@
#define TERMINAL "st" #define TERMINAL "st"
#define TERMCLASS "St" #define TERMCLASS "St"
#if MYOS == ARTIX #define BROWSER "firefox-esr"
#define BROWSER "iceweasel"
#elif MYOS == VOID || MYOS == OPENBSD || MYOS == FREEBSD
#define BROWSER "netsurf"
#elif MYOS == CRUX
#define BROWSER "librewolf"
#elif MYOS == POSTMARKETOS
#define BROWSER == "firefox-esr"
#endif
static const char wallpaper[] = "/home/suwako/.local/share/wallpapers/8ffe33a4a3459c39bcd0a11a528a3785-"; static const char wallpaper[] = "/home/suwako/.local/share/wallpapers/8ffe33a4a3459c39bcd0a11a528a3785-";
static const char ext[] = ".jpg"; static const char ext[] = ".jpg";

ファイルの表示

@ -4,49 +4,51 @@ OS := $(shell uname -s)
VERSION = 6.4 VERSION = 6.4
# paths # paths
ifeq ($(OS),FreeBSD)
PREFIX = /usr/local
MANPREFIX = ${PREFIX}/share/man
else ifeq ($(OS),OpenBSD)
PREFIX = /usr/local
MANPREFIX = $(PREFIX)/man
else
PREFIX = /usr PREFIX = /usr
MANPREFIX = ${PREFIX}/share/man MANPREFIX = ${PREFIX}/share/man
ifeq ($(OS),FreeBSD)
PREFIX = /usr/local
else ifeq ($(OS),OpenBSD)
PREFIX = /usr/local
MANPREFIX = $(PREFIX)/man
endif endif
X11INC = /usr/X11R6/include X11INC = /usr/X11R6/include
X11LIB = /usr/X11R6/lib X11LIB = /usr/X11R6/lib
ifeq ($(OS),FreeBSD)
X11INC = /usr/local/include
X11LIB = /usr/local/lib
endif
XINERAMALIBS = -lXinerama XINERAMALIBS = -lXinerama
XINERAMAFLAGS = -DXINERAMA XINERAMAFLAGS = -DXINERAMA
# freetype # freetype
FREETYPELIBS = -lfontconfig -lXft FREETYPELIBS = -lfontconfig -lXft
ifeq ($(OS),OpenBSD)
FREETYPEINC = ${X11INC}/freetype2
else
FREETYPEINC = ${PREFIX}/include/freetype2 FREETYPEINC = ${PREFIX}/include/freetype2
ifeq ($(OS),OpenBSD)
FREETYPEINC = ${X11INC}/freetype2
endif endif
# includes and libs # includes and libs
INCS = -I${X11INC} -I${FREETYPEINC} INCS = -I${X11INC} -I${FREETYPEINC}
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lX11-xcb -lxcb -lxcb-res -lXext -lImlib2 -lm LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lX11-xcb -lxcb -lxcb-res -lXext -lImlib2 -lm -lXrandr
ifeq ($(OS),FreeBSD) ifeq ($(OS),FreeBSD)
LIBS += -lutil LIBS += -lutil
endif endif
# flags # flags
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
ifeq ($(OS),Linux) ifeq ($(OS),Linux)
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} CPPFLAGS += -D_XOPEN_SOURCE=700L
endif else ifeq ($(OS),OpenBSD)
ifeq ($(OS),OpenBSD) CPPFLAGS += -D_POSIX_C_SOURCE=200809L
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} else ifneq ($(OS),FreeBSD)
endif CPPFLAGS += -D_XOPEN_SOURCE=700L
ifneq ($(OS),FreeBSD)
CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS}
endif endif
LDFLAGS = ${LIBS} LDFLAGS = ${LIBS}
CFLAGS = ${INCS}
# compiler and linker # compiler and linker
CC = cc CC = cc

18
dwm.c
ファイルの表示

@ -438,7 +438,7 @@ void setrootbg() {
Window wc; Window wc;
int screen; int screen;
Imlib_Image image; Imlib_Image image;
int screen_width, screen_height, image_width, image_height; int screen_width, screen_height, screen_depth, image_width, image_height;
float scale; float scale;
display = XOpenDisplay(NULL); display = XOpenDisplay(NULL);
@ -452,13 +452,8 @@ void setrootbg() {
screen = DefaultScreen(display); screen = DefaultScreen(display);
screen_width = DisplayWidth(display, screen); screen_width = DisplayWidth(display, screen);
screen_height = DisplayHeight(display, screen); screen_height = DisplayHeight(display, screen);
pixmap = XCreatePixmap( screen_depth = DefaultDepth(display, screen);
display, pixmap = XCreatePixmap(display, wc, screen_width, screen_height, screen_depth);
wc,
DisplayWidth(display, screen),
DisplayHeight(display, screen),
DefaultDepth(display, screen)
);
// 画像を読み込む // 画像を読み込む
imlib_context_set_display(display); imlib_context_set_display(display);
@ -476,6 +471,7 @@ void setrootbg() {
image_width = imlib_image_get_width(); image_width = imlib_image_get_width();
image_height = imlib_image_get_height(); image_height = imlib_image_get_height();
// https://gitlin.moe/himdel/hsetroot/blob/master/hsetroot.c
switch (bgmode) { switch (bgmode) {
case MODE_CENTER: case MODE_CENTER:
imlib_render_image_on_drawable((screen_width - image_width) / 2, (screen_height - image_height) / 2); imlib_render_image_on_drawable((screen_width - image_width) / 2, (screen_height - image_height) / 2);
@ -2558,9 +2554,9 @@ updatestatus(void)
Monitor* m; Monitor* m;
if (!gettextprop(root, XA_WM_NAME, rawstext, sizeof(rawstext))) { if (!gettextprop(root, XA_WM_NAME, rawstext, sizeof(rawstext))) {
#if defined(__FreeBSD__) || defined(__OpenBSD__) #if defined(__FreeBSD__) || defined(__OpenBSD__)
strlcpy(stext, "dwm-"VERSION, sizeof(stext)); strlcpy(stext, "dwm-6.4", sizeof(stext));
#else #else
strncpy(stext, "dwm-"VERSION, sizeof(stext) - 1); strncpy(stext, "dwm-6.4", sizeof(stext) - 1);
stext[sizeof(stext) - 1] = '\0'; stext[sizeof(stext) - 1] = '\0';
#endif #endif
} else { } else {
@ -2887,7 +2883,7 @@ int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
if (argc == 2 && !strcmp("-v", argv[1])) if (argc == 2 && !strcmp("-v", argv[1]))
die("dwm-"VERSION); die("dwm-6.4");
else if (argc != 1) else if (argc != 1)
die("usage: dwm [-v]"); die("usage: dwm [-v]");
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale()) if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())