Small cleanup in FramedCurve.
[ardour.git] / libs / canvas / canvas.cc
index c6c4aed20c77638455d74c89b6c9160fec15d994..22c586090ed123d6a907af4a78b361c23c828821 100644 (file)
@@ -32,6 +32,8 @@
 #include <gtkmm/label.h>
 #include <gtkmm/window.h>
 
+#include "gtkmm2ext/persistent_tooltip.h"
+
 #include "pbd/compose.h"
 #include "pbd/stacktrace.h"
 
@@ -389,6 +391,7 @@ GtkCanvas::GtkCanvas ()
        , _single_exposure (1)
        , current_tooltip_item (0)
        , tooltip_window (0)
+       , _in_dtor (false)
 {
        /* these are the events we want to know about */
        add_events (Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::POINTER_MOTION_MASK |
@@ -779,6 +782,10 @@ GtkCanvas::on_size_allocate (Gtk::Allocation& a)
 bool
 GtkCanvas::on_expose_event (GdkEventExpose* ev)
 {
+       if (_in_dtor) {
+               return true;
+       }
+
 #ifdef OPTIONAL_CAIRO_IMAGE_SURFACE
        Cairo::RefPtr<Cairo::Context> draw_context;
        Cairo::RefPtr<Cairo::Context> window_context;
@@ -914,7 +921,7 @@ GtkCanvas::on_button_press_event (GdkEventButton* ev)
           for scroll if this GtkCanvas is in a GtkCanvasViewport.
        */
 
-       DEBUG_TRACE (PBD::DEBUG::CanvasEvents, string_compose ("canvas button press @ %1, %2 => %3\n", ev->x, ev->y, where));
+       DEBUG_TRACE (PBD::DEBUG::CanvasEvents, string_compose ("canvas button press %1 @ %2, %3 => %4\n", ev->button, ev->x, ev->y, where));
        return deliver_event (reinterpret_cast<GdkEvent*>(&copy));
 }
 
@@ -940,7 +947,7 @@ GtkCanvas::on_button_release_event (GdkEventButton* ev)
           for scroll if this GtkCanvas is in a GtkCanvasViewport.
        */
 
-       DEBUG_TRACE (PBD::DEBUG::CanvasEvents, string_compose ("canvas button release @ %1, %2 => %3\n", ev->x, ev->y, where));
+       DEBUG_TRACE (PBD::DEBUG::CanvasEvents, string_compose ("canvas button release %1 @ %2, %3 => %4\n", ev->button, ev->x, ev->y, where));
        return deliver_event (reinterpret_cast<GdkEvent*>(&copy));
 }
 
@@ -1039,6 +1046,10 @@ GtkCanvas::on_leave_notify_event (GdkEventCrossing* ev)
 void
 GtkCanvas::request_redraw (Rect const & request)
 {
+       if (_in_dtor) {
+               return;
+       }
+
        Rect real_area;
 
        Coord const w = width ();
@@ -1136,7 +1147,7 @@ GtkCanvas::start_tooltip_timeout (Item* item)
 {
        stop_tooltip_timeout ();
 
-       if (item) {
+       if (item && Gtkmm2ext::PersistentTooltip::tooltips_enabled ()) {
                current_tooltip_item = item;
 
                /* wait for the first idle that happens after this is
@@ -1152,7 +1163,7 @@ GtkCanvas::start_tooltip_timeout (Item* item)
 bool
 GtkCanvas::really_start_tooltip_timeout ()
 {
-       /* an idle has occured since we entered a tooltip-bearing widget. Now
+       /* an idle has occurred since we entered a tooltip-bearing widget. Now
         * wait 1 second and if the timeout isn't cancelled, show the tooltip.
         */