diff --git a/src/source.cc b/src/source.cc index fb223b8..24c3d1a 100644 --- a/src/source.cc +++ b/src/source.cc @@ -794,18 +794,21 @@ void Source::ClangViewParse::update_types() { } bool Source::ClangViewParse::on_motion_notify_event(GdkEventMotion* event) { - 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(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(); + } } - + on_motion_last_x=event->x; + on_motion_last_y=event->y; return Source::View::on_motion_notify_event(event); } diff --git a/src/source.h b/src/source.h index ee4a4ec..c374dfc 100644 --- a/src/source.h +++ b/src/source.h @@ -132,6 +132,8 @@ namespace Source { Tooltips diagnostic_tooltips; Tooltips type_tooltips; bool on_motion_notify_event(GdkEventMotion* event); + gdouble on_motion_last_x; + gdouble on_motion_last_y; void on_mark_set(const Gtk::TextBuffer::iterator& iterator, const Glib::RefPtr& mark); bool on_scroll_event(GdkEventScroll* event);