Use centerScanRect to correct Items frame and avoid flickering.

This commit is contained in:
Riccardo Mottola 2020-12-12 23:32:01 +01:00
parent 5cee71869b
commit 9db97cd047
2 changed files with 21 additions and 15 deletions

View file

@ -1,3 +1,8 @@
2020-12-11 Riccardo Mottola <rm@gnu.org>
* Source/GSToolbarView.m,
Use centerScanRect to correct Items frame and avoid flickering.
2020-12-06 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSToolbarFrameworkPrivate.h,
@ -10,11 +15,10 @@
* Source/NSMenuView.m (-mouseDown:): Protect against _window going
away during tracking.
2020-11-23 Riccardo <rm@gnu.org>
2020-11-23 Riccardo Mottola <rm@gnu.org>
* Source/NSPopUpButtonCell.m (release):
Use standard setMenu: in release and avoid leaking the Menu. (Proposed by Fred)
2020-11-03 Riccardo Mottola <rm@gnu.org>
* Source/NSBitmapImageRep+JPEG.m (_JPEGRepresentationWithProperties:):

View file

@ -3,7 +3,7 @@
<abstract>The toolbar view class.</abstract>
Copyright (C) 2004-2015 Free Software Foundation, Inc.
Copyright (C) 2004-2020 Free Software Foundation, Inc.
Author: Quentin Mathe <qmathe@club-internet.fr>
Date: January 2004
@ -686,10 +686,10 @@ static NSUInteger draggedItemIndex = NSNotFound;
if ([item _isFlexibleSpace])
{
NSRect backViewFrame = [backView frame];
[backView setFrame: NSMakeRect(x, backViewFrame.origin.y,
spacePerFlexItem,
backViewFrame.size.height)];
NSRect newFrameRect = NSMakeRect(x, backViewFrame.origin.y,
spacePerFlexItem,
backViewFrame.size.height);
[backView setFrame: [self centerScanRect:newFrameRect]];
mustAdjustNext = YES;
}
else if ([variableWidthItems indexOfObjectIdenticalTo:item] != NSNotFound)
@ -698,17 +698,19 @@ static NSUInteger draggedItemIndex = NSNotFound;
CGFloat maxFlex = [item maxSize].width - [item minSize].width;
CGFloat flexAmount = MIN(maxFlex, spacePerFlexItem * FlexItemWeight);
CGFloat newWidth = [item minSize].width + flexAmount + 2 * InsetItemViewX;
[backView setFrame: NSMakeRect(x, backViewFrame.origin.y,
newWidth,
backViewFrame.size.height)];
NSRect newFrameRect = NSMakeRect(x, backViewFrame.origin.y,
newWidth,
backViewFrame.size.height);
[backView setFrame: [self centerScanRect: newFrameRect]];
mustAdjustNext = YES;
}
else if (mustAdjustNext)
{
NSRect backViewFrame = [backView frame];
[backView setFrame: NSMakeRect(x, backViewFrame.origin.y,
backViewFrame.size.width, backViewFrame.size.height)];
NSRect newFrameRect = NSMakeRect(x, backViewFrame.origin.y,
backViewFrame.size.width,
backViewFrame.size.height);
[backView setFrame: [self centerScanRect: newFrameRect]];
}
view = [item view];
if (view != nil)
@ -802,8 +804,8 @@ static NSUInteger draggedItemIndex = NSNotFound;
}
}
- (void) _reload
{
- (void) _reload
{
// First, we resize
[self _handleBackViewsFrame];
[self _takeInAccountFlexibleSpaces];