@@ -47,8 +47,14 @@ impl WindowRegistryInfo {
47
47
48
48
let x = get_str ( & key, WINDOW_POS_X_KEY , defaults. x ) ;
49
49
let y = get_str ( & key, WINDOW_POS_Y_KEY , defaults. y ) ;
50
- let width = get_str ( & key, WINDOW_SIZE_WIDTH_KEY , defaults. width ) ;
51
- let height = get_str ( & key, WINDOW_SIZE_HEIGHT_KEY , defaults. height ) ;
50
+ let mut width = get_str ( & key, WINDOW_SIZE_WIDTH_KEY , defaults. width ) ;
51
+ if width < 0 {
52
+ width = defaults. width ;
53
+ }
54
+ let mut height = get_str ( & key, WINDOW_SIZE_HEIGHT_KEY , defaults. height ) ;
55
+ if height < 0 {
56
+ height = defaults. height ;
57
+ }
52
58
let auto_width = get_bool ( & key, WINDOW_SIZE_AUTO_WIDTH_KEY , defaults. auto_width ) ;
53
59
let auto_height = get_bool ( & key, WINDOW_SIZE_AUTO_HEIGHT_KEY , defaults. auto_height ) ;
54
60
@@ -72,8 +78,12 @@ impl WindowRegistryInfo {
72
78
let key = CURRENT_USER . create ( APP_REG_KEY ) ?;
73
79
key. set_string ( WINDOW_POS_X_KEY , & self . x . to_string ( ) ) ?;
74
80
key. set_string ( WINDOW_POS_Y_KEY , & self . y . to_string ( ) ) ?;
75
- key. set_string ( WINDOW_SIZE_WIDTH_KEY , & self . width . to_string ( ) ) ?;
76
- key. set_string ( WINDOW_SIZE_HEIGHT_KEY , & self . height . to_string ( ) ) ?;
81
+ if self . width > 0 {
82
+ key. set_string ( WINDOW_POS_X_KEY , & self . x . to_string ( ) ) ?;
83
+ }
84
+ if self . height > 0 {
85
+ key. set_string ( WINDOW_POS_Y_KEY , & self . y . to_string ( ) ) ?;
86
+ }
77
87
key. set_u32 ( WINDOW_SIZE_AUTO_WIDTH_KEY , self . auto_width as _ ) ?;
78
88
key. set_u32 ( WINDOW_SIZE_AUTO_HEIGHT_KEY , self . auto_height as _ ) ?;
79
89
0 commit comments