Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue where content of floating window is set to inactive #466

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -248,14 +248,17 @@ protected override IntPtr FilterMessage(IntPtr hwnd, int msg, IntPtr wParam, Int
switch (msg)
{
case Win32Helper.WM_ACTIVATE:
var isInactive = ((int)wParam & 0xFFFF) == Win32Helper.WA_INACTIVE;
if (_model.IsSinglePane)
{
LayoutFloatingWindowControlHelper.ActiveTheContentOfSinglePane(this, !isInactive);
}
else
{
LayoutFloatingWindowControlHelper.ActiveTheContentOfMultiPane(this, !isInactive);
var isActive = ((int)wParam & 0xFFFF) != Win32Helper.WA_INACTIVE;
if (isActive)
{
if (_model.IsSinglePane)
{
LayoutFloatingWindowControlHelper.ActiveTheContentOfSinglePane(this);
}
else
{
LayoutFloatingWindowControlHelper.ActiveTheContentOfMultiPane(this);
}
}

handled = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,17 @@ protected override IntPtr FilterMessage(IntPtr hwnd, int msg, IntPtr wParam, Int
switch (msg)
{
case Win32Helper.WM_ACTIVATE:
var isInactive = ((int)wParam & 0xFFFF) == Win32Helper.WA_INACTIVE;
if (_model.IsSinglePane)
var isActive = ((int)wParam & 0xFFFF) != Win32Helper.WA_INACTIVE;
if (isActive)
{
LayoutFloatingWindowControlHelper.ActiveTheContentOfSinglePane(this, !isInactive);
}
else
{
LayoutFloatingWindowControlHelper.ActiveTheContentOfMultiPane(this, !isInactive);
if (_model.IsSinglePane)
{
LayoutFloatingWindowControlHelper.ActiveTheContentOfSinglePane(this);
}
else
{
LayoutFloatingWindowControlHelper.ActiveTheContentOfMultiPane(this);
}
}

handled = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ internal static class LayoutFloatingWindowControlHelper
{
private const string Excp_NotSupportedFloatingWindowType = "Not Supported Floating Window Type: {0}";

public static void ActiveTheContentOfSinglePane<T>(T fwc, bool isActive) where T : LayoutFloatingWindowControl
public static void ActiveTheContentOfSinglePane<T>(T fwc, bool isActive = true) where T : LayoutFloatingWindowControl
{
ILayoutContentSelector selector = null;
if (fwc is LayoutAnchorableFloatingWindowControl)
Expand Down Expand Up @@ -52,7 +52,7 @@ public static void ActiveTheContentOfSinglePane<T>(T fwc, bool isActive) where T
}
}

public static void ActiveTheContentOfMultiPane<T>(T fwc, bool isActive) where T : LayoutFloatingWindowControl
public static void ActiveTheContentOfMultiPane<T>(T fwc, bool isActive = true) where T : LayoutFloatingWindowControl
{
if (isActive)
{
Expand Down
7 changes: 7 additions & 0 deletions source/TestApp/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@
Foreground="White"
Text="{Binding TestTimer, Mode=OneWay, StringFormat='Document 2 Attached to Timer ->\{0\}'}" />
</LayoutDocument>
<LayoutDocument Title="Document 3" ContentId="document3">
<Button
Margin="25"
VerticalAlignment="Top"
Click="ShowMessageBox_click"
Content="Click to open message box" />
</LayoutDocument>
</LayoutDocumentPane>
</LayoutDocumentPaneGroup>
<LayoutAnchorablePaneGroup DockWidth="50">
Expand Down
2 changes: 2 additions & 0 deletions source/TestApp/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,5 +262,7 @@ private void OnNewFloatingWindow(object sender, RoutedEventArgs e)
anchorable.AddToLayout(dockManager,AnchorableShowStrategy.Most);
anchorable.Float();
}

private void ShowMessageBox_click(object sender, RoutedEventArgs e) => MessageBox.Show("Test messge", "Test");
}
}