UI: Fixed menustrips/toolstrips not responding to first click when window was out of focus

This commit is contained in:
Sour 2018-02-23 11:30:37 -05:00
parent ea99b8a792
commit 608880e6a3
12 changed files with 70 additions and 22 deletions

View file

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Mesen.GUI.Controls
{
public class ctrlMesenMenuStrip : MenuStrip
{
private const int WM_MOUSEACTIVATE = 0x21;
protected override void WndProc(ref Message m)
{
if(m.Msg == WM_MOUSEACTIVATE && this.CanFocus && !this.Focused) {
this.Focus();
}
base.WndProc(ref m);
}
}
}

View file

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Mesen.GUI.Controls
{
public class ctrlMesenToolStrip : ToolStrip
{
private const int WM_MOUSEACTIVATE = 0x21;
protected override void WndProc(ref Message m)
{
if(m.Msg == WM_MOUSEACTIVATE && this.CanFocus && !this.Focused) {
this.Focus();
}
base.WndProc(ref m);
}
}
}

View file

@ -56,7 +56,7 @@
this.mnuSelectAll = new System.Windows.Forms.ToolStripMenuItem();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.ctrlHexBox = new Be.Windows.Forms.HexBox();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.menuStrip1 = new Mesen.GUI.Controls.ctrlMesenMenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mnuClose = new System.Windows.Forms.ToolStripMenuItem();
this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -581,7 +581,7 @@
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Button btnExecute;
private FastColoredTextBoxNS.FastColoredTextBox txtCode;
private System.Windows.Forms.MenuStrip menuStrip1;
private Mesen.GUI.Controls.ctrlMesenMenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem mnuClose;
private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem;

View file

@ -50,7 +50,7 @@ namespace Mesen.GUI.Debugger
this.ctrlBreakpoints = new Mesen.GUI.Debugger.Controls.ctrlBreakpoints();
this.grpCallstack = new System.Windows.Forms.GroupBox();
this.ctrlCallstack = new Mesen.GUI.Debugger.Controls.ctrlCallstack();
this.menuStrip = new System.Windows.Forms.MenuStrip();
this.menuStrip = new Mesen.GUI.Controls.ctrlMesenMenuStrip();
this.mnuFile = new System.Windows.Forms.ToolStripMenuItem();
this.mnuSaveRom = new System.Windows.Forms.ToolStripMenuItem();
this.mnuSaveRomAs = new System.Windows.Forms.ToolStripMenuItem();
@ -169,7 +169,7 @@ namespace Mesen.GUI.Debugger
this.lblCyclesElapsed = new System.Windows.Forms.ToolStripStatusLabel();
this.ctrlPpuMemoryMapping = new Mesen.GUI.Debugger.Controls.ctrlMemoryMapping();
this.ctrlCpuMemoryMapping = new Mesen.GUI.Debugger.Controls.ctrlMemoryMapping();
this.tsToolbar = new System.Windows.Forms.ToolStrip();
this.tsToolbar = new Mesen.GUI.Controls.ctrlMesenToolStrip();
this.mnuShowMemoryValues = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
this.splitContainer.Panel1.SuspendLayout();
@ -1545,7 +1545,7 @@ namespace Mesen.GUI.Debugger
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel10;
private System.Windows.Forms.GroupBox grpBreakpoints;
private System.Windows.Forms.GroupBox grpWatch;
private System.Windows.Forms.MenuStrip menuStrip;
private Mesen.GUI.Controls.ctrlMesenMenuStrip menuStrip;
private System.Windows.Forms.ToolStripMenuItem mnuFile;
private System.Windows.Forms.ToolStripMenuItem debugToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem mnuContinue;
@ -1674,7 +1674,7 @@ namespace Mesen.GUI.Debugger
private System.Windows.Forms.ToolStripMenuItem mnuShowVerifiedData;
private System.Windows.Forms.ToolStripMenuItem mnuShowUnidentifiedData;
private System.Windows.Forms.ToolStripMenuItem mnuConfigureColors;
private System.Windows.Forms.ToolStrip tsToolbar;
private Mesen.GUI.Controls.ctrlMesenToolStrip tsToolbar;
private System.Windows.Forms.ToolStripMenuItem mnuShowToolbar;
private System.Windows.Forms.ToolStripMenuItem mnuPpuShowPreviousFrame;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem19;

View file

@ -46,7 +46,7 @@
this.chkShowPpuRegisterWrites = new System.Windows.Forms.CheckBox();
this.chkShowMapperRegisterWrites = new System.Windows.Forms.CheckBox();
this.chkShowSpriteZero = new System.Windows.Forms.CheckBox();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.menuStrip1 = new Mesen.GUI.Controls.ctrlMesenMenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mnuClose = new System.Windows.Forms.ToolStripMenuItem();
this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -333,7 +333,7 @@
private System.Windows.Forms.TabControl tabMain;
private System.Windows.Forms.TabPage tpgPpuView;
private Controls.ctrlEventViewerPpuView ctrlEventViewerPpuView;
private System.Windows.Forms.MenuStrip menuStrip1;
private Mesen.GUI.Controls.ctrlMesenMenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem mnuClose;
private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem;

View file

@ -35,7 +35,7 @@
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.lblViewMemoryType = new System.Windows.Forms.Label();
this.cboMemoryType = new Mesen.GUI.Debugger.Controls.ComboBoxWithSeparator();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.menuStrip1 = new Mesen.GUI.Controls.ctrlMesenMenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mnuImport = new System.Windows.Forms.ToolStripMenuItem();
this.mnuExport = new System.Windows.Forms.ToolStripMenuItem();
@ -771,7 +771,7 @@
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.Label lblViewMemoryType;
private Mesen.GUI.Debugger.Controls.ComboBoxWithSeparator cboMemoryType;
private System.Windows.Forms.MenuStrip menuStrip1;
private Mesen.GUI.Controls.ctrlMesenMenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem mnuFind;
private System.Windows.Forms.ToolStripMenuItem mnuFindNext;

