forked from 1b-agent/opencadstudio-upstream
fix(print): complete Windows printer discovery, honor the true default, surface failures; make CTB loading usable (#1261)
Printer enumeration used EnumPrinters level 4 only, which is served from the local registry cache and misses Win11 per-user network printers; an empty result now retries with level 2 (spooler RPC) and merges the resolved default. The dialog's 'System default printer' used to delegate to the shell print verb — the default PDF handler's own printer choice, not the system default; it now resolves GetDefaultPrinterW and dispatches printto naming that printer explicitly. Every dispatch probes OpenPrinterW first, so a printer that vanished between listing and printing produces a clear error instead of ShellExecute's silent nothing, and all SE_ERR_* codes carry readable reasons. Legacy CTB: picking an unparseable table used to swallow the failure (.ok()) — the user saw nothing at all. Load errors now reach the command line, the picker accepts .stb alongside .ctb (the container gains the STBVER1 header; .stb application errors state the actual reason), and a table loaded from anywhere is copied into the user's plot-styles folder so it persists in the dialog, matching AutoCAD. Buffer parsing for both EnumPrinters layouts is unit-tested; the missing-printer path was exercised against the real spooler (existence probe only, no job).
This commit is contained in:
1 parent
02d9273a19
commit
5ea4294d3d
6 files changed
+390
-44
No files matched your search
+3
-1
@@ -62,7 +62,9 @@ fluent-syntax = "0.12"
|
||||
naga = { version = "27", features = ["wgsl-in"] }
|
||||
|
||||
[target.'cfg(target_os = "windows")'.dependencies]
|
||||
windows-sys = { version = "0.61", features = ["Win32_UI_Shell", "Win32_UI_WindowsAndMessaging", "Win32_System_Com", "Win32_System_Registry", "Win32_Storage_FileSystem", "Win32_Foundation", "Win32_Graphics_Printing"] }
|
||||
# Win32_Graphics_Gdi + Win32_Security are required for PRINTER_INFO_2W (the
|
||||
# level-2 printer enumeration fallback in src/io/print_to_printer.rs).
|
||||
windows-sys = { version = "0.61", features = ["Win32_UI_Shell", "Win32_UI_WindowsAndMessaging", "Win32_System_Com", "Win32_System_Registry", "Win32_Storage_FileSystem", "Win32_Foundation", "Win32_Graphics_Printing", "Win32_Graphics_Gdi", "Win32_Security"] }
|
||||
|
||||
[target.'cfg(target_os = "linux")'.dependencies]
|
||||
ashpd = { version = "0.13.13", default-features = false, features = ["async-io", "wayland"] }
|
||||
|
||||
Reference in new issue
Block a user