summaryrefslogtreecommitdiff
path: root/libs/canvas/canvas.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-03-20 16:31:42 +0100
committerRobin Gareus <robin@gareus.org>2017-03-20 17:12:08 +0100
commit60a0b8f6458b15fd6f1a282010ad8d1b2aabf86a (patch)
tree36e50c2b87c0d4a8951fdc2c0ab68cc6a33aad5a /libs/canvas/canvas.cc
parentc0828792f0877690bd29bb7f98ec0e6577112d30 (diff)
Forward un/map events to NSGLView
Diffstat (limited to 'libs/canvas/canvas.cc')
-rw-r--r--libs/canvas/canvas.cc29
1 files changed, 29 insertions, 0 deletions
diff --git a/libs/canvas/canvas.cc b/libs/canvas/canvas.cc
index 6ad4200cc1..9e47792758 100644
--- a/libs/canvas/canvas.cc
+++ b/libs/canvas/canvas.cc
@@ -1111,6 +1111,35 @@ GtkCanvas::on_leave_notify_event (GdkEventCrossing* ev)
return true;
}
+void
+GtkCanvas::on_map ()
+{
+ Gtk::EventBox::on_map();
+#ifdef __APPLE__
+ if (_nsglview) {
+ Gtkmm2ext::nsglview_set_visible (_nsglview, true);
+ Gtk::Allocation a = get_allocation();
+ gint xx, yy;
+ gtk_widget_translate_coordinates(
+ GTK_WIDGET(gobj()),
+ GTK_WIDGET(get_toplevel()->gobj()),
+ 0, 0, &xx, &yy);
+ Gtkmm2ext::nsglview_resize (_nsglview, xx, yy, a.get_width(), a.get_height());
+ }
+#endif
+}
+
+void
+GtkCanvas::on_unmap ()
+{
+ Gtk::EventBox::on_unmap();
+#ifdef __APPLE__
+ if (_nsglview) {
+ Gtkmm2ext::nsglview_set_visible (_nsglview, false);
+ }
+#endif
+}
+
/** Called to request a redraw of our canvas.
* @param area Area to redraw, in window coordinates.
*/