Page MenuHome

Fix for T64956: Improving Window Border Selection
AbandonedPublic

Authored by Harley Acheson (harley) on May 26 2019, 3:57 AM.
Tokens
"Like" token, awarded by belich."Love" token, awarded by Fracture128."Like" token, awarded by CandleComet."Love" token, awarded by HooglyBoogly."Love" token, awarded by pablovazquez."Love" token, awarded by blueprintrandom."Like" token, awarded by xorrito."Love" token, awarded by Tetone."Like" token, awarded by billreynish."Like" token, awarded by EitanSomething."Like" token, awarded by razgriz286.

Details

Summary

I doubt this is a good time to consider such changes, but maybe for 2.81. This patch fixes a problem that most people are probably not aware of and is therefore difficult to explain...

To resize editor windows we need to place our mouse in the gaps between them and drag. But sometimes it is more difficult to position your mouse correctly than you would expect, especially if using a tablet pen. This is because the borders that you see are not the same size as the actual gaps.

The following table lists the difference between the gaps and the borders. You will see that not only are they always different, but that difference varies in unpredictable ways.

This patch makes it so that the positions of the editors and the gaps between them exactly match the borders that are drawn. This way you can always be assured that you can drag while your mouse is anywhere in the gap.

I tried to make it so that default sizes are as close as possible as they are now so most people would not notice a difference. Headers are currently defined as 26 pixels tall even though we see them to be 24 (because 2 pixels are covered). So this patch changes the header height definition to 24 pixels and removes an adjustment for this.

Doing this does bring us very close to being able to have borders widths as a user preference. This would be ideal as width of the borders should not really be tied to line width. You might be perfectly happy with how it all looks but then get a graphics tablet that requires wider borders. Unfortunately doing this would have to wait. The border line drawing code ties the border radius to the width of the border. So this would have to be change so we can keep radius (tied to scale) but vary only border width.

Diff Detail

Repository
rB Blender

Event Timeline

User Preference for Border Widths

As mentioned in earlier comments, the gaps we currently see between editors is not the same size as the actual gaps. This patch fixes that so what you see is what you get, making it easier to get the "resize window" placement correct. Right now we might see a 3-pixel border but have to hit a single pixel, or see seven and have to hit three.

Why a User Preference for Border?

Because this is not related to anything else. You might be perfectly happy with everything else and then get a tablet, for example. Or have perfect eyesight but have mobility issues making it difficult to hit the resize areas.

It looks like this in

Note that I'd missed some magic somewhere so this setting is not saving between sessions. Not sure why yet...

I'd go for what you see is what you get. Clicking on the gap even with +1 pixel on each side for extra safety. No user preference.

I've seen people (and myself) struggled with the current small action zone using both mouse and tablet. The current behavior is not something we want to keep.

@Pablo Vazquez (pablovazquez) - I'd go for what you see is what you get...No user preference.

Just to be clear though, this patch makes it always show a visual border between editors that matches pixel-for-pixel with the actual gaps between editors.

That alone probably helps. But I don't know if that will help enough in all circumstances. I have had (a small number of) people ask for thinner borders for some reason. But the (large number of) people asking for wider are quite often users of tablets and other pointing devices with lower precision.

So this patch has four user-selectable widths: A default that roughly matches what we see now, but should be easier to use. A "Thin" that looks interesting and works about as easily as regular does now. And two wider settings for tablet user and those with mobility issues.

But I don't have a tablet or any variation of equipment to test with. So it is possible that the multiple widths are not needed. Although my gut feeling is that the users who would need it would quite appreciate it.

@Pablo Vazquez (pablovazquez) ... with +1 pixel on each side for extra safety....

Yes, that has been something I also wanted to play with. Obviously can't do that now without what-you-see-is-what-you-get. But would still take some investigation as we do place some content close to the edges. If this patch is enough then adding an extra pixel on each side might be unnecessary. And would break that WYSIWYG advantage a bit when trying to select a corner "pin" button or open an area disclosure arrow (for things like Sidebar).

