videoplayer: do not needlessly resize the window
authorKostya Shishkov <kostya.shishkov@gmail.com>
Sat, 26 Aug 2023 14:12:51 +0000 (16:12 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Sat, 26 Aug 2023 14:12:51 +0000 (16:12 +0200)
On window resize it pops us which may be annoying when playing same-sized files.

videoplayer/src/main.rs

index 37eb89d8f689bce1bf25068e812d3aa82a135a02..3126b19da9614bc87b8d37507d76ce87fdae4157 100644 (file)
@@ -726,7 +726,9 @@ impl Player {
                 "NihAV player".to_owned()
             };
         window.set_title(&wname).expect("set window title");
-        window.set_size(width as u32, height as u32).expect("resize window");
+        if window.size() != (width as u32, height as u32) {
+            window.set_size(width as u32, height as u32).expect("resize window");
+        }
         window.show();
         let mut canvas = window.into_canvas().build().expect("should be able to build canvas");
         let texture_creator = canvas.texture_creator();