Page MenuHome

Fix T100141: Header Alignment of New Editors
AbandonedPublic

Authored by Harley Acheson (harley) on Sep 3 2022, 7:50 PM.

Details

Summary

When splitting editors, ensure that the header is right-aligned.


As shown in T100141: Regression: Right aligned header splitting an editor creates a new one with its header centered rather than left-aligned.

Diff Detail

Repository
rB Blender

Event Timeline

Harley Acheson (harley) edited the summary of this revision. (Show Details)

This might be a nicer way to do it. At least @Anthony Edlin (krash) sounds like he'd prefer this.

The V2D_KEEPOFS_X makes the header grow from the left, rather than resize from center.

The gives nice behavior if the source area's header is at the left. But if it is scrolled over then the destination header will be at a similar position. This is because new areas created by splitting are duplicates. So the calls to UI_view2d_curRect_reset resets those views so they always start at the left edge no matter how the source area is.

Only reset HEADER regions.

I build and tested the patch, seems good to me.

Some context is missing from the patch.

  • Why did the old code work.
  • Why did it break.
  • Why is the fix not simply to add back old logic.

From a quick check it looks like code prior to rB624397231928 kept left alignment when resizing areas, this code was removed.

The reason this could be important is the same bug could happen for non-headers, where we might not want to simply reset the areas.

source/blender/editors/screen/screen_edit.c
179

This comment should note why it's needed & why only headers need this, a reference to T100141 could be added too.

Just reading out of interest and noticed two things

source/blender/editors/screen/screen_edit.c
181–182

clang format

187

Best to leave this sort of cleanup to separate cleanup commits

@Harley Acheson (harley) checking on this and think it would be best to revert the changes from rB6243972319289d86c70ce9946d10909e7eddfdaf. While this re-introduces T72392, it's a low priority bug that isn't a regression.

A fix for T72392 can be committed separately.

Here are two patches:

@Campbell Barton (campbellbarton)

Your P3207 only solves part of the problem. Everything works as expected if the source area has its header scrolled all the way to the left. You properly get a left-aligned header for the new area if you create it from the left or the right. However, if the source area has its header scrolled over, the new area will inherit that of the old:

This is a change from previous versions of blender where the new area was always left-aligned:

Your change seems to have the same affect as my single-line change to view2d.cc of v2d->keepofs = V2D_LOCKOFS_Y | V2D_KEEPOFS_X;

The rest of my changes were to address this same issue: resetting the header of the new area so that it starts left-aligned no matter how the original area was.

@Harley Acheson (harley) this looks to be existing behavior (tested 3.1 and 2.93), while not perfect it's an improvement over the bug reported in T100141.

Unless reverting the changes causes new bugs not found in 2.93 I think it's reasonable do so. Fixes for the issues your pointing out can always be handled separately.

@Harley Acheson (harley) this looks to be existing behavior (tested 3.1 and 2.93), while not perfect it's an improvement over the bug reported in T100141.

Unless reverting the changes causes new bugs not in 2.93 I think it's reasonable do so.

No worries. I think I tested in 3.0. And I don't think it unreasonable that the new area behaves as the older areas. But yes, anything is better than the current behavior. LOL

Closing this patch, further discussion can continue in other differentials/tasks.