@@ -21,6 +21,8 @@ pub struct HotkeyBinding {
2121pub struct PersistedConfig {
2222 #[ serde( default = "default_launch_on_login" ) ]
2323 pub launch_on_login : bool ,
24+ #[ serde( default = "default_true" ) ]
25+ pub remove_rounded_corners_on_snap : bool ,
2426 #[ serde( default ) ]
2527 pub gap_size : f32 ,
2628 #[ serde( default ) ]
@@ -74,6 +76,7 @@ pub struct PersistedHotkey {
7476#[ derive( Clone , Debug ) ]
7577pub struct Config {
7678 pub launch_on_login : bool ,
79+ pub remove_rounded_corners_on_snap : bool ,
7780 pub gap_size : f32 ,
7881 pub screen_edge_gap_top : f32 ,
7982 pub screen_edge_gap_bottom : f32 ,
@@ -94,6 +97,7 @@ pub struct Config {
9497#[ serde( rename_all = "camelCase" ) ]
9598pub struct ConfigForFrontend {
9699 pub launch_on_login : bool ,
100+ pub remove_rounded_corners_on_snap : bool ,
97101 pub gap_size : f32 ,
98102 pub screen_edge_gap_top : f32 ,
99103 pub screen_edge_gap_bottom : f32 ,
@@ -120,6 +124,7 @@ impl Config {
120124 pub fn to_frontend ( & self ) -> ConfigForFrontend {
121125 ConfigForFrontend {
122126 launch_on_login : self . launch_on_login ,
127+ remove_rounded_corners_on_snap : self . remove_rounded_corners_on_snap ,
123128 gap_size : self . gap_size ,
124129 screen_edge_gap_top : self . screen_edge_gap_top ,
125130 screen_edge_gap_bottom : self . screen_edge_gap_bottom ,
@@ -184,7 +189,8 @@ impl Config {
184189
185190 Self {
186191 launch_on_login : true ,
187- gap_size : -2.0 ,
192+ remove_rounded_corners_on_snap : true ,
193+ gap_size : -1.0 ,
188194 screen_edge_gap_top : 0.0 ,
189195 screen_edge_gap_bottom : 0.0 ,
190196 screen_edge_gap_left : 0.0 ,
@@ -276,6 +282,7 @@ fn config_from_persisted(p: PersistedConfig, default_config: Config) -> Config {
276282
277283 Config {
278284 launch_on_login : p. launch_on_login ,
285+ remove_rounded_corners_on_snap : p. remove_rounded_corners_on_snap ,
279286 gap_size : p. gap_size ,
280287 screen_edge_gap_top : p. screen_edge_gap_top ,
281288 screen_edge_gap_bottom : p. screen_edge_gap_bottom ,
@@ -320,6 +327,7 @@ pub fn config_from_frontend(p: ConfigForFrontend) -> Config {
320327 } ;
321328 Config {
322329 launch_on_login : p. launch_on_login ,
330+ remove_rounded_corners_on_snap : p. remove_rounded_corners_on_snap ,
323331 gap_size : p. gap_size ,
324332 screen_edge_gap_top : p. screen_edge_gap_top ,
325333 screen_edge_gap_bottom : p. screen_edge_gap_bottom ,
@@ -346,6 +354,7 @@ pub fn save(config: &Config) -> Result<(), Box<dyn std::error::Error>> {
346354 let path = config_path ( ) ;
347355 let p = PersistedConfig {
348356 launch_on_login : config. launch_on_login ,
357+ remove_rounded_corners_on_snap : config. remove_rounded_corners_on_snap ,
349358 gap_size : config. gap_size ,
350359 screen_edge_gap_top : config. screen_edge_gap_top ,
351360 screen_edge_gap_bottom : config. screen_edge_gap_bottom ,
@@ -391,11 +400,15 @@ mod tests {
391400 let config = Config :: default ( ) ;
392401
393402 assert ! ( config. launch_on_login) ;
394- assert_eq ! ( config. gap_size, -2.0 ) ;
403+ assert ! ( config. remove_rounded_corners_on_snap) ;
404+ assert_eq ! ( config. gap_size, -1.0 ) ;
395405 assert_eq ! ( config. thirds_layout, "Thirds" ) ;
396406 assert_eq ! ( config. hotkeys. len( ) , 18 ) ;
397407 assert_eq ! ( config. hotkeys[ 0 ] . action, "LeftHalf" ) ;
398- assert_eq ! ( config. hotkeys[ 0 ] . modifiers, MOD_WIN | MOD_ALT | MOD_NOREPEAT ) ;
408+ assert_eq ! (
409+ config. hotkeys[ 0 ] . modifiers,
410+ MOD_WIN | MOD_ALT | MOD_NOREPEAT
411+ ) ;
399412 }
400413
401414 #[ test]
@@ -404,6 +417,7 @@ mod tests {
404417 let frontend = config. to_frontend ( ) ;
405418
406419 assert_eq ! ( frontend. thirds_layout, "Thirds" ) ;
420+ assert ! ( frontend. remove_rounded_corners_on_snap) ;
407421 assert_eq ! ( frontend. hotkeys[ 0 ] . action, "LeftHalf" ) ;
408422 assert_eq ! ( frontend. hotkeys[ 0 ] . shortcut, "Win+Alt+Left" ) ;
409423 }
@@ -412,6 +426,7 @@ mod tests {
412426 fn config_from_frontend_normalizes_layout_and_restore_action ( ) {
413427 let frontend = ConfigForFrontend {
414428 launch_on_login : false ,
429+ remove_rounded_corners_on_snap : false ,
415430 gap_size : 0.0 ,
416431 screen_edge_gap_top : 1.0 ,
417432 screen_edge_gap_bottom : 2.0 ,
@@ -435,15 +450,20 @@ mod tests {
435450 assert_eq ! ( config. hotkeys. len( ) , 1 ) ;
436451 assert_eq ! ( config. hotkeys[ 0 ] . action, "Undo" ) ;
437452 assert_eq ! ( config. hotkeys[ 0 ] . virtual_key, 0x25 ) ;
438- assert_eq ! ( config. hotkeys[ 0 ] . modifiers, MOD_WIN | MOD_ALT | MOD_NOREPEAT ) ;
453+ assert_eq ! (
454+ config. hotkeys[ 0 ] . modifiers,
455+ MOD_WIN | MOD_ALT | MOD_NOREPEAT
456+ ) ;
439457 assert ! ( !config. launch_on_login) ;
458+ assert ! ( !config. remove_rounded_corners_on_snap) ;
440459 assert ! ( !config. apply_gaps_to_maximize) ;
441460 }
442461
443462 #[ test]
444463 fn config_from_frontend_falls_back_to_defaults_when_hotkeys_are_invalid ( ) {
445464 let frontend = ConfigForFrontend {
446465 launch_on_login : true ,
466+ remove_rounded_corners_on_snap : true ,
447467 gap_size : 0.0 ,
448468 screen_edge_gap_top : 0.0 ,
449469 screen_edge_gap_bottom : 0.0 ,
@@ -471,6 +491,7 @@ mod tests {
471491 fn config_from_persisted_normalizes_layout_restore_and_shortcuts ( ) {
472492 let persisted = PersistedConfig {
473493 launch_on_login : true ,
494+ remove_rounded_corners_on_snap : false ,
474495 gap_size : 0.0 ,
475496 screen_edge_gap_top : 0.0 ,
476497 screen_edge_gap_bottom : 0.0 ,
@@ -493,6 +514,7 @@ mod tests {
493514
494515 let config = config_from_persisted ( persisted, Config :: default ( ) ) ;
495516 assert_eq ! ( config. thirds_layout, "Fourths" ) ;
517+ assert ! ( !config. remove_rounded_corners_on_snap) ;
496518 assert_eq ! ( config. hotkeys. len( ) , 1 ) ;
497519 assert_eq ! ( config. hotkeys[ 0 ] . action, "Undo" ) ;
498520 assert_eq ! ( config. hotkeys[ 0 ] . virtual_key, 0x27 ) ;
@@ -502,6 +524,7 @@ mod tests {
502524 fn config_from_persisted_supports_legacy_modifier_and_vk_fields ( ) {
503525 let persisted = PersistedConfig {
504526 launch_on_login : true ,
527+ remove_rounded_corners_on_snap : true ,
505528 gap_size : 0.0 ,
506529 screen_edge_gap_top : 0.0 ,
507530 screen_edge_gap_bottom : 0.0 ,
@@ -525,14 +548,21 @@ mod tests {
525548 let config = config_from_persisted ( persisted, Config :: default ( ) ) ;
526549 assert_eq ! ( config. thirds_layout, "Thirds" ) ;
527550 assert_eq ! ( config. hotkeys. len( ) , 1 ) ;
528- assert_eq ! ( config. hotkeys[ 0 ] . modifiers, MOD_WIN | MOD_ALT | MOD_NOREPEAT ) ;
529- assert_eq ! ( format_shortcut( config. hotkeys[ 0 ] . modifiers, config. hotkeys[ 0 ] . virtual_key) , "Win+Alt+Left" ) ;
551+ assert_eq ! (
552+ config. hotkeys[ 0 ] . modifiers,
553+ MOD_WIN | MOD_ALT | MOD_NOREPEAT
554+ ) ;
555+ assert_eq ! (
556+ format_shortcut( config. hotkeys[ 0 ] . modifiers, config. hotkeys[ 0 ] . virtual_key) ,
557+ "Win+Alt+Left"
558+ ) ;
530559 }
531560
532561 #[ test]
533562 fn config_from_persisted_falls_back_to_defaults_when_all_hotkeys_are_invalid ( ) {
534563 let persisted = PersistedConfig {
535564 launch_on_login : true ,
565+ remove_rounded_corners_on_snap : true ,
536566 gap_size : 0.0 ,
537567 screen_edge_gap_top : 0.0 ,
538568 screen_edge_gap_bottom : 0.0 ,
0 commit comments