From eedb344d7ea3408fa1bd73e1a2ad3594a8e33cc4 Mon Sep 17 00:00:00 2001 From: "U-olece-PC\\olece" Date: Sat, 22 Aug 2015 14:31:11 +0200 Subject: [PATCH] Fixed tooltip issue on Windows. --- src/source.cc | 25 ++++++++++++++----------- src/source.h | 2 ++ 2 files changed, 16 insertions(+), 11 deletions(-) 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);