@@ -25,7 +25,7 @@ use parking_lot::{Mutex, RwLock};
2525#[ link( name = "QuartzCore" , kind = "framework" ) ]
2626extern "C" {
2727 #[ allow( non_upper_case_globals) ]
28- static kCAGravityTopLeft : * mut Object ;
28+ static kCAGravityResize : * mut Object ;
2929}
3030
3131extern "C" fn layer_should_inherit_contents_scale_from_window (
@@ -241,7 +241,15 @@ impl super::Surface {
241241 let frame: CGRect = msg_send ! [ root_layer, bounds] ;
242242 let ( ) = msg_send ! [ new_layer, setFrame: frame] ;
243243
244- let _: ( ) = msg_send ! [ new_layer, setContentsGravity: unsafe { kCAGravityTopLeft } ] ;
244+ // The desired content gravity is `kCAGravityResize`, because it
245+ // masks / alleviates issues with resizing when
246+ // `present_with_transaction` is disabled, and behaves better when
247+ // moving the window between monitors.
248+ //
249+ // Unfortunately, it also makes it harder to see changes to
250+ // `width` and `height` in `configure`. When debugging resize
251+ // issues, swap this for `kCAGravityTopLeft` instead.
252+ let _: ( ) = msg_send ! [ new_layer, setContentsGravity: unsafe { kCAGravityResize } ] ;
245253
246254 // Set initial scale factor of the layer. This is kept in sync by
247255 // `configure` (on UIKit), and the delegate below (on AppKit).
0 commit comments