@@ -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 (
@@ -239,7 +239,15 @@ impl super::Surface {
239239 let frame: CGRect = msg_send ! [ root_layer, bounds] ;
240240 let ( ) = msg_send ! [ new_layer, setFrame: frame] ;
241241
242- let _: ( ) = msg_send ! [ new_layer, setContentsGravity: unsafe { kCAGravityTopLeft } ] ;
242+ // The desired content gravity is `kCAGravityResize`, because it
243+ // masks / alleviates issues with resizing when
244+ // `present_with_transaction` is disabled, and behaves better when
245+ // moving the window between monitors.
246+ //
247+ // Unfortunately, it also makes it harder to see changes to
248+ // `width` and `height` in `configure`. When debugging resize
249+ // issues, swap this for `kCAGravityTopLeft` instead.
250+ let _: ( ) = msg_send ! [ new_layer, setContentsGravity: unsafe { kCAGravityResize } ] ;
243251
244252 // Set initial scale factor of the layer. This is kept in sync by
245253 // `configure` (on UIKit), and the delegate below (on AppKit).
0 commit comments