diff options
| author | kj_sh604 | 2026-06-05 16:07:29 -0400 |
|---|---|---|
| committer | kj_sh604 | 2026-06-05 16:07:29 -0400 |
| commit | 84bf1b569a76519e5758be4961cafdf2e86cd8ec (patch) | |
| tree | 2f86903df73e943bd488ca402d9f208a23c07057 | |
| parent | d2cda6936870545463bf5b20a202c771d8e70770 (diff) | |
refactor: src/config.h
| -rw-r--r-- | src/config.h | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/src/config.h b/src/config.h new file mode 100644 index 0000000..7dea51e --- /dev/null +++ b/src/config.h @@ -0,0 +1,89 @@ +#ifndef CONFIG_H +#define CONFIG_H + +#include <X11/keysym.h> + +typedef struct { + // camera settings + float min_scale; // minimum allowed zoom scale + float scroll_speed; // speed of zoom when scrolling or using +/- keys + float drag_friction; // friction coefficient for camera movement inertia + float scale_friction; // friction coefficient for zoom inertia + float velocity_threshold; // minimum velocity to apply inertia + float scale_change_threshold; // minimum magnitude to update camera zoom (skip minor changes) + + // flashlight settings + float initial_radius; // starting flashlight radius + float initial_delta_radius; // initial delta for flashlight radius change per Ctrl+scroll + float radius_damping; // radius attenuation coefficient + float fade_speed; // speed of flashlight fade in/out + float max_shadow_opacity; // maximum shadow opacity + float radius_change_threshold; // minimum magnitude to update flashlight radius (skip minor changes) + float feather; // soft edge size as percentage of radius (0.0 to 0.5, e.g., 0.15 = 15%) + + // opengl settings + int texture_filter; // 0 = pixelated, 1 = smooth + + // key bindings + KeySym key_escape; // key to quit the program + KeySym key_flashlight; // key to toggle flashlight + KeySym key_reset; // key to reset state + KeySym key_mirror; // key to toggle mirror + KeySym key_zoom_in; // key to zoom in + KeySym key_zoom_out; // key to zoom out + unsigned int modifier_flashlight; // modifier for flashlight radius change (e.g., ControlMask) + + // mouse bindings + unsigned int button_drag; // mouse button for dragging + unsigned int button_zoom_in; // mouse button for zoom in (scroll up) + unsigned int button_zoom_out; // mouse button for zoom out (scroll down) +} Config; + +#ifdef CONFIG_IMPL + +// you can hack these values +Config default_config = { + // camera settings + .min_scale = 0.5f, + .scroll_speed = 1.5f, + .drag_friction = 6.0f, + .scale_friction = 4.0f, + .velocity_threshold = 15.0f, + .scale_change_threshold = 0.5f, + + // flashlight settings + .initial_radius = 200.0f, + .initial_delta_radius = 250.0f, + .radius_damping = 10.0f, + .fade_speed = 6.0f, + .max_shadow_opacity = 0.8f, + .radius_change_threshold = 1.0f, + .feather = 0.0f, + + // opengl settings + .texture_filter = 0, + + // key bindings + .key_escape = XK_Escape, + .key_flashlight = XK_f, + .key_reset = XK_0, + .key_mirror = XK_m, + .key_zoom_in = XK_equal, + .key_zoom_out = XK_minus, + + // Ctrl = ControlMask, + // Left Alt = Mod1Mask, + // Shift = ShiftMask, + // Ctrl or Shift = ControlMask | ShiftMask, + // etc. + .modifier_flashlight = ControlMask, + + // mouse bindings + .button_drag = Button1, + .button_zoom_in = Button4, + .button_zoom_out = Button5, +}; + +#endif // CONFIG_IMPL + +#endif // CONFIG_H |
