Make compiling for wayland optional
This can be changed in config.mk or by using the command make WAYLAND=0 Also removed using_xwayland function definition as it isn't defined anymore
This commit is contained in:
parent
5a20d463b5
commit
bb12727bc0
13
Makefile
13
Makefile
@ -33,9 +33,11 @@ $(error "Failed to query $(PKG_CONFIG) for package 'systemd'!")
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifneq (0,${WAYLAND})
|
||||||
DATA_DIR_WAYLAND_PROTOCOLS ?= $(shell $(PKG_CONFIG) wayland-protocols --variable=pkgdatadir)
|
DATA_DIR_WAYLAND_PROTOCOLS ?= $(shell $(PKG_CONFIG) wayland-protocols --variable=pkgdatadir)
|
||||||
ifeq (,${DATA_DIR_WAYLAND_PROTOCOLS})
|
ifeq (,${DATA_DIR_WAYLAND_PROTOCOLS})
|
||||||
$(error "Failed to query $(PKG_CONFIG) for package 'wayland-protocols'!")
|
$(warning "Failed to query $(PKG_CONFIG) for package 'wayland-protocols'!")
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LIBS := $(shell $(PKG_CONFIG) --libs ${pkg_config_packs})
|
LIBS := $(shell $(PKG_CONFIG) --libs ${pkg_config_packs})
|
||||||
@ -50,7 +52,14 @@ endif
|
|||||||
CFLAGS := ${DEFAULT_CPPFLAGS} ${CPPFLAGS} ${DEFAULT_CFLAGS} ${CFLAGS} ${INCS} -MMD -MP
|
CFLAGS := ${DEFAULT_CPPFLAGS} ${CPPFLAGS} ${DEFAULT_CFLAGS} ${CFLAGS} ${INCS} -MMD -MP
|
||||||
LDFLAGS := ${DEFAULT_LDFLAGS} ${LDFLAGS} ${LIBS}
|
LDFLAGS := ${DEFAULT_LDFLAGS} ${LDFLAGS} ${LIBS}
|
||||||
|
|
||||||
|
|
||||||
|
ifeq (0,${WAYLAND})
|
||||||
|
# without wayland support
|
||||||
|
SRC := $(sort $(shell ${FIND} src/ -not \( -path src/wayland -prune \) -name '*.c'))
|
||||||
|
else
|
||||||
|
# with Wayland support
|
||||||
SRC := $(sort $(shell ${FIND} src/ -name '*.c'))
|
SRC := $(sort $(shell ${FIND} src/ -name '*.c'))
|
||||||
|
endif
|
||||||
OBJ := ${SRC:.c=.o}
|
OBJ := ${SRC:.c=.o}
|
||||||
TEST_SRC := $(sort $(shell ${FIND} test/ -name '*.c'))
|
TEST_SRC := $(sort $(shell ${FIND} test/ -name '*.c'))
|
||||||
TEST_OBJ := $(TEST_SRC:.c=.o)
|
TEST_OBJ := $(TEST_SRC:.c=.o)
|
||||||
@ -133,6 +142,7 @@ service-systemd:
|
|||||||
@${SED} "s|##PREFIX##|$(PREFIX)|" dunst.systemd.service.in > dunst.systemd.service
|
@${SED} "s|##PREFIX##|$(PREFIX)|" dunst.systemd.service.in > dunst.systemd.service
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifneq (0,${WAYLAND})
|
||||||
wayland-protocols: src/wayland/protocols/wlr-layer-shell-unstable-v1.xml
|
wayland-protocols: src/wayland/protocols/wlr-layer-shell-unstable-v1.xml
|
||||||
mkdir -p src/wayland/protocols
|
mkdir -p src/wayland/protocols
|
||||||
wayland-scanner private-code ${DATA_DIR_WAYLAND_PROTOCOLS}/stable/xdg-shell/xdg-shell.xml src/wayland/protocols/xdg-shell.h
|
wayland-scanner private-code ${DATA_DIR_WAYLAND_PROTOCOLS}/stable/xdg-shell/xdg-shell.xml src/wayland/protocols/xdg-shell.h
|
||||||
@ -143,6 +153,7 @@ wayland-protocols: src/wayland/protocols/wlr-layer-shell-unstable-v1.xml
|
|||||||
wayland-scanner private-code src/wayland/protocols/wlr-layer-shell-unstable-v1.xml src/wayland/protocols/wlr-layer-shell-unstable-v1.h
|
wayland-scanner private-code src/wayland/protocols/wlr-layer-shell-unstable-v1.xml src/wayland/protocols/wlr-layer-shell-unstable-v1.h
|
||||||
wayland-scanner client-header src/wayland/protocols/idle.xml src/wayland/protocols/idle-client-header.h
|
wayland-scanner client-header src/wayland/protocols/idle.xml src/wayland/protocols/idle-client-header.h
|
||||||
wayland-scanner private-code src/wayland/protocols/idle.xml src/wayland/protocols/idle.h
|
wayland-scanner private-code src/wayland/protocols/idle.xml src/wayland/protocols/idle.h
|
||||||
|
endif
|
||||||
|
|
||||||
.PHONY: clean clean-dunst clean-dunstify clean-doc clean-tests clean-coverage clean-coverage-run clean-wayland-protocols
|
.PHONY: clean clean-dunst clean-dunstify clean-doc clean-tests clean-coverage clean-coverage-run clean-wayland-protocols
|
||||||
clean: clean-dunst clean-dunstify clean-doc clean-tests clean-coverage clean-coverage-run
|
clean: clean-dunst clean-dunstify clean-doc clean-tests clean-coverage clean-coverage-run
|
||||||
|
@ -26,6 +26,8 @@ Dunst has a number of build dependencies that must be present before attempting
|
|||||||
- pango/cairo
|
- pango/cairo
|
||||||
- libgtk-3-dev
|
- libgtk-3-dev
|
||||||
- libnotify (for dunstify only)
|
- libnotify (for dunstify only)
|
||||||
|
- wayland-client (can build without, see [make parameters](#make-parameters))
|
||||||
|
- wayland-protocols (optional, for recompiling protocols)
|
||||||
|
|
||||||
### Building
|
### Building
|
||||||
|
|
||||||
@ -38,11 +40,13 @@ sudo make install
|
|||||||
|
|
||||||
### Make parameters
|
### Make parameters
|
||||||
|
|
||||||
|
- `DESTDIR=<PATH>`: Set the destination directory of the installation. (Default: `/`)
|
||||||
- `PREFIX=<PATH>`: Set the prefix of the installation. (Default: `/usr/local`)
|
- `PREFIX=<PATH>`: Set the prefix of the installation. (Default: `/usr/local`)
|
||||||
- `BINDIR=<PATH>`: Set the `dunst` executable's path (Default: `${PREFIX}/bin`)
|
- `BINDIR=<PATH>`: Set the `dunst` executable's path (Default: `${PREFIX}/bin`)
|
||||||
- `DATADIR=<PATH>`: Set the path for shared files. (Default: `${PREFIX}/share`)
|
- `DATADIR=<PATH>`: Set the path for shared files. (Default: `${PREFIX}/share`)
|
||||||
- `MANDIR=<PATH>`: Set the prefix of the manpage. (Default: `${DATADIR}/man`)
|
- `MANDIR=<PATH>`: Set the prefix of the manpage. (Default: `${DATADIR}/man`)
|
||||||
- `SYSTEMD=(0|1)`: Enable/Disable the systemd unit. (Default: detected via `pkg-config`)
|
- `SYSTEMD=(0|1)`: Enable/Disable the systemd unit. (Default: detected via `pkg-config`)
|
||||||
|
- `WAYLAND=(0|1)`: Enable/Disable wayland support. (Default: 1)
|
||||||
- `SERVICEDIR_SYSTEMD=<PATH>`: The path to put the systemd user service file. Unused, if `SYSTEMD=0`. (Default: detected via `pkg-config`)
|
- `SERVICEDIR_SYSTEMD=<PATH>`: The path to put the systemd user service file. Unused, if `SYSTEMD=0`. (Default: detected via `pkg-config`)
|
||||||
- `SERVICEDIR_DBUS=<PATH>`: The path to put the dbus service file. (Default: detected via `pkg-config`)
|
- `SERVICEDIR_DBUS=<PATH>`: The path to put the dbus service file. (Default: detected via `pkg-config`)
|
||||||
|
|
||||||
|
16
config.mk
16
config.mk
@ -20,13 +20,22 @@ VALGRIND ?= valgrind
|
|||||||
# if you don't want to use systemd albeit installed
|
# if you don't want to use systemd albeit installed
|
||||||
#SYSTEMD ?= 0
|
#SYSTEMD ?= 0
|
||||||
|
|
||||||
|
# Disable dependency on wayland. This will force dunst to use
|
||||||
|
# xwayland on wayland compositors
|
||||||
|
# You can also use "make WAYLAND=0" to build without wayland
|
||||||
|
# WAYLAND ?= 0
|
||||||
|
|
||||||
|
ifneq (0, ${WAYLAND})
|
||||||
|
ENABLE_WAYLAND= -DENABLE_WAYLAND
|
||||||
|
endif
|
||||||
|
|
||||||
# uncomment to disable parsing of dunstrc
|
# uncomment to disable parsing of dunstrc
|
||||||
# or use "CFLAGS=-DSTATIC_CONFIG make" to build
|
# or use "CFLAGS=-DSTATIC_CONFIG make" to build
|
||||||
#STATIC= -DSTATIC_CONFIG # Warning: This is deprecated behavior
|
#STATIC= -DSTATIC_CONFIG # Warning: This is deprecated behavior
|
||||||
|
|
||||||
# flags
|
# flags
|
||||||
DEFAULT_CPPFLAGS = -D_DEFAULT_SOURCE -DVERSION=\"${VERSION}\"
|
DEFAULT_CPPFLAGS = -D_DEFAULT_SOURCE -DVERSION=\"${VERSION}\"
|
||||||
DEFAULT_CFLAGS = -g --std=gnu99 -pedantic -Wall -Wno-overlength-strings -Os ${STATIC}
|
DEFAULT_CFLAGS = -g --std=gnu99 -pedantic -Wall -Wno-overlength-strings -Os ${STATIC} ${ENABLE_WAYLAND}
|
||||||
DEFAULT_LDFLAGS = -lm -lrt
|
DEFAULT_LDFLAGS = -lm -lrt
|
||||||
|
|
||||||
CPPFLAGS_DEBUG := -DDEBUG_BUILD
|
CPPFLAGS_DEBUG := -DDEBUG_BUILD
|
||||||
@ -42,12 +51,15 @@ pkg_config_packs := gio-2.0 \
|
|||||||
xext \
|
xext \
|
||||||
"xrandr >= 1.5" \
|
"xrandr >= 1.5" \
|
||||||
xscrnsaver \
|
xscrnsaver \
|
||||||
wayland-client \
|
|
||||||
|
|
||||||
|
|
||||||
# dunstify also needs libnotify
|
# dunstify also needs libnotify
|
||||||
pkg_config_packs += libnotify
|
pkg_config_packs += libnotify
|
||||||
|
|
||||||
|
ifneq (0,${WAYLAND})
|
||||||
|
pkg_config_packs += wayland-client
|
||||||
|
endif
|
||||||
|
|
||||||
ifneq (,$(findstring STATIC_CONFIG,$(CFLAGS)))
|
ifneq (,$(findstring STATIC_CONFIG,$(CFLAGS)))
|
||||||
$(warning STATIC_CONFIG is deprecated behavior. It will get removed in future releases)
|
$(warning STATIC_CONFIG is deprecated behavior. It will get removed in future releases)
|
||||||
endif
|
endif
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <wayland-client.h>
|
|
||||||
|
|
||||||
#include "dbus.h"
|
#include "dbus.h"
|
||||||
#include "draw.h"
|
#include "draw.h"
|
||||||
|
@ -3,7 +3,10 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "x11/x.h"
|
#include "x11/x.h"
|
||||||
#include "x11/screen.h"
|
#include "x11/screen.h"
|
||||||
|
|
||||||
|
#ifdef ENABLE_WAYLAND
|
||||||
#include "wayland/wl.h"
|
#include "wayland/wl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
const bool is_running_wayland(void) {
|
const bool is_running_wayland(void) {
|
||||||
char* wayland_display = getenv("WAYLAND_DISPLAY");
|
char* wayland_display = getenv("WAYLAND_DISPLAY");
|
||||||
@ -30,6 +33,7 @@ const struct output output_x11 = {
|
|||||||
have_fullscreen_window
|
have_fullscreen_window
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef ENABLE_WAYLAND
|
||||||
const struct output output_wl = {
|
const struct output output_wl = {
|
||||||
wl_init,
|
wl_init,
|
||||||
wl_deinit,
|
wl_deinit,
|
||||||
@ -49,9 +53,11 @@ const struct output output_wl = {
|
|||||||
wl_is_idle,
|
wl_is_idle,
|
||||||
wl_have_fullscreen_window
|
wl_have_fullscreen_window
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
const struct output* output_create(bool force_xwayland)
|
const struct output* output_create(bool force_xwayland)
|
||||||
{
|
{
|
||||||
|
#ifdef ENABLE_WAYLAND
|
||||||
if (!force_xwayland && is_running_wayland()) {
|
if (!force_xwayland && is_running_wayland()) {
|
||||||
LOG_I("Using Wayland output");
|
LOG_I("Using Wayland output");
|
||||||
return &output_wl;
|
return &output_wl;
|
||||||
@ -59,5 +65,8 @@ const struct output* output_create(bool force_xwayland)
|
|||||||
LOG_I("Using X11 output");
|
LOG_I("Using X11 output");
|
||||||
return &output_x11;
|
return &output_x11;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
return &output_x11;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
/* vim: set ft=c tabstop=8 shiftwidth=8 expandtab textwidth=0: */
|
/* vim: set ft=c tabstop=8 shiftwidth=8 expandtab textwidth=0: */
|
||||||
|
@ -51,7 +51,5 @@ const struct output* output_create(bool force_xwayland);
|
|||||||
|
|
||||||
const bool is_running_wayland(void);
|
const bool is_running_wayland(void);
|
||||||
|
|
||||||
const bool is_running_xwayland(void);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/* vim: set ft=c tabstop=8 shiftwidth=8 expandtab textwidth=0: */
|
/* vim: set ft=c tabstop=8 shiftwidth=8 expandtab textwidth=0: */
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include "rules.h"
|
#include "rules.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "x11/x.h"
|
#include "x11/x.h"
|
||||||
|
#include "output.h"
|
||||||
|
|
||||||
#include "../config.h"
|
#include "../config.h"
|
||||||
|
|
||||||
@ -215,6 +216,14 @@ void load_settings(char *cmdline_config_path)
|
|||||||
"Don't timeout notifications if user is longer idle than threshold"
|
"Don't timeout notifications if user is longer idle than threshold"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifndef ENABLE_WAYLAND
|
||||||
|
if (is_running_wayland()){
|
||||||
|
/* We are using xwayland now. Setting force_xwayland to make sure
|
||||||
|
* the idle workaround below is activated */
|
||||||
|
settings.force_xwayland = true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (settings.force_xwayland) {
|
if (settings.force_xwayland) {
|
||||||
/* There is no way to detect if the user is idle
|
/* There is no way to detect if the user is idle
|
||||||
* on xwayland, so turn this feature off */
|
* on xwayland, so turn this feature off */
|
||||||
|
@ -4,7 +4,9 @@
|
|||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#ifdef ENABLE_WAYLAND
|
||||||
#include "wayland/protocols/wlr-layer-shell-unstable-v1-client-header.h"
|
#include "wayland/protocols/wlr-layer-shell-unstable-v1-client-header.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "markup.h"
|
#include "markup.h"
|
||||||
#include "notification.h"
|
#include "notification.h"
|
||||||
@ -17,6 +19,16 @@ enum vertical_alignment { VERTICAL_TOP, VERTICAL_CENTER, VERTICAL_BOTTOM };
|
|||||||
enum separator_color { SEP_FOREGROUND, SEP_AUTO, SEP_FRAME, SEP_CUSTOM };
|
enum separator_color { SEP_FOREGROUND, SEP_AUTO, SEP_FRAME, SEP_CUSTOM };
|
||||||
enum follow_mode { FOLLOW_NONE, FOLLOW_MOUSE, FOLLOW_KEYBOARD };
|
enum follow_mode { FOLLOW_NONE, FOLLOW_MOUSE, FOLLOW_KEYBOARD };
|
||||||
enum mouse_action { MOUSE_NONE, MOUSE_DO_ACTION, MOUSE_CLOSE_CURRENT, MOUSE_CLOSE_ALL };
|
enum mouse_action { MOUSE_NONE, MOUSE_DO_ACTION, MOUSE_CLOSE_CURRENT, MOUSE_CLOSE_ALL };
|
||||||
|
#ifndef ZWLR_LAYER_SHELL_V1_LAYER_ENUM
|
||||||
|
#define ZWLR_LAYER_SHELL_V1_LAYER_ENUM
|
||||||
|
// Needed for compiling without wayland dependency
|
||||||
|
enum zwlr_layer_shell_v1_layer {
|
||||||
|
ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND = 0,
|
||||||
|
ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM = 1,
|
||||||
|
ZWLR_LAYER_SHELL_V1_LAYER_TOP = 2,
|
||||||
|
ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY = 3,
|
||||||
|
};
|
||||||
|
#endif /* ZWLR_LAYER_SHELL_V1_LAYER_ENUM */
|
||||||
|
|
||||||
struct separator_color_data {
|
struct separator_color_data {
|
||||||
enum separator_color type;
|
enum separator_color type;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user