[gtksourceview] view: render highlight-current-line when window is active
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] view: render highlight-current-line when window is active
- Date: Tue, 30 Aug 2022 20:44:52 +0000 (UTC)
commit 8d4b7f18ad0ed33f4f3f2921ca79f562925f2f8d
Author: Christian Hergert <chergert redhat com>
Date: Tue Aug 30 13:15:42 2022 -0700
view: render highlight-current-line when window is active
If it is not active, then we want to be in something that is more akin to
a "backdrop" state and ignore the current line highlight.
gtksourceview/gtksourceview.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/gtksourceview/gtksourceview.c b/gtksourceview/gtksourceview.c
index 80c3a279..cddbe44a 100644
--- a/gtksourceview/gtksourceview.c
+++ b/gtksourceview/gtksourceview.c
@@ -2718,6 +2718,8 @@ gtk_source_view_snapshot_layer (GtkTextView *text_view,
if (layer == GTK_TEXT_VIEW_LAYER_BELOW_TEXT)
{
+ GtkRoot *root;
+
/* Now draw the background pattern, which might draw above the
* right-margin area for additional texture. We can't really optimize
* these too much since they move every scroll. Otherwise we'd move
@@ -2729,9 +2731,15 @@ gtk_source_view_snapshot_layer (GtkTextView *text_view,
gtk_source_view_paint_background_pattern_grid (view, snapshot);
}
+ /* Only draw the line hightlight on the active window and if
+ * we are sensitive to keyboard input.
+ */
if (gtk_widget_is_sensitive (GTK_WIDGET (view)) &&
priv->highlight_current_line &&
- priv->current_line_background_color_set)
+ priv->current_line_background_color_set &&
+ (root = gtk_widget_get_root (GTK_WIDGET (view))) &&
+ GTK_IS_WINDOW (root) &&
+ gtk_window_is_active (GTK_WINDOW (root)))
{
gtk_source_view_paint_current_line_highlight (view, snapshot);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]