William Reynish (billreynish) requested changes to this revision.Aug 15 2019, 8:26 PM

Tested.

The good:

  • It's now way easier to grab the area dividers

The bad:

  • There are visual artefacts along some borders:

  • The default border size has changed, and is now unacceptably thick:

This revision now requires changes to proceed.Aug 15 2019, 8:26 PM

@William Reynish (billreynish) - It's now way easier to grab the area dividers

awesome!

There are visual artefacts along some borders:

There are. Some editors are drawing some things near their edges that we haven't seen before because they have been covered up by the current borders which are too wide. Something we'd have to address for that editor.

The default border size has changed, and is now unacceptably thick:

Yes, that sample (and I have confirmed) shows a border that is wider than my expected result (at 2X scale, auto line width, and default border width). Will investigate and fix.

It should now be giving the border sizes that I intended for larger interface scales.

Fixes an issue with TopBar displaying a 1-pixel wide region below header area (was cut off by the overlapping borders before so not seen)

"Area Options" menu works with variable-sized border widths.

Note that rounded corners are temporarily turned off while I hunt down a few more issues. But otherwise this patch is quite complete and I'd welcome any input.

Apply it, compile (including your source target), then go to Preferences / Interface and you should see a new "Border Width" option to experiment with.

Fixes a small glitch. Panel menus on right side were not completely filling their area with bg color. Out by one pixel. But we couldn't see that mistake because the over-wide borders were covering it up.

Nicer vertical centering of header content

Harley Acheson (harley) retitled this revision from Fix for T64956: Improving Window Border Selection to WIP Fix for T64956: Improving Window Border Selection.Oct 4 2019, 6:58 PM

Updated for current master.

In a better shape for current direction of experimentation.

No corner rounding still. But the gap widths are user-selectable and are exactly WYSIWYG.

Small Adjustments.

Tab Azones (area reveal arrows) adjusted so they are consistent size, right at edges and with arrows centered. They were (mostly) assuming that a pixel or two were cut off, but this is not done here so have to move slightly.

No need for borders at left end right window edges.

Updated for current state of master.

Now lopping off the corners.

Experimenting a bit. Currently showing an extra outline around the active area - something we can't do now because of the way we currently overdraw the lines.

Following shows a portion of a window at 1X scale, with "Exta-wide" borders. It is certainly easier to hit these wider gaps when resizing.

Removing the (experimental) active area highlight

Adding a 5th border width. The Preferences panel now looks like the following:

Forgot to remove a little hack.

William Reynish (billreynish) requested changes to this revision.Oct 30 2019, 10:31 AM

I tested this patch again. The issue overall is still there.

Dragging editor borders is much nicer with this patch, so that's a really good thing. But, the *display* of the editor borders have now changed.

Top: after. Bottom: before:

If you can make the better editor dragging work without changing the display to make the borders thick or breaking the rounded corners, that would be great.

This revision now requires changes to proceed.Oct 30 2019, 10:31 AM

@William Reynish (billreynish) - If you can make the better editor dragging work without changing the display to make the borders thick...

As mentioned at the top of this thread, the problems with our current borders is a fundamental issue and require fundamental changes in order to work correctly. Making the borders "thicker" here is a new choice introduced with this patch and not something required. In fact, with patch applied you can choose to make the borders THINNER than they are now but they will still be easier to drag than currently.

@William Reynish (billreynish) - or breaking the rounded corners, that would be great.

Meh. I'm really not going to spend a lot of time competing with the roundness of the corners as that can be done better by someone else if we did decide this fundamental change is useful.

Updated to current state of master.

Also now supports all integer widths. The current code only gives odd-width borders, and my old code yielded just even-width borders. Now it does any integer so eliminates any large jumps as settings and scale are changed.

Default width is now 3 pixels at 1X scale with auto line width, which is exactly what we get visually currently, but is three times easier to hit (hit size is 3 pixels rather than 1)

Default width is 6 pixels at 2X scale with auto line width, so exactly double which is ideal. 1 pixel narrower than at that scale currently (is 7) but still twice as easy to hit. Hit size is 6 pixels versus 3 now.

