diff options
author | Robin Gareus <robin@gareus.org> | 2017-03-20 16:31:42 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-03-20 17:12:08 +0100 |
commit | 60a0b8f6458b15fd6f1a282010ad8d1b2aabf86a (patch) | |
tree | 36e50c2b87c0d4a8951fdc2c0ab68cc6a33aad5a /libs/canvas | |
parent | c0828792f0877690bd29bb7f98ec0e6577112d30 (diff) |
Forward un/map events to NSGLView
Diffstat (limited to 'libs/canvas')
-rw-r--r-- | libs/canvas/canvas.cc | 29 | ||||
-rw-r--r-- | libs/canvas/canvas/canvas.h | 6 |
2 files changed, 33 insertions, 2 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. */ diff --git a/libs/canvas/canvas/canvas.h b/libs/canvas/canvas/canvas.h index 3e554cacf2..60e75bf8bf 100644 --- a/libs/canvas/canvas/canvas.h +++ b/libs/canvas/canvas/canvas.h @@ -221,8 +221,10 @@ public: bool on_button_press_event (GdkEventButton *); bool on_button_release_event (GdkEventButton* event); bool on_motion_notify_event (GdkEventMotion *); - bool on_enter_notify_event (GdkEventCrossing*); - bool on_leave_notify_event (GdkEventCrossing*); + bool on_enter_notify_event (GdkEventCrossing*); + bool on_leave_notify_event (GdkEventCrossing*); + void on_map(); + void on_unmap(); void on_realize (); |