Skip to content

Commit 2e4b6a1

Browse files
committed
fix another toolbar bug
1 parent 12056c0 commit 2e4b6a1

1 file changed

Lines changed: 32 additions & 29 deletions

File tree

FlashpointSecurePlayer/WebBrowserMode.cs

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -36,35 +36,6 @@ private bool CanShowToolbar {
3636
}
3737
}
3838

39-
private void ShowToolbar() {
40-
// this is checked in LowLevelMouseProc because
41-
// otherwise plugins such as Viscape which
42-
// create their own window can steal the
43-
// mouse move event
44-
// it cannot happen in PreFilterMessage!
45-
// our window may not even get these messages
46-
// all that matters is the mouse position, regardless
47-
// of if our window is active
48-
Point toolBarToolStripMousePosition = toolBarToolStrip.PointToClient(MousePosition);
49-
50-
if (toolBarToolStrip.Visible) {
51-
if (!toolBarToolStrip.ClientRectangle.Contains(toolBarToolStripMousePosition)) {
52-
// the standard layout when the mouse is not in the toolbar rectangle
53-
// if in fullscreen, ensure toolbar is invisible
54-
// if not in fullscreen, ensure toolbar is visible
55-
toolBarToolStrip.Visible = !Fullscreen;
56-
}
57-
} else {
58-
if (toolBarToolStripMousePosition.Y == 0
59-
&& toolBarToolStrip.ClientRectangle.Contains(toolBarToolStripMousePosition)) {
60-
// mouse in toolbar rectangle
61-
// if in fullscreen, show toolbar if we can
62-
// if not in fullscreen, ensure toolbar is visible
63-
toolBarToolStrip.Visible = CanShowToolbar || !Fullscreen;
64-
}
65-
}
66-
}
67-
6839
private readonly HookProc lowLevelMouseProc;
6940
private IntPtr mouseHook = IntPtr.Zero;
7041

@@ -478,6 +449,35 @@ static public void DeactivateMode() {
478449
}
479450
}
480451

452+
private void ShowToolbar() {
453+
// this is checked in LowLevelMouseProc because
454+
// otherwise plugins such as Viscape which
455+
// create their own window can steal the
456+
// mouse move event
457+
// it cannot happen in PreFilterMessage!
458+
// our window may not even get these messages
459+
// all that matters is the mouse position, regardless
460+
// of if our window is active
461+
Point toolBarToolStripMousePosition = toolBarToolStrip.PointToClient(MousePosition);
462+
463+
if (toolBarToolStrip.Visible) {
464+
if (!toolBarToolStrip.ClientRectangle.Contains(toolBarToolStripMousePosition)) {
465+
// the standard layout when the mouse is not in the toolbar rectangle
466+
// if in fullscreen, ensure toolbar is invisible
467+
// if not in fullscreen, ensure toolbar is visible
468+
toolBarToolStrip.Visible = !Fullscreen;
469+
}
470+
} else {
471+
if (toolBarToolStripMousePosition.Y == 0
472+
&& toolBarToolStrip.ClientRectangle.Contains(toolBarToolStripMousePosition)) {
473+
// mouse in toolbar rectangle
474+
// if in fullscreen, show toolbar if we can
475+
// if not in fullscreen, ensure toolbar is visible
476+
toolBarToolStrip.Visible = CanShowToolbar || !Fullscreen;
477+
}
478+
}
479+
}
480+
481481
private bool addressToolStripSpringTextBoxEntered = false;
482482

483483
public void AddressInvalid() {
@@ -784,6 +784,9 @@ private void WebBrowserMode_Deactivate(object sender, EventArgs e) {
784784
if (CanFocus) {
785785
// the new window is not a dialog that prevents focus to this window
786786
Fullscreen = false;
787+
} else {
788+
// the new window is a dialog that does not prevent focus to this window
789+
CanShowToolbar = false;
787790
}
788791
return;
789792
}

0 commit comments

Comments
 (0)