Browse Source

Fix window activation.

pull/39/head
Steven Kirk 12 years ago
parent
commit
3ef1114187
  1. 7
      Windows/Perspex.Win32/Interop/UnmanagedMethods.cs
  2. 11
      Windows/Perspex.Win32/WindowImpl.cs

7
Windows/Perspex.Win32/Interop/UnmanagedMethods.cs

@ -190,6 +190,13 @@ namespace Perspex.Win32.Interop
SM_SYSTEMDOCKED = 0x2004, SM_SYSTEMDOCKED = 0x2004,
} }
public enum WindowActivate
{
WA_INACTIVE,
WA_ACTIVE,
WA_CLICKACTIVE,
}
[Flags] [Flags]
public enum WindowStyles : uint public enum WindowStyles : uint
{ {

11
Windows/Perspex.Win32/WindowImpl.cs

@ -163,17 +163,20 @@ namespace Perspex.Win32
switch ((UnmanagedMethods.WindowsMessage)msg) switch ((UnmanagedMethods.WindowsMessage)msg)
{ {
case UnmanagedMethods.WindowsMessage.WM_ACTIVATE: case UnmanagedMethods.WindowsMessage.WM_ACTIVATE:
switch ((int)lParam & 0xffff) var wa = (UnmanagedMethods.WindowActivate)((int)wParam & 0xffff);
switch (wa)
{ {
case 1: case UnmanagedMethods.WindowActivate.WA_ACTIVE:
case 2: case UnmanagedMethods.WindowActivate.WA_CLICKACTIVE:
if (this.Activated != null) if (this.Activated != null)
{ {
this.Activated(); this.Activated();
} }
break; break;
case 0:
case UnmanagedMethods.WindowActivate.WA_INACTIVE:
if (this.Deactivated != null) if (this.Deactivated != null)
{ {
this.Deactivated(); this.Deactivated();

Loading…
Cancel
Save