Because all integers are supported the setting is now an integer range:

Updated to current state of master. Now allows 1-10 border width (3 as default). Corners are rounded a bit nicer.

An illustration of the current state of this patch:

The left shows borders that are thinner than they are in current master, but would still be much easier to hit than they are now. The right side shows borders that are much wider than now, allowing for better use with imprecise pointing devices.

+1

This is awesome, Harley! Can't wait for this to be in.

William Reynish (billreynish) requested changes to this revision.Nov 17 2019, 4:47 AM

These new corners are not anti-aliased.

Here you can see before (master) vs this patch:

I continue to be puzzled as to why it is necessary to change the *display* of the edges and corners when the only issue before was the size of the hit-box. But, it seems like I will never be able to fully understand why this must be.

In any case, if the display can at least look as smooth as what we have in master, it would be alright.

This revision now requires changes to proceed.Nov 17 2019, 4:47 AM

Updated to current state of master. And corners are now AA...

Tested again - everything seems to work well now. Couldn't detect any issues now, and the improvement for gradding edges is a real benefit. Well done!

This revision is now accepted and ready to land.Nov 18 2019, 12:34 PM

Updated to current state of master plus...

Removed the user preference for border width. Instead it starts at defaults that match what we see currently and (like now) changes with the Line Width setting.

TL;DR version:

At 1X scale (and default line width) the borders look the same as now but are three times easier to hit. At 2X scale the borders are 6 pixels wide (versus 7 pixels now), but are still twice as easy to hit.

Generally the widths change in nicer and more predictable ways but still remain much easier to hit. For example, selecting "wide lines" while at 1X gives a width of 5 pixels (instead of the current 7 which is too much of an increase), but is still 1.5X easier to hit (5 times easier than current regular width). Wide lines at 2X gives 10 pixels, which is about the same as now (9) but is twice as easy to hit. Basically what you see is what you can hit. LOL

Some details:

I had hoped to simplify the editor-spacing code in area.c a bit, but it turns out that I do have to continue supporting arbitrary border widths. The current code always results in odd-sized gaps and widths, but this code necessarily results in a more scaled result. So a 3-pixel gap at 1X results in 6 pixels at 2X, rather than the seven we get now. So obviously I need to support even and odd values.

A couple changes seem disconnected from the main issue. This is because removing the overprinting lines can expose some problems not noticed before. Like on the right side of the tabs in the Sidebar there was a faint line so had to make a one-pixel fix there. TopBar similarly has a (mostly) hidden main region that was always drawing a line below it. Couldn't remove that unused area so just clear it to outline color.

I'm hoping nobody notices that I have not altered the define for header height. With this patch the entire height of the defined header is shown, rather than having a couple pixels cut off at the top of it. But we can really use the extra couple of pixels there.

In creating the rounded corners I had to copy in some AA_JITTER values into screen_draw.c because I could not figure out how to get at them otherwise.

But seems to work quite well.

Harley Acheson (harley) retitled this revision from WIP Fix for T64956: Improving Window Border Selection to Fix for T64956: Improving Window Border Selection.Dec 11 2019, 6:03 PM

Updating to current state of master.

Is there any reason caching the Batch needs to be removed? All corners are the same size.

After this change it's looks to be drawing over 200 triangles with immediate mode - every redraw.

@Campbell Barton (campbellbarton) - Is there any reason...

Yes, that I don’t know what I’m doing with that corner-drawing stuff.

The current corners are drawn at the same time as the border lines. But the the geometry of those corners involves the entire width of those borders. So, for example, if you tried making the borders very narrow the corners get smaller and then break.

With this patch the corners cannot extend outside the area. And there is a further complication that they need to be AA on that rounded edge but then need to match to the color of the gaps (solid color gap versus the partial transparency you get with jittering).

So what is here sort of works, but would require someone who knows what they are doing to make the corners. This (bad) attempt is about at the edge of my OpenGL knowledge. LOL

Abandoning in favor of much simpler solution here: https://developer.blender.org/D7823