Some checks failed
CI / build-and-test (push) Failing after 28s
Reparents Teams' main top-level window into a TeamsISO-owned host via Win32 SetParent + window-style stripping. Operator gets Teams visually INSIDE TeamsISO instead of as a separate window — completes the 'Teams runs within this app' direction the user asked for after auto-hide. Strictly opt-in (DISPLAY tab → 'Embed Teams window (experimental)'). Modern Teams runs WebView2 in its main window; WebView2 is sensitive to parent changes and may render glitches or refuse focus. If so, operator unticks and falls back to auto-hide mode. Implementation: - TeamsLauncher.EmbedTeamsInto(hostHwnd, w, h): finds Teams' main window (longest-title heuristic — same as GetActiveWindowTitle), saves original parent + WS_STYLE, SetParents into host, strips WS_CAPTION + WS_THICKFRAME + WS_BORDER + WS_DLGFRAME + WS_POPUP, adds WS_CHILD, MoveWindow to fit. - TeamsLauncher.RestoreEmbed(): SetParent back to desktop + restore saved window styles. Idempotent — safe to call on shutdown even if nothing was embedded. - TeamsLauncher.ResizeEmbedded(w, h): MoveWindow to new dimensions; called from host SizeChanged event. - New TeamsEmbedWindow chromeless host with an EXPERIMENTAL pill in the caption. Loaded → grab HwndSource from EmbedHost Border → call EmbedTeamsInto. SizeChanged → ResizeEmbedded. Closed → RestoreEmbed (in try/finally so a crash can't leave Teams orphaned). Friendly fallback messages if no Teams window exists or HWND grab fails. - Settings → DISPLAY → checkbox + 'Open embed window' button (gated by the checkbox). Persisted via EmbedTeamsWindow on UIPreferences.
76 lines
3.4 KiB
XML
76 lines
3.4 KiB
XML
<Window x:Class="TeamsISO.App.TeamsEmbedWindow"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:shell="clr-namespace:System.Windows.Shell;assembly=PresentationFramework"
|
|
Title="Teams (embedded)"
|
|
Icon="/Assets/teamsiso.ico"
|
|
Width="1280" Height="720"
|
|
MinWidth="640" MinHeight="360"
|
|
Background="Black"
|
|
WindowStyle="None"
|
|
ResizeMode="CanResize"
|
|
UseLayoutRounding="True">
|
|
|
|
<shell:WindowChrome.WindowChrome>
|
|
<shell:WindowChrome
|
|
CaptionHeight="32"
|
|
ResizeBorderThickness="6"
|
|
CornerRadius="0"
|
|
GlassFrameThickness="0"
|
|
UseAeroCaptionButtons="False"/>
|
|
</shell:WindowChrome.WindowChrome>
|
|
|
|
<Border BorderBrush="{DynamicResource Wd.Border}" BorderThickness="1">
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="*"/>
|
|
</Grid.RowDefinitions>
|
|
|
|
<!-- Caption with experimental warning. The X button restores
|
|
Teams' chrome before closing, never leaves Teams in a
|
|
reparented-orphan state. -->
|
|
<Grid Grid.Row="0" Background="{DynamicResource Wd.Surface}">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
</Grid.ColumnDefinitions>
|
|
<StackPanel Orientation="Horizontal" Margin="14,0,0,0">
|
|
<TextBlock Text="TEAMS (EMBEDDED)"
|
|
Style="{StaticResource Wd.Text.Caption}"
|
|
VerticalAlignment="Center"/>
|
|
<Border Style="{StaticResource Wd.Pill}"
|
|
VerticalAlignment="Center"
|
|
Margin="10,0,0,0"
|
|
Padding="8,2"
|
|
Background="{DynamicResource Wd.Accent.CoralBg}">
|
|
<TextBlock Text="experimental"
|
|
FontFamily="{StaticResource Wd.Font.Mono}"
|
|
FontSize="10"
|
|
Foreground="{DynamicResource Wd.Accent.Coral}"
|
|
VerticalAlignment="Center"/>
|
|
</Border>
|
|
</StackPanel>
|
|
<Button Grid.Column="1"
|
|
Style="{StaticResource Wd.Button.CaptionClose}"
|
|
Click="OnClose"
|
|
shell:WindowChrome.IsHitTestVisibleInChrome="True"
|
|
ToolTip="Close embed window. Teams' chrome will be restored before this window closes.">
|
|
<Path Data="M 0,0 L 10,10 M 10,0 L 0,10"
|
|
Stroke="{DynamicResource Wd.Text.Primary}"
|
|
StrokeThickness="1.2"
|
|
Width="10" Height="10"
|
|
Stretch="None"/>
|
|
</Button>
|
|
</Grid>
|
|
|
|
<!-- Embed host: the Teams window gets SetParent-reparented
|
|
into this Border's HWND on Loaded. SizeChanged drives
|
|
MoveWindow to keep Teams fitted to our bounds. -->
|
|
<Border x:Name="EmbedHost"
|
|
Grid.Row="1"
|
|
Background="Black"
|
|
SizeChanged="OnHostSizeChanged"/>
|
|
</Grid>
|
|
</Border>
|
|
</Window>
|