Skip to content

Commit

Permalink
We should allow HostMainWindow to be activated to support the pickers.
Browse files Browse the repository at this point in the history
  • Loading branch information
kike-garbo committed Aug 16, 2024
1 parent af8985c commit 43c101c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
17 changes: 10 additions & 7 deletions src/RhinoInside.Revit.External/ActivationGate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -440,16 +440,19 @@ protected override int DispatchHook(int nCode, IntPtr wParam, IntPtr lParam)
if (IsOpen)
{
var window = (WindowHandle) wParam;
if (HostMainWindow.Enabled && !IsExternalWindow(window, out var _))
if (HostMainWindow != window)
{
foreach (var gate in gates)
if (!HostMainWindow.Enabled && !IsExternalWindow(window, out var _))
{
try { gate.Value.Window.BringToFront(); }
catch { }
}
foreach (var gate in gates)
{
try { gate.Value.Window.BringToFront(); }
catch { }
}

windowToActivate = window; // Will be activated when our message loop is Idle.
return 1; // Prevents activation now.
windowToActivate = window; // Will be activated when our message loop is Idle.
return 1; // Prevents activation now.
}
}
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private async void UpdateOpenViewsList(object sender, ViewActivatedEventArgs e)
{
OpenViews.Clear();

// Calling GetOpenViews here is not safe, so we yeld until Idle to do so.
// Calling GetOpenViews here is not safe, so we yield until Idle to do so.
await ActivationGate.Yield();
OpenViews = new HashSet<View>(_app.Application.GetOpenViews(), ElementEqualityComparer.InterDocument);
}
Expand Down
4 changes: 0 additions & 4 deletions src/RhinoInside.Revit/Rhinoceros.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ internal static bool InitEto(Assembly assembly)
if (Eto.Forms.Application.Instance is null)
new Eto.Forms.Application(Eto.Platforms.Wpf).Attach();

#if RHINO_8
Eto.Wpf.Forms.Controls.TextBoxHandler.EnableNoGCRegionDefault = false;
#endif

return true;
}

Expand Down

0 comments on commit 43c101c

Please sign in to comment.