feat: add dpi detection and configuration for mouse distance

Implement automatic DPI detection from EDID display data and a manual `mouse_distance_dpi` config option to convert mouse movement pixels into real-world centimeters. The new `calculate_pixels_per_cm()` function in main.c falls back to manual DPI override, then EDID-based auto-detection with sanity checks, and finally a default 96 DPI (37.8 px/cm). The `Config` struct gains a `mouse_distance_dpi` field parsed from config files, and `DWNState` stores the computed `pixels_per_cm` and a `dpi_auto_detected` flag. The panel renderer now uses `dwn->pixels_per_cm` instead of the hardcoded 37.8 constant for mouse distance display.
This commit is contained in:
2026-01-28 15:55:00 +00:00
parent 2303b53c70
commit 5404adfcd5
17 changed files with 47 additions and 1 deletions
+1
View File
@@ -39,6 +39,7 @@ struct Config {
int panel_height;
int gap;
char font_name[128];
double mouse_distance_dpi;
ColorScheme colors;
float default_master_ratio;
+3
View File
@@ -215,6 +215,9 @@ typedef struct {
int last_mouse_x;
int last_mouse_y;
bool mouse_tracking_initialized;
double pixels_per_cm;
bool dpi_auto_detected;
} DWNState;
#define PHASE_OFFSET_PANEL_BG 0.0f