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