mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
Fix #163729: UI: Wrong list item text selection opacity
The text selection highlight in editable list items is much brighter
than expected after e2d134f9e6
`wcol_list_item.item` opacity is changed from 0.2 to 0.8 opacity for the
File Browser. To fix this, keep the current `wcol_list_item.item` color
and use lower opacity specifically when drawing text selections.
Pull Request: https://projects.blender.org/blender/blender/pulls/163741
This commit is contained in:
parent
3964afa1e3
commit
20a730de80
1 changed files with 14 additions and 2 deletions
|
|
@ -2175,6 +2175,14 @@ static void widget_draw_text_ime_underline(const uiFontStyle *fstyle,
|
|||
}
|
||||
#endif /* WITH_INPUT_IME */
|
||||
|
||||
/* Text selection uses a lower opacity than the item color.
|
||||
* See #163741 for details. */
|
||||
static void widget_text_selection_color(const uiWidgetColors *wcol, uchar color[4])
|
||||
{
|
||||
copy_v4_v4_uchar(color, wcol->item);
|
||||
color[3] = 51;
|
||||
}
|
||||
|
||||
static void widget_draw_textbox(const uiFontStyle *fstyle,
|
||||
const uiWidgetColors *wcol,
|
||||
Button *but,
|
||||
|
|
@ -2326,7 +2334,9 @@ static void widget_draw_textbox(const uiFontStyle *fstyle,
|
|||
const uint pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", gpu::VertAttrType::SFLOAT_32_32);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
immUniformColor4ubv(wcol->item);
|
||||
uchar selection_color[4];
|
||||
widget_text_selection_color(wcol, selection_color);
|
||||
immUniformColor4ubv(selection_color);
|
||||
const StringRef line = lines[selection.line];
|
||||
const Vector<Bounds<int>> boxes = BLF_str_selection_boxes(
|
||||
fstyle->uifont_id,
|
||||
|
|
@ -2639,7 +2649,9 @@ static void widget_draw_text(const uiFontStyle *fstyle,
|
|||
uint pos = GPU_vertformat_attr_add(
|
||||
immVertexFormat(), "pos", gpu::VertAttrType::SFLOAT_32_32);
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
immUniformColor4ubv(wcol->item);
|
||||
uchar selection_color[4];
|
||||
widget_text_selection_color(wcol, selection_color);
|
||||
immUniformColor4ubv(selection_color);
|
||||
const auto boxes = BLF_str_selection_boxes(
|
||||
fstyle->uifont_id,
|
||||
drawstr + but->ofs,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue