From 8175836db1ba1bab8319a756854bcd6cce62c580 Mon Sep 17 00:00:00 2001 From: eidheim Date: Sun, 23 Aug 2015 11:05:36 +0200 Subject: [PATCH] Added slight delay on mouse-pointer tooltips. --- src/source.cc | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/source.cc b/src/source.cc index eb2b65e..f02d005 100644 --- a/src/source.cc +++ b/src/source.cc @@ -818,16 +818,21 @@ void Source::ClangViewParse::update_types() { bool Source::ClangViewParse::on_motion_notify_event(GdkEventMotion* event) { if(on_motion_last_x!=event->x || on_motion_last_y!=event->y) { delayed_tooltips_connection.disconnect(); - if(clang_readable && event->state==0) { - Gdk::Rectangle rectangle(event->x, event->y, 1, 1); - Tooltips::init(); - type_tooltips.show(rectangle); - diagnostic_tooltips.show(rectangle); - } - else { - type_tooltips.hide(); - diagnostic_tooltips.hide(); + if(event->state==0) { + gdouble x=event->x; + gdouble y=event->y; + delayed_tooltips_connection=Glib::signal_timeout().connect([this, x, y]() { + if(clang_readable) { + Gdk::Rectangle rectangle(x, y, 1, 1); + Tooltips::init(); + type_tooltips.show(rectangle); + diagnostic_tooltips.show(rectangle); + } + return false; + }, 100); } + type_tooltips.hide(); + diagnostic_tooltips.hide(); } on_motion_last_x=event->x; on_motion_last_y=event->y;