View file

@ -33,7 +33,7 @@ namespace Mesen.GUI.Debugger
/// </summary>
private void InitializeComponent()
{
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.menuStrip1 = new Mesen.GUI.Controls.ctrlMesenMenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mnuClose = new System.Windows.Forms.ToolStripMenuItem();
this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -352,7 +352,7 @@ namespace Mesen.GUI.Debugger
#endregion
private System.Windows.Forms.MenuStrip menuStrip1;
private Mesen.GUI.Controls.ctrlMesenMenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem mnuClose;
private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem;

View file

@ -32,7 +32,7 @@
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.mnuMain = new System.Windows.Forms.MenuStrip();
this.mnuMain = new Mesen.GUI.Controls.ctrlMesenMenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mnuNewScript = new System.Windows.Forms.ToolStripMenuItem();
this.mnuOpen = new System.Windows.Forms.ToolStripMenuItem();
@ -59,7 +59,7 @@
this.mnuBlankWindow = new System.Windows.Forms.ToolStripMenuItem();
this.mnuTutorialScript = new System.Windows.Forms.ToolStripMenuItem();
this.mnuAutoLoadLastScript = new System.Windows.Forms.ToolStripMenuItem();
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.toolStrip1 = new Mesen.GUI.Controls.ctrlMesenToolStrip();
this.btnOpen = new System.Windows.Forms.ToolStripButton();
this.btnSave = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
@ -568,10 +568,10 @@
#endregion
private System.Windows.Forms.MenuStrip mnuMain;
private Mesen.GUI.Controls.ctrlMesenMenuStrip mnuMain;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem mnuOpen;
private System.Windows.Forms.ToolStrip toolStrip1;
private Mesen.GUI.Controls.ctrlMesenToolStrip toolStrip1;
private System.Windows.Forms.ToolStripButton btnRun;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem mnuClose;

View file

@ -56,7 +56,7 @@
this.grpExecutionLog = new System.Windows.Forms.GroupBox();
this.txtTraceLog = new Mesen.GUI.Debugger.ctrlScrollableTextbox();
this.tmrUpdateLog = new System.Windows.Forms.Timer(this.components);
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.menuStrip1 = new Mesen.GUI.Controls.ctrlMesenMenuStrip();
this.showToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.logLinesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mnu100Lines = new System.Windows.Forms.ToolStripMenuItem();
@ -567,7 +567,7 @@
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3;
private System.Windows.Forms.Timer tmrUpdateLog;
private System.Windows.Forms.GroupBox grpExecutionLog;
private System.Windows.Forms.MenuStrip menuStrip1;
private Mesen.GUI.Controls.ctrlMesenMenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem showToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem logLinesToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem mnuAutoRefresh;

View file

@ -45,7 +45,7 @@ namespace Mesen.GUI.Forms.Cheats
this.mnuAddCheat = new System.Windows.Forms.ToolStripMenuItem();
this.mnuDeleteCheat = new System.Windows.Forms.ToolStripMenuItem();
this.mnuExportSelectedCheats = new System.Windows.Forms.ToolStripMenuItem();
this.tsCheatActions = new System.Windows.Forms.ToolStrip();
this.tsCheatActions = new Mesen.GUI.Controls.ctrlMesenToolStrip();
this.btnAddCheat = new System.Windows.Forms.ToolStripButton();
this.btnDelete = new System.Windows.Forms.ToolStripSplitButton();
this.btnDeleteCheat = new System.Windows.Forms.ToolStripMenuItem();
@ -463,7 +463,7 @@ namespace Mesen.GUI.Forms.Cheats
private System.Windows.Forms.ToolStripMenuItem mnuDeleteCheat;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.ToolStrip tsCheatActions;
private Mesen.GUI.Controls.ctrlMesenToolStrip tsCheatActions;
private System.Windows.Forms.ToolStripButton btnAddCheat;
private System.Windows.Forms.CheckBox chkDisableCheats;
private System.Windows.Forms.ListView lstGameList;

View file

@ -40,7 +40,7 @@ namespace Mesen.GUI.Forms
this.ctrlRecentGames = new Mesen.GUI.Controls.ctrlRecentGames();
this.ctrlNsfPlayer = new Mesen.GUI.Controls.ctrlNsfPlayer();
this.ctrlRenderer = new Mesen.GUI.Controls.ctrlRenderer();
this.menuStrip = new System.Windows.Forms.MenuStrip();
this.menuStrip = new Mesen.GUI.Controls.ctrlMesenMenuStrip();
this.mnuFile = new System.Windows.Forms.ToolStripMenuItem();
this.mnuOpen = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripSeparator();
@ -1633,7 +1633,7 @@ namespace Mesen.GUI.Forms
#endregion
private System.Windows.Forms.MenuStrip menuStrip;
private Mesen.GUI.Controls.ctrlMesenMenuStrip menuStrip;
private System.Windows.Forms.ToolStripMenuItem mnuFile;
private System.Windows.Forms.ToolStripMenuItem mnuOpen;
private System.Windows.Forms.ToolStripMenuItem mnuGame;

View file

@ -272,6 +272,12 @@
<Compile Include="Controls\ctrlLoadingRom.Designer.cs">
<DependentUpon>ctrlLoadingRom.cs</DependentUpon>
</Compile>
<Compile Include="Controls\ctrlMesenMenuStrip.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Controls\ctrlMesenToolStrip.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Controls\ctrlNsfPlayer.cs">
<SubType>UserControl</SubType>
</Compile>