fix carbon GUI focus/re-exposure

This commit is contained in:
Robin Gareus 2015-02-27 19:43:19 +01:00
parent 24efaa2992
commit e77e7f1f3d
2 changed files with 22 additions and 2 deletions

View File

@ -35,6 +35,7 @@
#undef verify
#include <gtkmm/box.h>
#include <gtkmm/eventbox.h>
#include <gtkmm/combobox.h>
#include <gtkmm/button.h>
#include <gtkmm/label.h>
@ -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;

View File

@ -210,7 +210,10 @@ AUPluginUI::AUPluginUI (boost::shared_ptr<PluginInsert> 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 ()
{