UI: Widen Search Boxes When Necessary #104603

Merged
Harley Acheson merged 3 commits from Harley/blender:SearchWidth into main 2023-02-24 00:07:27 +01:00
Member

Make floating search boxes wider when there is a linked scene or are
otherwise showing more information than a simple list.


This patch serves a similar purpose to this one by Phil Stopford https://archive.blender.org/developer/D16857

While that patch widened all search boxes, this one only does so when needed - the list has UI_MENU_ITEM_SEPARATOR_SHORTCUT or if any of the items have UI_BUT_HAS_SEP_CHAR. If either these is true then an amount is added to the width of 12 * data->fstyle.points * U.dpi_fac

The use of style.points is an accessibility issue in that it gains extra width than just the UI scale if the user has also increased the text style font points. This is done by some users with vision disabilities. Following shows a complaint about the search box by such a user (last image in comment): #86974 (comment)

Note that these search boxes are initiated in two different ways. One is from a menu item (the block will have UI_BLOCK_SEARCH_MENU), in which case the caller directly specifies the width at the call site. This patch does not change the width they are directly requesting.

The other way these searches are initiated is usually part of a larger UI item. In these cases the caller can not specify the width, it is just automatically the same width. It is for this type that this patch checks the type and content and makes it wider if needed.

This might look like a fair big change, but it is really just adding a layout callback to the region and then moving all the code to do with sizing into it.

Following shows the change in size of two of these search boxes, as animated GIFs showing before and after:

Search1.gif

Search2.gif

Make floating search boxes wider when there is a linked scene or are otherwise showing more information than a simple list. --- This patch serves a similar purpose to this one by Phil Stopford https://archive.blender.org/developer/D16857 While that patch widened all search boxes, this one only does so when needed - the list has UI_MENU_ITEM_SEPARATOR_SHORTCUT or if any of the items have UI_BUT_HAS_SEP_CHAR. If either these is true then an amount is added to the width of `12 * data->fstyle.points * U.dpi_fac` The use of style.points is an accessibility issue in that it gains extra width than just the UI scale if the user has also increased the text style font points. This is done by some users with vision disabilities. Following shows a complaint about the search box by such a user (last image in comment): https://projects.blender.org/blender/blender/issues/86974#issuecomment-873353 Note that these search boxes are initiated in two different ways. One is from a menu item (the block will have UI_BLOCK_SEARCH_MENU), in which case the caller directly specifies the width at the call site. This patch does not change the width they are directly requesting. The other way these searches are initiated is usually part of a larger UI item. In these cases the caller can not specify the width, it is just automatically the same width. It is for this type that this patch checks the type and content and makes it wider if needed. This might look like a fair big change, but it is really just adding a `layout` callback to the region and then moving all the code to do with sizing into it. Following shows the change in size of two of these search boxes, as animated GIFs showing before and after: ![Search1.gif](/attachments/5f5f6f43-9160-4f79-90c0-b504f6427cc2) ![Search2.gif](/attachments/c7aacc1d-c805-4464-8a56-b88956237033)
Harley Acheson requested review from Julian Eisel 2023-02-11 02:14:14 +01:00
Harley Acheson requested review from Brecht Van Lommel 2023-02-11 02:14:25 +01:00
Brecht Van Lommel added this to the Module: User Interface project 2023-02-13 09:10:08 +01:00
Brecht Van Lommel requested changes 2023-02-17 15:46:04 +01:00
Brecht Van Lommel left a comment
Owner

Looks fine overall.

Looks fine overall.
@ -742,0 +711,4 @@
UI_MENU_ITEM_SEPARATOR_SHORTCUT :
UI_MENU_ITEM_SEPARATOR_NONE;
if (separator_type == UI_MENU_ITEM_SEPARATOR_NONE && !data->preview) {
for (int a = 0; a < MIN2(data->items.totitem, 30); a++) {

I don't think we should limit this to 30. There's no particular reason to expect the user to need to select an item from the first 30 more often than the others.

I don't think we should limit this to 30. There's no particular reason to expect the user to need to select an item from the first 30 more often than the others.
Harley marked this conversation as resolved
Harley Acheson force-pushed SearchWidth from 1444b4918b to a176ff2d11 2023-02-22 22:25:04 +01:00 Compare
Brecht Van Lommel approved these changes 2023-02-23 17:50:26 +01:00
Harley Acheson added 1 commit 2023-02-23 21:23:47 +01:00
Merge branch 'main' into SearchWidth
All checks were successful
buildbot/vexp-code-patch-coordinator Build done.
381e8833c5
Author
Member

@blender-bot build

@blender-bot build
Harley Acheson added 1 commit 2023-02-24 00:04:04 +01:00
Harley Acheson merged commit cfb112edcb into main 2023-02-24 00:07:27 +01:00
Harley Acheson deleted branch SearchWidth 2023-02-24 00:07:28 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
FBX
Interest
Freestyle
Interest
Geometry Nodes
Interest
glTF
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Asset System
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#104603
No description provided.