[gtk/wip/exalm/textview-selection: 2/4] textlayout: Only special case selection rendering for opaque colors
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/exalm/textview-selection: 2/4] textlayout: Only special case selection rendering for opaque colors
- Date: Mon, 3 May 2021 17:08:36 +0000 (UTC)
commit 960414b82e89cff2e803695c60d54127c5f038d5
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Mon May 3 19:03:47 2021 +0500
textlayout: Only special case selection rendering for opaque colors
If the selection is partially transparent, it may still be desirable to
see the colors from tags underneath.
gtk/gtktextlayout.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c
index 20ef614437..c746752be5 100644
--- a/gtk/gtktextlayout.c
+++ b/gtk/gtktextlayout.c
@@ -3873,8 +3873,11 @@ render_para (GskPangoRenderer *crenderer,
if (at_last_line)
selection_height += line_display->bottom_margin;
+ /* Don't draw the text underneath if the whole line is selected. We can
+ * only do it if the selection is opaque. */
if (selection_start_index < byte_offset &&
- selection_end_index > line->length + byte_offset) /* All selected */
+ selection_end_index > line->length + byte_offset &&
+ selection->alpha >= 1)
{
gtk_snapshot_append_color (crenderer->snapshot,
selection,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]