diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2012-06-25 21:44:53 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2012-06-25 21:44:53 +0000 |
commit | 4e019c46173b06ce6565ef44a29c6267f27ca0d7 (patch) | |
tree | 80924dbc8980e90efa24890ae7b5bce176462d58 /gtk2_ardour | |
parent | 8ca5537ccb0530a7da0817f1fb4fb5127be2e5e2 (diff) |
re-enable Carbon plugin GUI support; fix misplacement of Carbon plugin GUI windows because of differences between Carbon/Cocoa/GTK coordinate spaces
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@12932 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/au_pluginui.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/au_pluginui.mm | 18 |
2 files changed, 15 insertions, 5 deletions
diff --git a/gtk2_ardour/au_pluginui.h b/gtk2_ardour/au_pluginui.h index 384203db0d..048f086511 100644 --- a/gtk2_ardour/au_pluginui.h +++ b/gtk2_ardour/au_pluginui.h @@ -4,6 +4,8 @@ #include <vector> #include <string> +#define WITH_CARBON + #ifdef WITH_CARBON #include <Carbon/Carbon.h> #include <AudioUnit/AudioUnitCarbonView.h> diff --git a/gtk2_ardour/au_pluginui.mm b/gtk2_ardour/au_pluginui.mm index 81c065ef74..075164ec06 100644 --- a/gtk2_ardour/au_pluginui.mm +++ b/gtk2_ardour/au_pluginui.mm @@ -527,7 +527,7 @@ AUPluginUI::get_nswindow () void AUPluginUI::activate () { -#ifdef WITN_CARBON +#ifdef WITH_CARBON ActivateWindow (carbon_window, TRUE); #endif // [cocoa_parent makeKeyAndOrderFront:nil]; @@ -546,7 +546,7 @@ AUPluginUI::parent_carbon_window () { #ifdef WITH_CARBON NSWindow* win = get_nswindow (); - int x, y; + Rect windowStructureBoundsRect; if (!win) { return -1; @@ -558,8 +558,12 @@ AUPluginUI::parent_carbon_window () error << _("AUPluginUI: no top level window!") << endmsg; return -1; } - - toplevel->get_window()->get_root_origin (x, y); + + /* figure out where the cocoa parent window is in carbon-coordinate space, which + differs from both cocoa-coordinate space and GTK-coordinate space + */ + + GetWindowBounds((WindowRef) [win windowRef], kWindowStructureRgn, &windowStructureBoundsRect); /* compute how tall the title bar is, because we have to offset the position of the carbon window by that much. @@ -572,7 +576,11 @@ AUPluginUI::parent_carbon_window () int packing_extra = 6; // this is the total vertical packing in our top level window - MoveWindow (carbon_window, x, y + titlebar_height + top_box.get_height() + packing_extra, false); + /* move into position, based on parent window position */ + MoveWindow (carbon_window, + windowStructureBoundsRect.left, + windowStructureBoundsRect.top + titlebar_height + top_box.get_height() + packing_extra, + false); ShowWindow (carbon_window); // create the cocoa window for the carbon one and make it visible |