diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 38c35f6..8501fdf 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -182,6 +182,11 @@ fn set_badge_count(count: u32, window: tauri::Window) -> Result<(), String> { let hbm_color = CreateDIBSection(Some(hdc), &bmi, DIB_RGB_COLORS, &mut bits, None, 0) .map_err(|e| e.to_string())?; + // Zero-init so undrawn pixels are fully transparent (CreateDIBSection + // does not guarantee zeroed memory; garbage bytes cause a black square). + if !bits.is_null() { + std::ptr::write_bytes(bits as *mut u8, 0, (size * size * 4) as usize); + } let old_bm = SelectObject(hdc, hbm_color.into()); let hbrush = CreateSolidBrush(COLORREF(0x003030DD));