Hide UI preference keys behind adapter

This commit is contained in:
2026-06-12 17:53:57 +02:00
parent 9f1a52401a
commit 058997bd78
6 changed files with 105 additions and 21 deletions

View File

@@ -617,8 +617,7 @@ void win32_save_window_state()
{
WINDOWPLACEMENT p;
GetWindowPlacement(hWnd, &p);
pp::panopainter::set_legacy_integer_preference("window-show-cmd", p.showCmd);
pp::panopainter::set_legacy_ivec4_preference("window-rect", {
pp::panopainter::set_legacy_window_preferences(p.showCmd, {
p.rcNormalPosition.left,
p.rcNormalPosition.top,
p.rcNormalPosition.right,
@@ -801,22 +800,22 @@ int main(int argc, char** argv)
GetDpiForMonitor_fn(monitor, MDT_EFFECTIVE_DPI, &x, &y);
App::I->display_density = (float)x / 96.f;
if (pp::panopainter::has_legacy_preference("ui-scale"))
App::I->zoom = pp::panopainter::legacy_float_preference("ui-scale");
const auto window_preferences = pp::panopainter::read_legacy_window_preferences(SW_NORMAL);
if (window_preferences.has_ui_scale)
App::I->zoom = window_preferences.ui_scale;
else
App::I->zoom = (float)x / 96.f;
int show_cmd = SW_NORMAL;
show_cmd = pp::panopainter::legacy_integer_preference_or("window-show-cmd", show_cmd);
int show_cmd = window_preferences.show_command;
DWORD wnd_style = WS_OVERLAPPEDWINDOW;
//if (show_cmd == SW_MAXIMIZE)
// wnd_style != WS_MAXIMIZE;
RECT clientRect = { 0, 0, (int)App::I->width * App::I->zoom, (int)App::I->height * App::I->zoom };
POINT clientPos = { CW_USEDEFAULT, CW_USEDEFAULT };
if (pp::panopainter::has_legacy_preference("window-rect"))
if (window_preferences.has_window_rect)
{
auto wnd_rect = pp::panopainter::legacy_ivec4_preference("window-rect");
auto wnd_rect = window_preferences.window_rect;
App::I->width = wnd_rect.z - wnd_rect.x;
App::I->height = wnd_rect.w - wnd_rect.y;
clientRect = { wnd_rect.x, wnd_rect.y, wnd_rect.z, wnd_rect.w };