forked from speedie/spmenu
Don't define USE*
This commit is contained in:
parent
8128ba040f
commit
3bc8d85937
20
libs/arg.c
20
libs/arg.c
|
@ -188,15 +188,15 @@ void moveend(Arg *arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void paste(Arg *arg) {
|
void paste(Arg *arg) {
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
if (protocol) {
|
if (protocol) {
|
||||||
paste_wl();
|
paste_wl();
|
||||||
} else {
|
} else {
|
||||||
#if USEX
|
#if X11
|
||||||
paste_x11(arg->i);
|
paste_x11(arg->i);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#elif USEX
|
#elif X11
|
||||||
paste_x11(arg->i);
|
paste_x11(arg->i);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -408,14 +408,14 @@ void setlineheight(Arg *arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void setimgsize(Arg *arg) {
|
void setimgsize(Arg *arg) {
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
setimagesize(img.imagewidth + arg->i, img.imageheight + arg->i);
|
setimagesize(img.imagewidth + arg->i, img.imageheight + arg->i);
|
||||||
drawmenu();
|
drawmenu();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void flipimg(Arg *arg) {
|
void flipimg(Arg *arg) {
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
|
|
||||||
if (!image) return;
|
if (!image) return;
|
||||||
|
|
||||||
|
@ -427,7 +427,7 @@ void flipimg(Arg *arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void setimgpos(Arg *arg) {
|
void setimgpos(Arg *arg) {
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
if (!image || hideimage) return;
|
if (!image || hideimage) return;
|
||||||
|
|
||||||
if (imageposition < 3) {
|
if (imageposition < 3) {
|
||||||
|
@ -441,7 +441,7 @@ void setimgpos(Arg *arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void setimggaps(Arg *arg) {
|
void setimggaps(Arg *arg) {
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
img.imagegaps += arg->i;
|
img.imagegaps += arg->i;
|
||||||
|
|
||||||
if (img.imagegaps < 0)
|
if (img.imagegaps < 0)
|
||||||
|
@ -511,7 +511,7 @@ void togglehighlight(Arg *arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void toggleregex(Arg *arg) {
|
void toggleregex(Arg *arg) {
|
||||||
#if USEREGEX
|
#if REGEX
|
||||||
regex = !regex;
|
regex = !regex;
|
||||||
|
|
||||||
match();
|
match();
|
||||||
|
@ -528,7 +528,7 @@ void togglefuzzy(Arg *arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void toggleimg(Arg *arg) {
|
void toggleimg(Arg *arg) {
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
|
|
||||||
hideimage = !hideimage;
|
hideimage = !hideimage;
|
||||||
|
|
||||||
|
@ -538,7 +538,7 @@ void toggleimg(Arg *arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void defaultimg(Arg *arg) {
|
void defaultimg(Arg *arg) {
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
|
|
||||||
if (hideimage || !image) return;
|
if (hideimage || !image) return;
|
||||||
|
|
||||||
|
|
40
libs/argv.c
40
libs/argv.c
|
@ -9,8 +9,8 @@ void readargs(int argc, char *argv[]) {
|
||||||
int j = 0;
|
int j = 0;
|
||||||
int k = 0;
|
int k = 0;
|
||||||
|
|
||||||
#if !USEX
|
#if !X11
|
||||||
#if !USEWAYLAND
|
#if !WAYLAND
|
||||||
die("Why did you think it was a good idea to compile me without support for any display server? You're an idiot. :)");
|
die("Why did you think it was a good idea to compile me without support for any display server? You're an idiot. :)");
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -40,7 +40,7 @@ void readargs(int argc, char *argv[]) {
|
||||||
} else if (!strcmp(argv[j], "-wl") || (!strcmp(argv[j], "--wayland"))) {
|
} else if (!strcmp(argv[j], "-wl") || (!strcmp(argv[j], "--wayland"))) {
|
||||||
protocol = 1;
|
protocol = 1;
|
||||||
protocol_override = 1;
|
protocol_override = 1;
|
||||||
#if USECONFIG
|
#if CONFIG
|
||||||
} else if (!strcmp(argv[j], "-cf") || (!strcmp(argv[j], "--config-file"))) { // specify a config file
|
} else if (!strcmp(argv[j], "-cf") || (!strcmp(argv[j], "--config-file"))) { // specify a config file
|
||||||
if (argv[j+1]) {
|
if (argv[j+1]) {
|
||||||
configfile = argv[++j];
|
configfile = argv[++j];
|
||||||
|
@ -63,7 +63,7 @@ void readargs(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if USECONFIG
|
#if CONFIG
|
||||||
conf_init();
|
conf_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -75,13 +75,13 @@ void readargs(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
if (protocol) {
|
if (protocol) {
|
||||||
if (connect_display(&state)) {
|
if (connect_display(&state)) {
|
||||||
protocol = 0;
|
protocol = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if USEX
|
#if X11
|
||||||
if (getenv("GNOME_SETUP_DISPLAY")) { // This is a GNOME Wayland session which doesn't implement wlr-layer-shell
|
if (getenv("GNOME_SETUP_DISPLAY")) { // This is a GNOME Wayland session which doesn't implement wlr-layer-shell
|
||||||
protocol = 0;
|
protocol = 0;
|
||||||
}
|
}
|
||||||
|
@ -89,9 +89,9 @@ void readargs(int argc, char *argv[]) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// init/read xrdb
|
// init/read xrdb
|
||||||
#if USEX
|
#if X11
|
||||||
if (xresources && !protocol) {
|
if (xresources && !protocol) {
|
||||||
#if USEXRESOURCES
|
#if XRESOURCES
|
||||||
XrmInitialize();
|
XrmInitialize();
|
||||||
load_xresources();
|
load_xresources();
|
||||||
#else
|
#else
|
||||||
|
@ -285,7 +285,7 @@ void readargs(int argc, char *argv[]) {
|
||||||
|| !strcmp(argv[i], "--x11")
|
|| !strcmp(argv[i], "--x11")
|
||||||
|| !strcmp(argv[i], "--load-binds")
|
|| !strcmp(argv[i], "--load-binds")
|
||||||
|| !strcmp(argv[i], "--no-load-binds")
|
|| !strcmp(argv[i], "--no-load-binds")
|
||||||
#if USECONFIG
|
#if CONFIG
|
||||||
|| !strcmp(argv[i], "-cf")
|
|| !strcmp(argv[i], "-cf")
|
||||||
|| !strcmp(argv[i], "--config-file")
|
|| !strcmp(argv[i], "--config-file")
|
||||||
|| (configfile && !strcmp(argv[i], configfile))
|
|| (configfile && !strcmp(argv[i], configfile))
|
||||||
|
@ -413,7 +413,7 @@ void readargs(int argc, char *argv[]) {
|
||||||
} else if (!strcmp(argv[i], "-nir") || (!strcmp(argv[i], "--no-image-resize"))) { // no image resize
|
} else if (!strcmp(argv[i], "-nir") || (!strcmp(argv[i], "--no-image-resize"))) { // no image resize
|
||||||
imageresize = 0;
|
imageresize = 0;
|
||||||
} else if (!strcmp(argv[i], "-w") || (!strcmp(argv[i], "--embed"))) { // embedding window id
|
} else if (!strcmp(argv[i], "-w") || (!strcmp(argv[i], "--embed"))) { // embedding window id
|
||||||
#if USEX
|
#if X11
|
||||||
x11.embed = argv[++i];
|
x11.embed = argv[++i];
|
||||||
#endif
|
#endif
|
||||||
} else if (!strcmp(argv[i], "-n") || (!strcmp(argv[i], "--preselect"))) { // preselected item
|
} else if (!strcmp(argv[i], "-n") || (!strcmp(argv[i], "--preselect"))) { // preselected item
|
||||||
|
@ -520,7 +520,7 @@ void readargs(int argc, char *argv[]) {
|
||||||
|| !strcmp(argv[i], "--x11")
|
|| !strcmp(argv[i], "--x11")
|
||||||
|| !strcmp(argv[i], "--load-binds")
|
|| !strcmp(argv[i], "--load-binds")
|
||||||
|| !strcmp(argv[i], "--no-load-binds")
|
|| !strcmp(argv[i], "--no-load-binds")
|
||||||
#if USECONFIG
|
#if CONFIG
|
||||||
|| !strcmp(argv[i], "-cf")
|
|| !strcmp(argv[i], "-cf")
|
||||||
|| !strcmp(argv[i], "--config-file")
|
|| !strcmp(argv[i], "--config-file")
|
||||||
|| (configfile && !strcmp(argv[i], configfile))
|
|| (configfile && !strcmp(argv[i], configfile))
|
||||||
|
@ -536,10 +536,10 @@ void readargs(int argc, char *argv[]) {
|
||||||
else
|
else
|
||||||
fprintf(stderr, "spmenu: Invalid argument: '%s'\n", argv[i]);
|
fprintf(stderr, "spmenu: Invalid argument: '%s'\n", argv[i]);
|
||||||
|
|
||||||
#if !USEX
|
#if !X11
|
||||||
protocol = 1;
|
protocol = 1;
|
||||||
#endif
|
#endif
|
||||||
#if !USEWAYLAND
|
#if !WAYLAND
|
||||||
protocol = 0;
|
protocol = 0;
|
||||||
#endif
|
#endif
|
||||||
if (casesensitive) {
|
if (casesensitive) {
|
||||||
|
@ -559,37 +559,37 @@ void readargs(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void comp_opts(void) {
|
void comp_opts(void) {
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
fprintf(stdout, "Wayland: Supported\n");
|
fprintf(stdout, "Wayland: Supported\n");
|
||||||
#else
|
#else
|
||||||
fprintf(stdout, "Wayland: Unsupported\n");
|
fprintf(stdout, "Wayland: Unsupported\n");
|
||||||
#endif
|
#endif
|
||||||
#if USEX
|
#if X11
|
||||||
fprintf(stdout, "X11: Supported\n");
|
fprintf(stdout, "X11: Supported\n");
|
||||||
#else
|
#else
|
||||||
fprintf(stdout, "X11: Unsupported\n");
|
fprintf(stdout, "X11: Unsupported\n");
|
||||||
#endif
|
#endif
|
||||||
#if USERTL
|
#if RTL
|
||||||
fprintf(stdout, "RTL: Supported\n");
|
fprintf(stdout, "RTL: Supported\n");
|
||||||
#else
|
#else
|
||||||
fprintf(stdout, "RTL: Unsupported\n");
|
fprintf(stdout, "RTL: Unsupported\n");
|
||||||
#endif
|
#endif
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
fprintf(stdout, "Images: Supported\n");
|
fprintf(stdout, "Images: Supported\n");
|
||||||
#else
|
#else
|
||||||
fprintf(stdout, "Images: Unsupported\n");
|
fprintf(stdout, "Images: Unsupported\n");
|
||||||
#endif
|
#endif
|
||||||
#if USEXINERAMA
|
#if XINERAMA
|
||||||
fprintf(stdout, "Xinerama: Supported\n");
|
fprintf(stdout, "Xinerama: Supported\n");
|
||||||
#else
|
#else
|
||||||
fprintf(stdout, "Xinerama: Unsupported\n");
|
fprintf(stdout, "Xinerama: Unsupported\n");
|
||||||
#endif
|
#endif
|
||||||
#if USECONFIG
|
#if CONFIG
|
||||||
fprintf(stdout, "Config: Supported\n");
|
fprintf(stdout, "Config: Supported\n");
|
||||||
#else
|
#else
|
||||||
fprintf(stdout, "Config: Unsupported\n");
|
fprintf(stdout, "Config: Unsupported\n");
|
||||||
#endif
|
#endif
|
||||||
#if USEXRESOURCES
|
#if XRESOURCES
|
||||||
fprintf(stdout, "xrdb: Supported\n");
|
fprintf(stdout, "xrdb: Supported\n");
|
||||||
#else
|
#else
|
||||||
fprintf(stdout, "xrdb: Unsupported\n");
|
fprintf(stdout, "xrdb: Unsupported\n");
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* See LICENSE file for copyright and license details. */
|
/* See LICENSE file for copyright and license details. */
|
||||||
#if USECONFIG
|
#if CONFIG
|
||||||
#include <libconfig.h>
|
#include <libconfig.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ int bind_init(void) {
|
||||||
// look up
|
// look up
|
||||||
config_setting_lookup_string(conf, "modifier", &dest);
|
config_setting_lookup_string(conf, "modifier", &dest);
|
||||||
|
|
||||||
#if USEX
|
#if X11
|
||||||
for (int j = 0; j < LENGTH(ml); j++) {
|
for (int j = 0; j < LENGTH(ml); j++) {
|
||||||
if (!strcmp(ml[j].mod, strdup(dest))) {
|
if (!strcmp(ml[j].mod, strdup(dest))) {
|
||||||
ckeys[i].mod = ml[j].modifier;
|
ckeys[i].mod = ml[j].modifier;
|
||||||
|
@ -71,7 +71,7 @@ int bind_init(void) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
for (int j = 0; j < LENGTH(wml); j++) {
|
for (int j = 0; j < LENGTH(wml); j++) {
|
||||||
if (!strcmp(wml[j].mod, strdup(dest))) {
|
if (!strcmp(wml[j].mod, strdup(dest))) {
|
||||||
wl_ckeys[i].modifier = wml[j].modifier;
|
wl_ckeys[i].modifier = wml[j].modifier;
|
||||||
|
@ -80,17 +80,17 @@ int bind_init(void) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (config_setting_lookup_int(conf, "mode", &nmode)) {
|
if (config_setting_lookup_int(conf, "mode", &nmode)) {
|
||||||
#if USEX
|
#if X11
|
||||||
ckeys[i].mode = nmode;
|
ckeys[i].mode = nmode;
|
||||||
#endif
|
#endif
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
wl_ckeys[i].mode = nmode;
|
wl_ckeys[i].mode = nmode;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
config_setting_lookup_string(conf, "key", &dest);
|
config_setting_lookup_string(conf, "key", &dest);
|
||||||
|
|
||||||
#if USEX
|
#if X11
|
||||||
for (int j = 0; j < LENGTH(kl); j++) {
|
for (int j = 0; j < LENGTH(kl); j++) {
|
||||||
if (!strcmp(kl[j].key, strdup(dest))) {
|
if (!strcmp(kl[j].key, strdup(dest))) {
|
||||||
ckeys[i].keysym = kl[j].keysym;
|
ckeys[i].keysym = kl[j].keysym;
|
||||||
|
@ -98,7 +98,7 @@ int bind_init(void) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
for (int j = 0; j < LENGTH(wkl); j++) {
|
for (int j = 0; j < LENGTH(wkl); j++) {
|
||||||
if (!strcmp(wkl[j].key, strdup(dest))) {
|
if (!strcmp(wkl[j].key, strdup(dest))) {
|
||||||
wl_ckeys[i].keysym = wkl[j].keysym;
|
wl_ckeys[i].keysym = wkl[j].keysym;
|
||||||
|
@ -110,10 +110,10 @@ int bind_init(void) {
|
||||||
|
|
||||||
for (int j = 0; j < LENGTH(fl); j++) {
|
for (int j = 0; j < LENGTH(fl); j++) {
|
||||||
if (!strcmp(fl[j].function, strdup(dest))) {
|
if (!strcmp(fl[j].function, strdup(dest))) {
|
||||||
#if USEX
|
#if X11
|
||||||
ckeys[i].func = fl[j].func;
|
ckeys[i].func = fl[j].func;
|
||||||
#endif
|
#endif
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
wl_ckeys[i].func = fl[j].func;
|
wl_ckeys[i].func = fl[j].func;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -123,10 +123,10 @@ int bind_init(void) {
|
||||||
|
|
||||||
for (int j = 0; j < LENGTH(al); j++) {
|
for (int j = 0; j < LENGTH(al); j++) {
|
||||||
if (!strcmp(al[j].argument, strdup(dest))) {
|
if (!strcmp(al[j].argument, strdup(dest))) {
|
||||||
#if USEX
|
#if X11
|
||||||
ckeys[i].arg = al[j].arg;
|
ckeys[i].arg = al[j].arg;
|
||||||
#endif
|
#endif
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
wl_ckeys[i].arg = al[j].arg;
|
wl_ckeys[i].arg = al[j].arg;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ int bind_init(void) {
|
||||||
// load options bind.mouse
|
// load options bind.mouse
|
||||||
config_setting_t *mouse_bind = config_lookup(&bind, "bind.mouse");
|
config_setting_t *mouse_bind = config_lookup(&bind, "bind.mouse");
|
||||||
if (mouse_bind != NULL && loadbinds) {
|
if (mouse_bind != NULL && loadbinds) {
|
||||||
#if USEX
|
#if X11
|
||||||
ret = 1;
|
ret = 1;
|
||||||
#endif
|
#endif
|
||||||
for (unsigned int i = 0; i < config_setting_length(mouse_bind); ++i) {
|
for (unsigned int i = 0; i < config_setting_length(mouse_bind); ++i) {
|
||||||
|
@ -150,10 +150,10 @@ int bind_init(void) {
|
||||||
|
|
||||||
for (int j = 0; j < LENGTH(ctp); j++) {
|
for (int j = 0; j < LENGTH(ctp); j++) {
|
||||||
if (!strcmp(ctp[j].tclick, strdup(dest))) {
|
if (!strcmp(ctp[j].tclick, strdup(dest))) {
|
||||||
#if USEX
|
#if X11
|
||||||
cbuttons[i].click = ctp[j].click;
|
cbuttons[i].click = ctp[j].click;
|
||||||
#endif
|
#endif
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
wl_cbuttons[i].click = ctp[j].click;
|
wl_cbuttons[i].click = ctp[j].click;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,7 @@ int bind_init(void) {
|
||||||
|
|
||||||
config_setting_lookup_string(conf, "button", &dest);
|
config_setting_lookup_string(conf, "button", &dest);
|
||||||
|
|
||||||
#if USEX
|
#if X11
|
||||||
for (int j = 0; j < LENGTH(btp); j++) {
|
for (int j = 0; j < LENGTH(btp); j++) {
|
||||||
if (!strcmp(btp[j].click, strdup(dest))) {
|
if (!strcmp(btp[j].click, strdup(dest))) {
|
||||||
cbuttons[i].button = btp[j].button;
|
cbuttons[i].button = btp[j].button;
|
||||||
|
@ -169,7 +169,7 @@ int bind_init(void) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
for (int j = 0; j < LENGTH(w_btp); j++) {
|
for (int j = 0; j < LENGTH(w_btp); j++) {
|
||||||
if (!strcmp(w_btp[j].click, strdup(dest))) {
|
if (!strcmp(w_btp[j].click, strdup(dest))) {
|
||||||
wl_cbuttons[i].button = w_btp[j].button;
|
wl_cbuttons[i].button = w_btp[j].button;
|
||||||
|
@ -181,10 +181,10 @@ int bind_init(void) {
|
||||||
|
|
||||||
for (int j = 0; j < LENGTH(fl); j++) {
|
for (int j = 0; j < LENGTH(fl); j++) {
|
||||||
if (!strcmp(fl[j].function, strdup(dest))) {
|
if (!strcmp(fl[j].function, strdup(dest))) {
|
||||||
#if USEX
|
#if X11
|
||||||
cbuttons[i].func = fl[j].func;
|
cbuttons[i].func = fl[j].func;
|
||||||
#endif
|
#endif
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
wl_cbuttons[i].func = fl[j].func;
|
wl_cbuttons[i].func = fl[j].func;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -194,10 +194,10 @@ int bind_init(void) {
|
||||||
|
|
||||||
for (int j = 0; j < LENGTH(al); j++) {
|
for (int j = 0; j < LENGTH(al); j++) {
|
||||||
if (!strcmp(al[j].argument, strdup(dest))) {
|
if (!strcmp(al[j].argument, strdup(dest))) {
|
||||||
#if USEX
|
#if X11
|
||||||
cbuttons[i].arg = al[j].arg;
|
cbuttons[i].arg = al[j].arg;
|
||||||
#endif
|
#endif
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
wl_cbuttons[i].arg = al[j].arg;
|
wl_cbuttons[i].arg = al[j].arg;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -857,7 +857,7 @@ void conf_init(void) {
|
||||||
// look up
|
// look up
|
||||||
config_setting_lookup_string(conf, "modifier", &dest);
|
config_setting_lookup_string(conf, "modifier", &dest);
|
||||||
|
|
||||||
#if USEX
|
#if X11
|
||||||
for (int j = 0; j < LENGTH(ml); j++) {
|
for (int j = 0; j < LENGTH(ml); j++) {
|
||||||
if (!strcmp(ml[j].mod, strdup(dest))) {
|
if (!strcmp(ml[j].mod, strdup(dest))) {
|
||||||
ckeys[i].mod = ml[j].modifier;
|
ckeys[i].mod = ml[j].modifier;
|
||||||
|
@ -865,7 +865,7 @@ void conf_init(void) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
for (int j = 0; j < LENGTH(wml); j++) {
|
for (int j = 0; j < LENGTH(wml); j++) {
|
||||||
if (!strcmp(wml[j].mod, strdup(dest))) {
|
if (!strcmp(wml[j].mod, strdup(dest))) {
|
||||||
wl_ckeys[i].modifier = wml[j].modifier;
|
wl_ckeys[i].modifier = wml[j].modifier;
|
||||||
|
@ -874,17 +874,17 @@ void conf_init(void) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (config_setting_lookup_int(conf, "mode", &nmode)) {
|
if (config_setting_lookup_int(conf, "mode", &nmode)) {
|
||||||
#if USEX
|
#if X11
|
||||||
ckeys[i].mode = nmode;
|
ckeys[i].mode = nmode;
|
||||||
#endif
|
#endif
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
wl_ckeys[i].mode = nmode;
|
wl_ckeys[i].mode = nmode;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
config_setting_lookup_string(conf, "key", &dest);
|
config_setting_lookup_string(conf, "key", &dest);
|
||||||
|
|
||||||
#if USEX
|
#if X11
|
||||||
for (int j = 0; j < LENGTH(kl); j++) {
|
for (int j = 0; j < LENGTH(kl); j++) {
|
||||||
if (!strcmp(kl[j].key, strdup(dest))) {
|
if (!strcmp(kl[j].key, strdup(dest))) {
|
||||||
ckeys[i].keysym = kl[j].keysym;
|
ckeys[i].keysym = kl[j].keysym;
|
||||||
|
@ -892,7 +892,7 @@ void conf_init(void) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
for (int j = 0; j < LENGTH(wkl); j++) {
|
for (int j = 0; j < LENGTH(wkl); j++) {
|
||||||
if (!strcmp(wkl[j].key, strdup(dest))) {
|
if (!strcmp(wkl[j].key, strdup(dest))) {
|
||||||
wl_ckeys[i].keysym = wkl[j].keysym;
|
wl_ckeys[i].keysym = wkl[j].keysym;
|
||||||
|
@ -904,10 +904,10 @@ void conf_init(void) {
|
||||||
|
|
||||||
for (int j = 0; j < LENGTH(fl); j++) {
|
for (int j = 0; j < LENGTH(fl); j++) {
|
||||||
if (!strcmp(fl[j].function, strdup(dest))) {
|
if (!strcmp(fl[j].function, strdup(dest))) {
|
||||||
#if USEX
|
#if X11
|
||||||
ckeys[i].func = fl[j].func;
|
ckeys[i].func = fl[j].func;
|
||||||
#endif
|
#endif
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
wl_ckeys[i].func = fl[j].func;
|
wl_ckeys[i].func = fl[j].func;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -917,10 +917,10 @@ void conf_init(void) {
|
||||||
|
|
||||||
for (int j = 0; j < LENGTH(al); j++) {
|
for (int j = 0; j < LENGTH(al); j++) {
|
||||||
if (!strcmp(al[j].argument, strdup(dest))) {
|
if (!strcmp(al[j].argument, strdup(dest))) {
|
||||||
#if USEX
|
#if X11
|
||||||
ckeys[i].arg = al[j].arg;
|
ckeys[i].arg = al[j].arg;
|
||||||
#endif
|
#endif
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
wl_ckeys[i].arg = al[j].arg;
|
wl_ckeys[i].arg = al[j].arg;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -945,10 +945,10 @@ void conf_init(void) {
|
||||||
|
|
||||||
for (int j = 0; j < LENGTH(ctp); j++) {
|
for (int j = 0; j < LENGTH(ctp); j++) {
|
||||||
if (!strcmp(ctp[j].tclick, strdup(dest))) {
|
if (!strcmp(ctp[j].tclick, strdup(dest))) {
|
||||||
#if USEX
|
#if X11
|
||||||
cbuttons[i].click = ctp[j].click;
|
cbuttons[i].click = ctp[j].click;
|
||||||
#endif
|
#endif
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
wl_cbuttons[i].click = ctp[j].click;
|
wl_cbuttons[i].click = ctp[j].click;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -956,7 +956,7 @@ void conf_init(void) {
|
||||||
|
|
||||||
config_setting_lookup_string(conf, "button", &dest);
|
config_setting_lookup_string(conf, "button", &dest);
|
||||||
|
|
||||||
#if USEX
|
#if X11
|
||||||
for (int j = 0; j < LENGTH(btp); j++) {
|
for (int j = 0; j < LENGTH(btp); j++) {
|
||||||
if (!strcmp(btp[j].click, strdup(dest))) {
|
if (!strcmp(btp[j].click, strdup(dest))) {
|
||||||
cbuttons[i].button = btp[j].button;
|
cbuttons[i].button = btp[j].button;
|
||||||
|
@ -964,7 +964,7 @@ void conf_init(void) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
for (int j = 0; j < LENGTH(w_btp); j++) {
|
for (int j = 0; j < LENGTH(w_btp); j++) {
|
||||||
if (!strcmp(w_btp[j].click, strdup(dest))) {
|
if (!strcmp(w_btp[j].click, strdup(dest))) {
|
||||||
wl_cbuttons[i].button = w_btp[j].button;
|
wl_cbuttons[i].button = w_btp[j].button;
|
||||||
|
@ -976,10 +976,10 @@ void conf_init(void) {
|
||||||
|
|
||||||
for (int j = 0; j < LENGTH(fl); j++) {
|
for (int j = 0; j < LENGTH(fl); j++) {
|
||||||
if (!strcmp(fl[j].function, strdup(dest))) {
|
if (!strcmp(fl[j].function, strdup(dest))) {
|
||||||
#if USEX
|
#if X11
|
||||||
cbuttons[i].func = fl[j].func;
|
cbuttons[i].func = fl[j].func;
|
||||||
#endif
|
#endif
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
wl_cbuttons[i].func = fl[j].func;
|
wl_cbuttons[i].func = fl[j].func;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -989,10 +989,10 @@ void conf_init(void) {
|
||||||
|
|
||||||
for (int j = 0; j < LENGTH(al); j++) {
|
for (int j = 0; j < LENGTH(al); j++) {
|
||||||
if (!strcmp(al[j].argument, strdup(dest))) {
|
if (!strcmp(al[j].argument, strdup(dest))) {
|
||||||
#if USEX
|
#if X11
|
||||||
cbuttons[i].arg = al[j].arg;
|
cbuttons[i].arg = al[j].arg;
|
||||||
#endif
|
#endif
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
wl_cbuttons[i].arg = al[j].arg;
|
wl_cbuttons[i].arg = al[j].arg;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,27 +1,27 @@
|
||||||
/* See LICENSE file for copyright and license details. */
|
/* See LICENSE file for copyright and license details. */
|
||||||
#if USECONFIG
|
#if CONFIG
|
||||||
#if USEX
|
#if X11
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *key;
|
char *key;
|
||||||
KeySym keysym;
|
KeySym keysym;
|
||||||
} KeyList;
|
} KeyList;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *key;
|
char *key;
|
||||||
xkb_keysym_t keysym;
|
xkb_keysym_t keysym;
|
||||||
} WlKeyList;
|
} WlKeyList;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USEX
|
#if X11
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *mod;
|
char *mod;
|
||||||
unsigned int modifier;
|
unsigned int modifier;
|
||||||
} ModList;
|
} ModList;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *mod;
|
char *mod;
|
||||||
char *modifier;
|
char *modifier;
|
||||||
|
@ -401,7 +401,7 @@ static FuncList fl[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// list of modifiers that can be used in the config file
|
// list of modifiers that can be used in the config file
|
||||||
#if USEX
|
#if X11
|
||||||
static ModList ml[] = {
|
static ModList ml[] = {
|
||||||
{ "Ctrl+Shift", ShiftMask|ControlMask },
|
{ "Ctrl+Shift", ShiftMask|ControlMask },
|
||||||
{ "Ctrl+Shift+Super", ShiftMask|ControlMask|Mod4Mask },
|
{ "Ctrl+Shift+Super", ShiftMask|ControlMask|Mod4Mask },
|
||||||
|
@ -422,7 +422,7 @@ static ModList ml[] = {
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
static WlModList wml[] = {
|
static WlModList wml[] = {
|
||||||
{ "Ctrl+Shift", WL_CtrlShift },
|
{ "Ctrl+Shift", WL_CtrlShift },
|
||||||
{ "Ctrl+Shift+Super", WL_CtrlShiftSuper },
|
{ "Ctrl+Shift+Super", WL_CtrlShiftSuper },
|
||||||
|
@ -443,7 +443,7 @@ static WlModList wml[] = {
|
||||||
|
|
||||||
// list of keys that can be used in the config file
|
// list of keys that can be used in the config file
|
||||||
// expand this array if you want more
|
// expand this array if you want more
|
||||||
#if USEX
|
#if X11
|
||||||
static KeyList kl[] = {
|
static KeyList kl[] = {
|
||||||
{ "None", 0 },
|
{ "None", 0 },
|
||||||
{ "Space", XK_space },
|
{ "Space", XK_space },
|
||||||
|
@ -549,7 +549,7 @@ static KeyList kl[] = {
|
||||||
|
|
||||||
// list of keys that can be used in the config file
|
// list of keys that can be used in the config file
|
||||||
// expand this array if you want more
|
// expand this array if you want more
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
static WlKeyList wkl[] = {
|
static WlKeyList wkl[] = {
|
||||||
{ "None", 0 },
|
{ "None", 0 },
|
||||||
{ "Space", XKB_KEY_space },
|
{ "Space", XKB_KEY_space },
|
||||||
|
@ -664,7 +664,7 @@ typedef struct {
|
||||||
unsigned int click;
|
unsigned int click;
|
||||||
} ClickType;
|
} ClickType;
|
||||||
|
|
||||||
#if USEX
|
#if X11
|
||||||
static ButtonType btp[] = {
|
static ButtonType btp[] = {
|
||||||
{ "Left Click", Button1 },
|
{ "Left Click", Button1 },
|
||||||
{ "Middle Click", Button2 },
|
{ "Middle Click", Button2 },
|
||||||
|
@ -674,7 +674,7 @@ static ButtonType btp[] = {
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
static ButtonType w_btp[] = {
|
static ButtonType w_btp[] = {
|
||||||
{ "Left Click", WL_Left },
|
{ "Left Click", WL_Left },
|
||||||
{ "Middle Click", WL_Middle },
|
{ "Middle Click", WL_Middle },
|
||||||
|
@ -694,7 +694,7 @@ static ClickType ctp[] = {
|
||||||
{ "ClickNumber", ClickNumber },
|
{ "ClickNumber", ClickNumber },
|
||||||
{ "ClickCaps", ClickCaps },
|
{ "ClickCaps", ClickCaps },
|
||||||
{ "ClickMode", ClickMode },
|
{ "ClickMode", ClickMode },
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
{ "ClickImage", ClickImage },
|
{ "ClickImage", ClickImage },
|
||||||
#endif
|
#endif
|
||||||
{ "None", ClickNone },
|
{ "None", ClickNone },
|
||||||
|
|
18
libs/draw.c
18
libs/draw.c
|
@ -173,7 +173,7 @@ int drawitemtext(struct item *item, int x, int y, int w) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
if (!hideimage && !imagetype) {
|
if (!hideimage && !imagetype) {
|
||||||
draw_rect(draw, x, y, w, sp.bh, 1, 1, fgcol, bgcol, fga, bga);
|
draw_rect(draw, x, y, w, sp.bh, 1, 1, fgcol, bgcol, fga, bga);
|
||||||
int nx = draw_icon(item, x, y + sp.lrpad / 4, sp.bh - sp.lrpad / 2, sp.bh - sp.lrpad / 2);
|
int nx = draw_icon(item, x, y + sp.lrpad / 4, sp.bh - sp.lrpad / 2, sp.bh - sp.lrpad / 2);
|
||||||
|
@ -340,7 +340,7 @@ int drawitem(int x, int y, int w) {
|
||||||
if (!strcmp(tx.capstext, ""))
|
if (!strcmp(tx.capstext, ""))
|
||||||
capsw = 0;
|
capsw = 0;
|
||||||
|
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
int ox = 0; // original x position
|
int ox = 0; // original x position
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -350,7 +350,7 @@ int drawitem(int x, int y, int w) {
|
||||||
int rx = 0;
|
int rx = 0;
|
||||||
|
|
||||||
// draw image first
|
// draw image first
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
if (!hideimage && img.longestedge != 0 && imagetype) {
|
if (!hideimage && img.longestedge != 0 && imagetype) {
|
||||||
rx = ox;
|
rx = ox;
|
||||||
rx += MAX((img.imagegaps * 2) + img.imagewidth + menumarginh, indentitems ? x : 0);
|
rx += MAX((img.imagegaps * 2) + img.imagewidth + menumarginh, indentitems ? x : 0);
|
||||||
|
@ -617,7 +617,7 @@ int drawcaps(int x, int y, int w) {
|
||||||
|
|
||||||
void drawmenu(void) {
|
void drawmenu(void) {
|
||||||
sp.isdrawing = 1;
|
sp.isdrawing = 1;
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
if (protocol) {
|
if (protocol) {
|
||||||
if (listfile) {
|
if (listfile) {
|
||||||
readstdin();
|
readstdin();
|
||||||
|
@ -636,14 +636,14 @@ void drawmenu(void) {
|
||||||
|
|
||||||
drawmenu_layer();
|
drawmenu_layer();
|
||||||
|
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
drawimage();
|
drawimage();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
commit_drawable(&state);
|
commit_drawable(&state);
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
#if USEX
|
#if X11
|
||||||
if (listfile) {
|
if (listfile) {
|
||||||
readstdin();
|
readstdin();
|
||||||
|
|
||||||
|
@ -660,12 +660,12 @@ void drawmenu(void) {
|
||||||
|
|
||||||
drawmenu_layer();
|
drawmenu_layer();
|
||||||
|
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
drawimage();
|
drawimage();
|
||||||
#endif
|
#endif
|
||||||
draw_map(draw, win, 0, 0, sp.mw, sp.mh);
|
draw_map(draw, win, 0, 0, sp.mw, sp.mh);
|
||||||
#endif
|
#endif
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -678,7 +678,7 @@ void drawmenu_layer(void) {
|
||||||
|
|
||||||
sp_strncpy(tx.modetext, sp.mode ? instext : normtext, sizeof(tx.modetext));
|
sp_strncpy(tx.modetext, sp.mode ? instext : normtext, sizeof(tx.modetext));
|
||||||
|
|
||||||
#if USEREGEX
|
#if REGEX
|
||||||
if (regex && regextext && sp.mode) {
|
if (regex && regextext && sp.mode) {
|
||||||
sp_strncpy(tx.modetext, regextext, sizeof(tx.modetext));
|
sp_strncpy(tx.modetext, regextext, sizeof(tx.modetext));
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,18 +10,18 @@
|
||||||
#include "draw.h"
|
#include "draw.h"
|
||||||
|
|
||||||
#ifndef X11
|
#ifndef X11
|
||||||
#define USEX 0
|
#define X11 0
|
||||||
#else
|
#else
|
||||||
#define USEX 1
|
#define X11 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef WAYLAND
|
#ifndef WAYLAND
|
||||||
#define USEWAYLAND 0
|
#define WAYLAND 0
|
||||||
#else
|
#else
|
||||||
#define USEWAYLAND 1
|
#define WAYLAND 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USEX
|
#if X11
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ void draw_cairo_set_source_hex(cairo_t* cr, const char *col, int alpha) {
|
||||||
cairo_set_source_rgba(cr, r, g, b, alpha / 255.0);
|
cairo_set_source_rgba(cr, r, g, b, alpha / 255.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if USEX
|
#if X11
|
||||||
Draw_t *draw_create_x11(Display *dpy, int screen, Window root, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap, int protocol) {
|
Draw_t *draw_create_x11(Display *dpy, int screen, Window root, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap, int protocol) {
|
||||||
Draw_t *draw = draw_calloc(1, sizeof(Draw_t));
|
Draw_t *draw = draw_calloc(1, sizeof(Draw_t));
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ Draw_t *draw_create_x11(Display *dpy, int screen, Window root, unsigned int w, u
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
Draw_t *draw_create_wl(int protocol) {
|
Draw_t *draw_create_wl(int protocol) {
|
||||||
Draw_t *draw = draw_calloc(1, sizeof(Draw_t));
|
Draw_t *draw = draw_calloc(1, sizeof(Draw_t));
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ void draw_resize(Draw_t *draw, unsigned int w, unsigned int h) {
|
||||||
draw->w = w;
|
draw->w = w;
|
||||||
draw->h = h;
|
draw->h = h;
|
||||||
|
|
||||||
#if USEX
|
#if X11
|
||||||
if (draw->drawable)
|
if (draw->drawable)
|
||||||
XFreePixmap(draw->dpy, draw->drawable);
|
XFreePixmap(draw->dpy, draw->drawable);
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ void draw_resize(Draw_t *draw, unsigned int w, unsigned int h) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw_free(Draw_t *draw) {
|
void draw_free(Draw_t *draw) {
|
||||||
#if USEX
|
#if X11
|
||||||
if (!draw->protocol) {
|
if (!draw->protocol) {
|
||||||
XFreePixmap(draw->dpy, draw->drawable);
|
XFreePixmap(draw->dpy, draw->drawable);
|
||||||
XFreeGC(draw->dpy, draw->gc);
|
XFreeGC(draw->dpy, draw->gc);
|
||||||
|
@ -352,7 +352,7 @@ void draw_map(Draw_t *draw, Window win, int x, int y, unsigned int w, unsigned i
|
||||||
if (!draw)
|
if (!draw)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if USEX
|
#if X11
|
||||||
if (!draw->protocol) {
|
if (!draw->protocol) {
|
||||||
XCopyArea(draw->dpy, draw->drawable, win, draw->gc, x, y, w, h, x, y);
|
XCopyArea(draw->dpy, draw->drawable, win, draw->gc, x, y, w, h, x, y);
|
||||||
XSync(draw->dpy, False);
|
XSync(draw->dpy, False);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* See LICENSE file for copyright and license details. */
|
/* See LICENSE file for copyright and license details. */
|
||||||
|
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
static int draw_icon(struct item *item, int x, int y, int w, int h);
|
static int draw_icon(struct item *item, int x, int y, int w, int h);
|
||||||
|
|
||||||
int draw_icon(struct item *item, int x, int y, int w, int h) {
|
int draw_icon(struct item *item, int x, int y, int w, int h) {
|
||||||
|
|
16
libs/img.c
16
libs/img.c
|
@ -1,6 +1,6 @@
|
||||||
/* See LICENSE file for copyright and license details. */
|
/* See LICENSE file for copyright and license details. */
|
||||||
|
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
|
@ -16,10 +16,10 @@ static void loadimage(const char *file, int *width, int *height);
|
||||||
static void loadimagecache(const char *file, int *width, int *height);
|
static void loadimagecache(const char *file, int *width, int *height);
|
||||||
static void resizetoimageheight(int imageheight);
|
static void resizetoimageheight(int imageheight);
|
||||||
static void store_image_vars(void);
|
static void store_image_vars(void);
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
static void resizetoimageheight_wl(int imageheight);
|
static void resizetoimageheight_wl(int imageheight);
|
||||||
#endif
|
#endif
|
||||||
#if USEX
|
#if X11
|
||||||
static void resizetoimageheight_x11(int imageheight);
|
static void resizetoimageheight_x11(int imageheight);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -334,20 +334,20 @@ void jumptoindex(unsigned int index) {
|
||||||
|
|
||||||
void resizetoimageheight(int imageheight) {
|
void resizetoimageheight(int imageheight) {
|
||||||
if (!imagetype) return;
|
if (!imagetype) return;
|
||||||
#if USEX
|
#if X11
|
||||||
if (!protocol) {
|
if (!protocol) {
|
||||||
resizetoimageheight_x11(imageheight);
|
resizetoimageheight_x11(imageheight);
|
||||||
} else {
|
} else {
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
resizetoimageheight_wl(imageheight);
|
resizetoimageheight_wl(imageheight);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#elif USEWAYLAND
|
#elif WAYLAND
|
||||||
resizetoimageheight_wl(imageheight);
|
resizetoimageheight_wl(imageheight);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if USEX
|
#if X11
|
||||||
void resizetoimageheight_x11(int imageheight) {
|
void resizetoimageheight_x11(int imageheight) {
|
||||||
int mh = sp.mh, olines = lines;
|
int mh = sp.mh, olines = lines;
|
||||||
lines = img.setlines;
|
lines = img.setlines;
|
||||||
|
@ -394,7 +394,7 @@ void resizetoimageheight_x11(int imageheight) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
void resizetoimageheight_wl(int imageheight) {
|
void resizetoimageheight_wl(int imageheight) {
|
||||||
int mh = sp.mh, olines = lines;
|
int mh = sp.mh, olines = lines;
|
||||||
lines = img.setlines;
|
lines = img.setlines;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* See LICENSE file for copyright and license details. */
|
/* See LICENSE file for copyright and license details. */
|
||||||
|
|
||||||
#if USEREGEX
|
#if REGEX
|
||||||
#include "regex/regex.h"
|
#include "regex/regex.h"
|
||||||
#include "regex/regex.c"
|
#include "regex/regex.c"
|
||||||
#endif
|
#endif
|
||||||
|
@ -11,7 +11,7 @@ static int matchregex(const char *t, const char *itt);
|
||||||
static int compare_distance(const void *a, const void *b);
|
static int compare_distance(const void *a, const void *b);
|
||||||
|
|
||||||
int matchregex(const char *t, const char *itt) {
|
int matchregex(const char *t, const char *itt) {
|
||||||
#if USEREGEX
|
#if REGEX
|
||||||
re_t reg = re_compile(t);
|
re_t reg = re_compile(t);
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ static int mon = -1; /* Monitor to run spmenu on */
|
||||||
static int scrolldistance = 512; /* Distance to scroll for a scroll action to count */
|
static int scrolldistance = 512; /* Distance to scroll for a scroll action to count */
|
||||||
|
|
||||||
/* Config file options */
|
/* Config file options */
|
||||||
#if USECONFIG
|
#if CONFIG
|
||||||
static char *configfile = NULL; /* Config file path. Default is ~/.config/spmenu/spmenu.conf */
|
static char *configfile = NULL; /* Config file path. Default is ~/.config/spmenu/spmenu.conf */
|
||||||
static char *themefile = NULL; /* Theme file path. Default is ~/.config/spmenu/theme.conf */
|
static char *themefile = NULL; /* Theme file path. Default is ~/.config/spmenu/theme.conf */
|
||||||
static char *bindsfile = NULL; /* Keybind file path. Default is ~/.config/spmenu/binds.conf */
|
static char *bindsfile = NULL; /* Keybind file path. Default is ~/.config/spmenu/binds.conf */
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
/* See LICENSE file for copyright and license details. */
|
/* See LICENSE file for copyright and license details. */
|
||||||
|
|
||||||
#if USERTL
|
#if RTL
|
||||||
#include <fribidi.h>
|
#include <fribidi.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static char fribidi_text[BUFSIZ] = "";
|
static char fribidi_text[BUFSIZ] = "";
|
||||||
static void apply_fribidi(char *str);
|
static void apply_fribidi(char *str);
|
||||||
|
|
||||||
#if USERTL
|
#if RTL
|
||||||
void apply_fribidi(char *str) {
|
void apply_fribidi(char *str) {
|
||||||
FriBidiStrIndex len = strlen(str);
|
FriBidiStrIndex len = strlen(str);
|
||||||
FriBidiChar logical[BUFSIZ];
|
FriBidiChar logical[BUFSIZ];
|
||||||
|
|
|
@ -40,21 +40,21 @@ void readstdin(void) {
|
||||||
o = 1;
|
o = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !USEIMAGE
|
#if !IMAGE
|
||||||
if (o) {
|
if (o) {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
if (!o) img.longestedge = img.imagegaps = 0;
|
if (!o) img.longestedge = img.imagegaps = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// clean
|
// clean
|
||||||
if (items) {
|
if (items) {
|
||||||
items[i].text = NULL;
|
items[i].text = NULL;
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
items[i].image = NULL;
|
items[i].image = NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ void readfile(void) {
|
||||||
o = 1;
|
o = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !USEIMAGE
|
#if !IMAGE
|
||||||
if (o) {
|
if (o) {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ void readfile(void) {
|
||||||
|
|
||||||
lines = columns == 1 ? i : MIN(i, lines); // i = number of items
|
lines = columns == 1 ? i : MIN(i, lines); // i = number of items
|
||||||
|
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
if (!o) img.longestedge = img.imagegaps = 0;
|
if (!o) img.longestedge = img.imagegaps = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -152,13 +152,13 @@ void readfile(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int parsemarkup(int index) {
|
int parsemarkup(int index) {
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
int w, h;
|
int w, h;
|
||||||
char *limg = NULL;
|
char *limg = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// parse image markup
|
// parse image markup
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
if (!strncmp("IMG:", items[index].text, strlen("IMG:")) || !strncmp("img://", items[index].text, strlen("img://"))) {
|
if (!strncmp("IMG:", items[index].text, strlen("IMG:")) || !strncmp("img://", items[index].text, strlen("img://"))) {
|
||||||
if(!(items[index].image = malloc(strlen(items[index].text)+1)))
|
if(!(items[index].image = malloc(strlen(items[index].text)+1)))
|
||||||
fprintf(stderr, "spmenu: cannot malloc %lu bytes\n", strlen(items[index].text));
|
fprintf(stderr, "spmenu: cannot malloc %lu bytes\n", strlen(items[index].text));
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* See LICENSE file for copyright and license details. */
|
/* See LICENSE file for copyright and license details. */
|
||||||
|
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
#include "wayland.c"
|
#include "wayland.c"
|
||||||
#include "init.c"
|
#include "init.c"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* See LICENSE file for copyright and license details. */
|
/* See LICENSE file for copyright and license details. */
|
||||||
|
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
#include "wayland.h"
|
#include "wayland.h"
|
||||||
#include "init.h"
|
#include "init.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -6,7 +6,7 @@ void prepare_window_size_wl(void) {
|
||||||
|
|
||||||
sp.bh = MAX(draw->font->h, draw->font->h + 2 + lineheight);
|
sp.bh = MAX(draw->font->h, draw->font->h + 2 + lineheight);
|
||||||
lines = MAX(lines, 0);
|
lines = MAX(lines, 0);
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
img.setlines = lines;
|
img.setlines = lines;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -321,7 +321,7 @@ void buttonpress_wl(uint32_t button, double ex, double ey) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
if (!hideimage && img.longestedge != 0 && imagetype) {
|
if (!hideimage && img.longestedge != 0 && imagetype) {
|
||||||
x += MAX((img.imagegaps * 2) + img.imagewidth, indentitems ? sp.promptw : 0);
|
x += MAX((img.imagegaps * 2) + img.imagewidth, indentitems ? sp.promptw : 0);
|
||||||
}
|
}
|
||||||
|
@ -349,7 +349,7 @@ void buttonpress_wl(uint32_t button, double ex, double ey) {
|
||||||
if (ey >= y && ey <= (y + h) && ex >= x + (powerlineitems ? sp.plw : 0) && ex <= (x + w / columns) + (powerlineitems ? sp.plw : 0)) {
|
if (ey >= y && ey <= (y + h) && ex >= x + (powerlineitems ? sp.plw : 0) && ex <= (x + w / columns) + (powerlineitems ? sp.plw : 0)) {
|
||||||
click = ClickItem;
|
click = ClickItem;
|
||||||
mouseitem = item;
|
mouseitem = item;
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
} else if (ey >= y && ey <= (y + h) && ex >= x + (powerlineitems ? sp.plw : 0) - MAX((img.imagegaps * 2) + img.imagewidth, indentitems ? sp.promptw : 0) && ex <= (x - MAX((img.imagegaps * 2) + img.imagewidth, indentitems ? sp.promptw : 0) + w / columns) + (powerlineitems ? sp.plw : 0)) {
|
} else if (ey >= y && ey <= (y + h) && ex >= x + (powerlineitems ? sp.plw : 0) - MAX((img.imagegaps * 2) + img.imagewidth, indentitems ? sp.promptw : 0) && ex <= (x - MAX((img.imagegaps * 2) + img.imagewidth, indentitems ? sp.promptw : 0) + w / columns) + (powerlineitems ? sp.plw : 0)) {
|
||||||
click = ClickImage;
|
click = ClickImage;
|
||||||
mouseitem = item;
|
mouseitem = item;
|
||||||
|
@ -634,7 +634,7 @@ void resizeclient_wl(struct state *state) {
|
||||||
ic++;
|
ic++;
|
||||||
|
|
||||||
lines = MIN(ic, MAX(lines, 0));
|
lines = MIN(ic, MAX(lines, 0));
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
img.setlines = lines;
|
img.setlines = lines;
|
||||||
#endif
|
#endif
|
||||||
get_mh();
|
get_mh();
|
||||||
|
|
|
@ -80,7 +80,7 @@ void resizeclient_x11(void) {
|
||||||
ic++;
|
ic++;
|
||||||
|
|
||||||
lines = MIN(ic, MAX(lines, 0));
|
lines = MIN(ic, MAX(lines, 0));
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
img.setlines = lines;
|
img.setlines = lines;
|
||||||
|
|
||||||
// resize client to image height
|
// resize client to image height
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* See LICENSE file for copyright and license details. */
|
/* See LICENSE file for copyright and license details. */
|
||||||
|
|
||||||
#if USEX
|
#if X11
|
||||||
#include "xim.c"
|
#include "xim.c"
|
||||||
#include "key.c"
|
#include "key.c"
|
||||||
#include "mouse.c"
|
#include "mouse.c"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* See LICENSE file for copyright and license details. */
|
/* See LICENSE file for copyright and license details. */
|
||||||
#if USEX
|
#if X11
|
||||||
#include "lib.h"
|
#include "lib.h"
|
||||||
|
|
||||||
#include "init.h"
|
#include "init.h"
|
||||||
|
|
|
@ -9,7 +9,7 @@ void setupdisplay_x11(void) {
|
||||||
prepare_window_size_x11();
|
prepare_window_size_x11();
|
||||||
|
|
||||||
// resize client to image height if deemed necessary
|
// resize client to image height if deemed necessary
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
if (image) resizetoimageheight(img.imageheight);
|
if (image) resizetoimageheight(img.imageheight);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ void setupdisplay_x11(void) {
|
||||||
? pango_prompt ? TEXTWM(prompt) : TEXTW(prompt) - sp.lrpad / 4 : 0; // prompt width
|
? pango_prompt ? TEXTWM(prompt) : TEXTW(prompt) - sp.lrpad / 4 : 0; // prompt width
|
||||||
|
|
||||||
// init xinerama screens
|
// init xinerama screens
|
||||||
#if USEXINERAMA
|
#if XINERAMA
|
||||||
XineramaScreenInfo *info;
|
XineramaScreenInfo *info;
|
||||||
Window pw;
|
Window pw;
|
||||||
int a, n, area = 0;
|
int a, n, area = 0;
|
||||||
|
@ -87,7 +87,7 @@ void setupdisplay_x11(void) {
|
||||||
set_window_x11();
|
set_window_x11();
|
||||||
set_prop_x11();
|
set_prop_x11();
|
||||||
|
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
setimageopts();
|
setimageopts();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ void prepare_window_size_x11(void) {
|
||||||
|
|
||||||
sp.bh = MAX(draw->font->h, draw->font->h + 2 + lineheight);
|
sp.bh = MAX(draw->font->h, draw->font->h + 2 + lineheight);
|
||||||
lines = MAX(lines, 0);
|
lines = MAX(lines, 0);
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
img.setlines = lines;
|
img.setlines = lines;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -10,11 +10,11 @@
|
||||||
#include <X11/extensions/Xrender.h>
|
#include <X11/extensions/Xrender.h>
|
||||||
|
|
||||||
// include xinerama
|
// include xinerama
|
||||||
#if USEXINERAMA
|
#if XINERAMA
|
||||||
#include <X11/extensions/Xinerama.h>
|
#include <X11/extensions/Xinerama.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// include xresources
|
// include xresources
|
||||||
#if USEXRESOURCES
|
#if XRESOURCES
|
||||||
#include <X11/Xresource.h>
|
#include <X11/Xresource.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -59,7 +59,7 @@ void buttonpress_x11(XEvent *e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
if (!hideimage && img.longestedge != 0 && imagetype) {
|
if (!hideimage && img.longestedge != 0 && imagetype) {
|
||||||
x += MAX((img.imagegaps * 2) + img.imagewidth, indentitems ? sp.promptw : 0);
|
x += MAX((img.imagegaps * 2) + img.imagewidth, indentitems ? sp.promptw : 0);
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ void buttonpress_x11(XEvent *e) {
|
||||||
if (ev->y >= y && ev->y <= (y + h) && ev->x >= x + (powerlineitems ? sp.plw : 0) && ev->x <= (x + w / columns) + (powerlineitems ? sp.plw : 0)) {
|
if (ev->y >= y && ev->y <= (y + h) && ev->x >= x + (powerlineitems ? sp.plw : 0) && ev->x <= (x + w / columns) + (powerlineitems ? sp.plw : 0)) {
|
||||||
click = ClickItem;
|
click = ClickItem;
|
||||||
mouseitem = item;
|
mouseitem = item;
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
} else if (ev->y >= y && ev->y <= (y + h) && ev->x >= x + (powerlineitems ? sp.plw : 0) - MAX((img.imagegaps * 2) + img.imagewidth, indentitems ? sp.promptw : 0) && ev->x <= (x - MAX((img.imagegaps * 2) + img.imagewidth, indentitems ? sp.promptw : 0) + w / columns) + (powerlineitems ? sp.plw : 0)) {
|
} else if (ev->y >= y && ev->y <= (y + h) && ev->x >= x + (powerlineitems ? sp.plw : 0) - MAX((img.imagegaps * 2) + img.imagewidth, indentitems ? sp.promptw : 0) && ev->x <= (x - MAX((img.imagegaps * 2) + img.imagewidth, indentitems ? sp.promptw : 0) + w / columns) + (powerlineitems ? sp.plw : 0)) {
|
||||||
click = ClickImage;
|
click = ClickImage;
|
||||||
mouseitem = item;
|
mouseitem = item;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* See LICENSE file for copyright and license details. */
|
/* See LICENSE file for copyright and license details. */
|
||||||
|
|
||||||
#if USEXRESOURCES
|
#if XRESOURCES
|
||||||
void resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst) {
|
void resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst) {
|
||||||
char *sdst = NULL;
|
char *sdst = NULL;
|
||||||
int *idst = NULL;
|
int *idst = NULL;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* See LICENSE file for copyright and license details. */
|
/* See LICENSE file for copyright and license details. */
|
||||||
|
|
||||||
#if USEXRESOURCES
|
#if XRESOURCES
|
||||||
enum resource_type {
|
enum resource_type {
|
||||||
STRING = 0,
|
STRING = 0,
|
||||||
INTEGER = 1,
|
INTEGER = 1,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* See LICENSE file for copyright and license details. */
|
/* See LICENSE file for copyright and license details. */
|
||||||
|
|
||||||
// This .Xresources array is read and compared to the xrdb. Simply add to the array if you need to.
|
// This .Xresources array is read and compared to the xrdb. Simply add to the array if you need to.
|
||||||
#if USEXRESOURCES
|
#if XRESOURCES
|
||||||
ResourcePref cols[] = {
|
ResourcePref cols[] = {
|
||||||
{ "font", STRING, &font },
|
{ "font", STRING, &font },
|
||||||
{ "color10", STRING, &col_caretfg },
|
{ "color10", STRING, &col_caretfg },
|
||||||
|
|
84
spmenu.c
84
spmenu.c
|
@ -15,54 +15,6 @@
|
||||||
#define VERSION "unknown"
|
#define VERSION "unknown"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef RTL
|
|
||||||
#define USERTL 0
|
|
||||||
#else
|
|
||||||
#define USERTL 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef IMAGE
|
|
||||||
#define USEIMAGE 0
|
|
||||||
#else
|
|
||||||
#define USEIMAGE 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef XINERAMA
|
|
||||||
#define USEXINERAMA 0
|
|
||||||
#else
|
|
||||||
#define USEXINERAMA 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef CONFIG
|
|
||||||
#define USECONFIG 0
|
|
||||||
#else
|
|
||||||
#define USECONFIG 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef XRESOURCES
|
|
||||||
#define USEXRESOURCES 0
|
|
||||||
#else
|
|
||||||
#define USEXRESOURCES 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef WAYLAND
|
|
||||||
#define USEWAYLAND 0
|
|
||||||
#else
|
|
||||||
#define USEWAYLAND 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef X11
|
|
||||||
#define USEX 0
|
|
||||||
#else
|
|
||||||
#define USEX 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef REGEX
|
|
||||||
#define USEREGEX 0
|
|
||||||
#else
|
|
||||||
#define USEREGEX 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
ClickWindow,
|
ClickWindow,
|
||||||
ClickPrompt,
|
ClickPrompt,
|
||||||
|
@ -124,7 +76,7 @@ struct mo {
|
||||||
int output_height; // output height
|
int output_height; // output height
|
||||||
};
|
};
|
||||||
|
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
struct img {
|
struct img {
|
||||||
int setlines; // actual lines
|
int setlines; // actual lines
|
||||||
int flip; // %=
|
int flip; // %=
|
||||||
|
@ -142,7 +94,7 @@ struct tx {
|
||||||
char capstext[64]; // caps lock text
|
char capstext[64]; // caps lock text
|
||||||
};
|
};
|
||||||
|
|
||||||
#if USEX
|
#if X11
|
||||||
struct x11 {
|
struct x11 {
|
||||||
int numlockmask;
|
int numlockmask;
|
||||||
int useargb;
|
int useargb;
|
||||||
|
@ -157,10 +109,10 @@ struct x11 {
|
||||||
static struct sp sp = {0};
|
static struct sp sp = {0};
|
||||||
static struct tx tx = {0};
|
static struct tx tx = {0};
|
||||||
static struct mo mo = {0};
|
static struct mo mo = {0};
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
static struct img img = {0};
|
static struct img img = {0};
|
||||||
#endif
|
#endif
|
||||||
#if USEX
|
#if X11
|
||||||
static struct x11 x11 = {0};
|
static struct x11 x11 = {0};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -190,7 +142,7 @@ static int *sel_index = NULL;
|
||||||
static unsigned int sel_size = 0;
|
static unsigned int sel_size = 0;
|
||||||
static int itemn = 0;
|
static int itemn = 0;
|
||||||
|
|
||||||
#if USERTL
|
#if RTL
|
||||||
static int isrtl = 1;
|
static int isrtl = 1;
|
||||||
#else
|
#else
|
||||||
static int isrtl = 0;
|
static int isrtl = 0;
|
||||||
|
@ -246,7 +198,7 @@ static char *fonts[] = { font };
|
||||||
#include "libs/arg.c"
|
#include "libs/arg.c"
|
||||||
#include "libs/stream.c"
|
#include "libs/stream.c"
|
||||||
|
|
||||||
#if USEX
|
#if X11
|
||||||
static Key keys[] = {
|
static Key keys[] = {
|
||||||
{ -1, 0, XK_Return, selectitem, {.i = +1 } },
|
{ -1, 0, XK_Return, selectitem, {.i = +1 } },
|
||||||
{ -1, Shift, XK_Return, selectitem, {0} },
|
{ -1, Shift, XK_Return, selectitem, {0} },
|
||||||
|
@ -271,7 +223,7 @@ static Key keys[] = {
|
||||||
{ -1, Ctrl, XK_n, navhistory, {.i = +1 } },
|
{ -1, Ctrl, XK_n, navhistory, {.i = +1 } },
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
static WlKey wl_keys[] = {
|
static WlKey wl_keys[] = {
|
||||||
{ -1, WL_None, XKB_KEY_Return, selectitem, {.i = +1 } },
|
{ -1, WL_None, XKB_KEY_Return, selectitem, {.i = +1 } },
|
||||||
{ -1, WL_Shift, XKB_KEY_Return, selectitem, {0} },
|
{ -1, WL_Shift, XKB_KEY_Return, selectitem, {0} },
|
||||||
|
@ -297,7 +249,7 @@ static WlKey wl_keys[] = {
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
#if USEX
|
#if X11
|
||||||
static Mouse buttons[] = {
|
static Mouse buttons[] = {
|
||||||
{ ClickInput, Button1, clear, {0} },
|
{ ClickInput, Button1, clear, {0} },
|
||||||
{ ClickPrompt, Button1, clear, {0} },
|
{ ClickPrompt, Button1, clear, {0} },
|
||||||
|
@ -309,7 +261,7 @@ static Mouse buttons[] = {
|
||||||
{ ClickNone, Button4, moveprev, {0} },
|
{ ClickNone, Button4, moveprev, {0} },
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
static WlMouse wl_buttons[] = {
|
static WlMouse wl_buttons[] = {
|
||||||
{ ClickInput, WL_Left, clear, {0} },
|
{ ClickInput, WL_Left, clear, {0} },
|
||||||
{ ClickPrompt, WL_Left, clear, {0} },
|
{ ClickPrompt, WL_Left, clear, {0} },
|
||||||
|
@ -433,7 +385,7 @@ int max_textw(void) {
|
||||||
void cleanup(void) {
|
void cleanup(void) {
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
cleanupimage(); // function frees images
|
cleanupimage(); // function frees images
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -444,7 +396,7 @@ void cleanup(void) {
|
||||||
// free drawing and close the display
|
// free drawing and close the display
|
||||||
draw_free(draw);
|
draw_free(draw);
|
||||||
|
|
||||||
#if USEX
|
#if X11
|
||||||
if (!protocol) {
|
if (!protocol) {
|
||||||
cleanup_x11(dpy);
|
cleanup_x11(dpy);
|
||||||
}
|
}
|
||||||
|
@ -521,15 +473,15 @@ size_t nextrune(int inc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void resizeclient(void) {
|
void resizeclient(void) {
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
if (protocol) {
|
if (protocol) {
|
||||||
resizeclient_wl(&state);
|
resizeclient_wl(&state);
|
||||||
} else {
|
} else {
|
||||||
#if USEX
|
#if X11
|
||||||
resizeclient_x11();
|
resizeclient_x11();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#elif USEX
|
#elif X11
|
||||||
resizeclient_x11();
|
resizeclient_x11();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -592,7 +544,7 @@ void set_mode(void) {
|
||||||
|
|
||||||
void handle(void) {
|
void handle(void) {
|
||||||
if (!protocol) {
|
if (!protocol) {
|
||||||
#if USEX
|
#if X11
|
||||||
handle_x11();
|
handle_x11();
|
||||||
|
|
||||||
if (!draw_font_create(draw, fonts, LENGTH(fonts))) {
|
if (!draw_font_create(draw, fonts, LENGTH(fonts))) {
|
||||||
|
@ -600,7 +552,7 @@ void handle(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
loadhistory(); // read history entries
|
loadhistory(); // read history entries
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
store_image_vars();
|
store_image_vars();
|
||||||
#endif
|
#endif
|
||||||
// fast (-f) means we grab keyboard before reading standard input
|
// fast (-f) means we grab keyboard before reading standard input
|
||||||
|
@ -619,10 +571,10 @@ void handle(void) {
|
||||||
setupdisplay_x11(); // set up display and create window
|
setupdisplay_x11(); // set up display and create window
|
||||||
eventloop_x11(); // function is a loop which checks X11 events and calls other functions accordingly
|
eventloop_x11(); // function is a loop which checks X11 events and calls other functions accordingly
|
||||||
#endif
|
#endif
|
||||||
#if USEWAYLAND
|
#if WAYLAND
|
||||||
} else {
|
} else {
|
||||||
loadhistory();
|
loadhistory();
|
||||||
#if USEIMAGE
|
#if IMAGE
|
||||||
store_image_vars();
|
store_image_vars();
|
||||||
setimageopts();
|
setimageopts();
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue