macos: tweak gravity while resizing
This helps a situation where the window contents has not changed in time for a drawing. Setting the texture gravity helps that side or corner to be less jittery while moving. Ideally, we can get to a point where we are synchronized and keeping up with drawing fast enough to not need this. That may require some work to drive frame clocks from drawRect: though.
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
|
||||
#import "GdkMacosBaseView.h"
|
||||
#import "GdkMacosCairoView.h"
|
||||
#import "GdkMacosGLView.h"
|
||||
#import "GdkMacosWindow.h"
|
||||
|
||||
#include "gdkmacosdisplay-private.h"
|
||||
@@ -140,6 +141,10 @@
|
||||
|
||||
_gdk_macos_display_break_all_grabs (GDK_MACOS_DISPLAY (display), time);
|
||||
|
||||
/* Reset gravity */
|
||||
if (GDK_IS_MACOS_GL_VIEW ([self contentView]))
|
||||
[[[self contentView] layer] setContentsGravity:kCAGravityBottomLeft];
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -543,6 +548,43 @@
|
||||
inManualResize = YES;
|
||||
resizeEdge = edge;
|
||||
|
||||
if (GDK_IS_MACOS_GL_VIEW ([self contentView]))
|
||||
{
|
||||
CALayerContentsGravity gravity = kCAGravityBottomLeft;
|
||||
|
||||
switch (edge)
|
||||
{
|
||||
default:
|
||||
case GDK_SURFACE_EDGE_NORTH:
|
||||
gravity = kCAGravityTopLeft;
|
||||
break;
|
||||
|
||||
case GDK_SURFACE_EDGE_NORTH_WEST:
|
||||
gravity = kCAGravityTopRight;
|
||||
break;
|
||||
|
||||
case GDK_SURFACE_EDGE_SOUTH_WEST:
|
||||
case GDK_SURFACE_EDGE_WEST:
|
||||
gravity = kCAGravityBottomRight;
|
||||
break;
|
||||
|
||||
case GDK_SURFACE_EDGE_SOUTH:
|
||||
case GDK_SURFACE_EDGE_SOUTH_EAST:
|
||||
gravity = kCAGravityBottomLeft;
|
||||
break;
|
||||
|
||||
case GDK_SURFACE_EDGE_EAST:
|
||||
gravity = kCAGravityBottomLeft;
|
||||
break;
|
||||
|
||||
case GDK_SURFACE_EDGE_NORTH_EAST:
|
||||
gravity = kCAGravityTopLeft;
|
||||
break;
|
||||
}
|
||||
|
||||
[[[self contentView] layer] setContentsGravity:gravity];
|
||||
}
|
||||
|
||||
initialResizeFrame = [self frame];
|
||||
initialResizeLocation = [self convertPointToScreen:[self mouseLocationOutsideOfEventStream]];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user