From 65e3fd2e1c2833293844353fe71d3425a2e10a0a Mon Sep 17 00:00:00 2001 From: Jesse van den Kieboom Date: Thu, 17 Dec 2015 23:42:46 +0100 Subject: [PATCH] Set normal cursor on diff with handles_selection --- libgitg/gitg-diff-view-hunk.vala | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/libgitg/gitg-diff-view-hunk.vala b/libgitg/gitg-diff-view-hunk.vala index b66400ed..b5bf5d2d 100644 --- a/libgitg/gitg-diff-view-hunk.vala +++ b/libgitg/gitg-diff-view-hunk.vala @@ -131,6 +131,9 @@ class Gitg.DiffViewHunk : Gtk.Grid d_sourceview_hunk.button_release_event.connect(button_release_event_on_view); d_sourceview_hunk.get_style_context().add_class("handle-selection"); + + d_sourceview_hunk.realize.connect(update_cursor); + d_sourceview_hunk.notify["state-flags"].connect(update_cursor); } update_hunk_label(); @@ -147,6 +150,17 @@ class Gitg.DiffViewHunk : Gtk.Grid update_theme(); } + private void update_cursor() { + var window = d_sourceview_hunk.get_window(Gtk.TextWindowType.TEXT); + + if (window == null) { + return; + } + + var cursor = new Gdk.Cursor.for_display(d_sourceview_hunk.get_display(), Gdk.CursorType.LEFT_PTR); + window.set_cursor(cursor); + } + private void update_theme() { var selection_attributes = new Gtk.SourceMarkAttributes();