nix-conf/overlays/nsxiv.diff
2025-01-19 10:24:18 -06:00

69 lines
2 KiB
Diff

--- a/config.def.h
+++ b/config.def.h
@@ -28,4 +28,4 @@
static const float zoom_levels[] = {
12.5, 25.0, 50.0, 75.0,
- 100.0, 150.0, 200.0, 400.0, 800.0
+ 100.0, 150.0, 200.0, 300.0, 400.0, 600.0, 800.0
};
@@ -191,9 +191,9 @@
static const button_t buttons_img[] = {
/* modifiers button function argument */
{ 0, 1, i_cursor_navigate, None },
- { ControlMask, 1, i_drag, DRAG_RELATIVE },
{ 0, 2, i_drag, DRAG_ABSOLUTE },
- { 0, 3, g_switch_mode, None },
+ { 0, 3, i_drag, DRAG_RELATIVE },
+ { ControlMask, 3, g_switch_mode, None },
{ 0, 4, g_zoom, +1 },
{ 0, 5, g_zoom, -1 },
};
--- a/window.c
+++ b/window.c
@@ -31,6 +31,7 @@
#include <X11/Xatom.h>
#include <X11/Xresource.h>
#include <X11/cursorfont.h>
+#include <X11/Xcursor/Xcursor.h>
#if HAVE_LIBFONTS
#include "utf8.h"
@@ -53,15 +54,18 @@
static GC gc;
static int barheight;
static struct {
- int name;
+ union {
+ char *name;
+ int num;
+ };
Cursor icon;
} cursors[CURSOR_COUNT] = {
- { XC_left_ptr },
+ { { .name = "left_ptr" } },
- { XC_dotbox },
+ { { .num = XC_dotbox } },
- { XC_fleur },
+ { { .name = "dnd-move" } },
- { XC_watch },
+ { { .name = "wait" } },
- { XC_sb_left_arrow },
+ { { .name = "left-arrow" } },
- { XC_sb_right_arrow }
+ { { .name = "right-arrow" } }
};
#if HAVE_LIBFONTS
@@ -272,7 +276,10 @@
for (i = 0; i < (int)ARRLEN(cursors); i++) {
if (i != CURSOR_NONE)
- cursors[i].icon = XCreateFontCursor(e->dpy, cursors[i].name);
+ if (cursors[i].num < 0x100)
+ cursors[i].icon = XCreateFontCursor(e->dpy, cursors[i].num);
+ else
+ cursors[i].icon = XcursorLibraryLoadCursor(e->dpy, cursors[i].name);
}
if (XAllocNamedColor(e->dpy, e->cmap, "black", &col, &col) == 0)
error(EXIT_FAILURE, 0, "Error allocating color 'black'");