From 9a0a2a29b53a7d8b74d64039a3a594e54262ef29 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 18 Jul 2017 21:34:03 +0200 Subject: [PATCH] Fix NSGLView invalidation --- libs/canvas/canvas.cc | 25 ++++++++++++++++++++++++- libs/canvas/canvas/canvas.h | 3 +++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/libs/canvas/canvas.cc b/libs/canvas/canvas.cc index 3c89ebd6e2..8456d44d82 100644 --- a/libs/canvas/canvas.cc +++ b/libs/canvas/canvas.cc @@ -873,7 +873,6 @@ GtkCanvas::on_expose_event (GdkEventExpose* ev) } #ifdef __APPLE__ if (_nsglview) { - Gtkmm2ext::nsglview_queue_draw (_nsglview, ev->area.x, ev->area.y, ev->area.width, ev->area.height); return true; } #endif @@ -1201,6 +1200,30 @@ GtkCanvas::on_unmap () #endif } +void +GtkCanvas::queue_draw() +{ +#ifdef __APPLE__ + if (_nsglview) { + Gtkmm2ext::nsglview_queue_draw (_nsglview, 0, 0, get_width (), get_height ()); + return; + } +#endif + Gtk::Widget::queue_draw (); +} + +void +GtkCanvas::queue_draw_area (int x, int y, int width, int height) +{ +#ifdef __APPLE__ + if (_nsglview) { + Gtkmm2ext::nsglview_queue_draw (_nsglview, x, y, width, height); + return; + } +#endif + Gtk::Widget::queue_draw_area (x, y, width, height); +} + /** Called to request a redraw of our canvas. * @param area Area to redraw, in window coordinates. */ diff --git a/libs/canvas/canvas/canvas.h b/libs/canvas/canvas/canvas.h index 6d8fd89a7a..d1521593cd 100644 --- a/libs/canvas/canvas/canvas.h +++ b/libs/canvas/canvas/canvas.h @@ -214,6 +214,9 @@ public: void start_tooltip_timeout (Item*); void stop_tooltip_timeout (); + void queue_draw (); + void queue_draw_area (int x, int y, int width, int height); + Glib::RefPtr get_pango_context(); void render (Cairo::RefPtr const & ctx, cairo_rectangle_t* r)