Fix mouse capture when picking texture in visual mode, on Mono Winforms (#1073)

This commit is contained in:
samwiddowson 2024-06-30 09:58:30 +01:00 committed by GitHub
parent 98a36017ae
commit efacbef45a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 32 additions and 2 deletions

View file

@ -408,6 +408,9 @@ namespace CodeImp.DoomBuilder.Controls
protected override void OnMouseDoubleClick(MouseEventArgs e) protected override void OnMouseDoubleClick(MouseEventArgs e)
{ {
base.OnMouseDoubleClick(e); base.OnMouseDoubleClick(e);
//TODO: testing this on Windows, it looks like General.Interface.CtrlState and
// General.Interface.ShiftState are always false, because as the main window
// doesn't have focus and won't update these states
if(General.Interface.CtrlState || General.Interface.ShiftState || selection.Count != 1) if(General.Interface.CtrlState || General.Interface.ShiftState || selection.Count != 1)
return; return;

View file

@ -4158,14 +4158,41 @@ namespace CodeImp.DoomBuilder.Windows
// Returns the new texture name or the same texture name when cancelled // Returns the new texture name or the same texture name when cancelled
public string BrowseTexture(IWin32Window owner, string initialvalue) public string BrowseTexture(IWin32Window owner, string initialvalue)
{ {
return TextureBrowserForm.Browse(owner, initialvalue, false);//mxd
DisableProcessing();
#if MONO_WINFORMS
//Mono's Winforms treat dialogs a little differently
// they don't implicitly take focus from the parent window
// and keyboard input from focus window isn't reset when the dialog takes focus
BreakExclusiveMouseInput();
ReleaseAllKeys();
#endif
string tex = TextureBrowserForm.Browse(owner, initialvalue, false);//mxd
#if MONO_WINFORMS
ResumeExclusiveMouseInput();
#endif
EnableProcessing();
return tex;
} }
// This browses for a flat // This browses for a flat
// Returns the new flat name or the same flat name when cancelled // Returns the new flat name or the same flat name when cancelled
public string BrowseFlat(IWin32Window owner, string initialvalue) public string BrowseFlat(IWin32Window owner, string initialvalue)
{ {
return TextureBrowserForm.Browse(owner, initialvalue, true); //mxd. was FlatBrowserForm DisableProcessing();
#if MONO_WINFORMS
//Mono's Winforms treat dialogs a little differently
// they don't implicitly take focus from the parent window
// and keyboard input from focus window isn't reset when the dialog takes focus
BreakExclusiveMouseInput();
ReleaseAllKeys();
#endif
string tex = TextureBrowserForm.Browse(owner, initialvalue, true); //mxd. was FlatBrowserForm
#if MONO_WINFORMS
ResumeExclusiveMouseInput();
#endif
EnableProcessing();
return tex;
} }
// This browses the lindef types // This browses the lindef types