Skip to content

Commit b19ac2c

Browse files
committed
disallow child windows in fullscreen
1 parent a32371e commit b19ac2c

2 files changed

Lines changed: 11 additions & 10 deletions

File tree

FlashpointSecurePlayer/Shared.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,6 @@ public enum GW : uint {
244244
[DllImport("USER32.DLL", SetLastError = true)]
245245
public static extern IntPtr GetWindow(IntPtr hWnd, GW uCmd);
246246

247-
[DllImport("USER32.DLL")]
248-
[return: MarshalAs(UnmanagedType.Bool)]
249-
public static extern bool IsChild(IntPtr hWndParent, IntPtr hWnd);
250-
251247
[DllImport("USER32.DLL", SetLastError = true)]
252248
public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
253249

FlashpointSecurePlayer/WebBrowserMode.cs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ public bool Fullscreen {
105105
return;
106106
}
107107

108+
109+
if (GetWindow(Handle, GW.GW_CHILD) != IntPtr.Zero) {
110+
value = false;
111+
}
112+
108113
if (fullscreen == value) {
109114
return;
110115
}
@@ -555,6 +560,12 @@ private void WebBrowserMode_Deactivate(object sender, EventArgs e) {
555560
Application.RemoveMessageFilter(messageFilter);
556561

557562
if (Fullscreen) {
563+
// disallow child windows in fullscreen
564+
if (GetWindow(Handle, GW.GW_CHILD) != IntPtr.Zero) {
565+
Fullscreen = false;
566+
return;
567+
}
568+
558569
IntPtr foregroundWindow = GetForegroundWindow();
559570

560571
// we are the active window, because we are only now deactivating
@@ -590,12 +601,6 @@ private void WebBrowserMode_Deactivate(object sender, EventArgs e) {
590601
}
591602
return;
592603
}
593-
594-
if (IsChild(Handle, foregroundWindow)) {
595-
// the new window is a child of this window
596-
Fullscreen = false;
597-
return;
598-
}
599604
}
600605

601606
WindowState = FormWindowState.Minimized;

0 commit comments

Comments
 (0)