From e77e7f1f3d8e599f6df8c2c480745cbbab7e1e85 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 27 Feb 2015 19:43:19 +0100 Subject: fix carbon GUI focus/re-exposure --- gtk2_ardour/au_pluginui.h | 5 ++++- gtk2_ardour/au_pluginui.mm | 19 ++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/au_pluginui.h b/gtk2_ardour/au_pluginui.h index 71c81dfde3..bc1ce4ce21 100644 --- a/gtk2_ardour/au_pluginui.h +++ b/gtk2_ardour/au_pluginui.h @@ -35,6 +35,7 @@ #undef verify #include +#include #include #include #include @@ -74,6 +75,8 @@ class AUPluginUI : public PlugUIBase, public Gtk::VBox bool non_gtk_gui() const { return true; } void lower_box_realized (); + bool lower_box_visibility_notify (GdkEventVisibility*); + void cocoa_view_resized (); void on_realize (); void grab_focus(); @@ -91,7 +94,7 @@ class AUPluginUI : public PlugUIBase, public Gtk::VBox int prefwidth; Gtk::HBox top_box; - Gtk::HBox low_box; + Gtk::EventBox low_box; Gtk::VBox vpacker; Gtk::Label automation_mode_label; Gtk::ComboBoxText automation_mode_selector; diff --git a/gtk2_ardour/au_pluginui.mm b/gtk2_ardour/au_pluginui.mm index a577df9ab7..2dc468e500 100644 --- a/gtk2_ardour/au_pluginui.mm +++ b/gtk2_ardour/au_pluginui.mm @@ -210,7 +210,10 @@ AUPluginUI::AUPluginUI (boost::shared_ptr insert) create_cocoa_view (); } + low_box.add_events(Gdk::VISIBILITY_NOTIFY_MASK); + low_box.signal_realize().connect (mem_fun (this, &AUPluginUI::lower_box_realized)); + low_box.signal_visibility_notify_event ().connect (mem_fun (this, &AUPluginUI::lower_box_visibility_notify)); } AUPluginUI::~AUPluginUI () @@ -496,7 +499,7 @@ AUPluginUI::create_carbon_view () kWindowNoShadowAttribute| kWindowNoTitleBarAttribute); - if ((err = CreateNewWindow(kDocumentWindowClass, attr, &r, &carbon_window)) != noErr) { + if ((err = CreateNewWindow(kUtilityWindowClass, attr, &r, &carbon_window)) != noErr) { error << string_compose (_("AUPluginUI: cannot create carbon window (err: %1)"), err) << endmsg; CloseComponent (editView); return -1; @@ -626,6 +629,7 @@ AUPluginUI::parent_carbon_window () _notify = [ [NotificationObject alloc] initWithPluginUI:this andCocoaParent:cocoa_parent andTopLevelParent:win ]; [win addChildWindow:cocoa_parent ordered:NSWindowAbove]; + [win setAutodisplay:1]; // turn of GTK stuff for this window return 0; #else @@ -729,6 +733,19 @@ AUPluginUI::lower_box_realized () } } +bool +AUPluginUI::lower_box_visibility_notify (GdkEventVisibility* ev) +{ +#ifdef WITH_CARBON + if (carbon_window && ev->state != GDK_VISIBILITY_UNOBSCURED) { + ShowWindow (carbon_window); + ActivateWindow (carbon_window, TRUE); + return true; + } +#endif + return false; +} + void AUPluginUI::on_window_hide () { -- cgit v1.2.3