Fix cursor visible on Linux when in 3D mode

This commit is contained in:
Magnus Norddahl 2020-09-13 23:43:11 +02:00
parent b740cadc13
commit 90831bd630
3 changed files with 26 additions and 4 deletions

View file

@ -34,6 +34,7 @@ namespace CodeImp.DoomBuilder.Actions
private RawMouse mouse;
private bool firstProcess = true;
private Point lastPos = new Point();
private Control source;
#endregion
@ -42,6 +43,8 @@ namespace CodeImp.DoomBuilder.Actions
// Constructor
public MouseInput(Control source)
{
this.source = source;
// Start mouse input
try
{
@ -88,7 +91,7 @@ namespace CodeImp.DoomBuilder.Actions
{
Point pos = Cursor.Position;
Rectangle clipBox = Cursor.Clip;
Rectangle clipBox = source.RectangleToScreen(source.ClientRectangle); //Cursor.Clip;
Cursor.Position = new Point(clipBox.X + clipBox.Width / 2, clipBox.Y + clipBox.Height / 2);
if (firstProcess)

View file

@ -1230,7 +1230,21 @@ namespace CodeImp.DoomBuilder.Windows
Cursor.Position = display.PointToScreen(new Point(display.ClientSize.Width / 2, display.ClientSize.Height / 2)); //mxd
Cursor.Clip = display.RectangleToScreen(display.ClientRectangle);
Cursor.Hide();
this.menumain.Enabled = false;
#if MONO_WINFORMS
// A beautiful transparent cursor, just for you mono!
string emptycursor =
"AAACAAEAICACAAAAAAAwAQAAFgAAACgAAAAgAAAAQAAAAAEAAQAAAAAAgAAAAAAAAAAAAAAAAgAA" +
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////////////////////////////////" +
"////////////////////////////////////////////////////////////////////////////" +
"//////////////////////////////////////////////////////8=";
using (var stream = new MemoryStream(System.Convert.FromBase64String(emptycursor)))
{
Cursor.Current = new Cursor(stream);
}
#endif
}
}
@ -1248,7 +1262,9 @@ namespace CodeImp.DoomBuilder.Windows
Cursor.Clip = Rectangle.Empty;
Cursor.Position = display.PointToScreen(new Point(display.ClientSize.Width / 2, display.ClientSize.Height / 2));
Cursor.Show();
this.menumain.Enabled = true;
#if MONO_WINFORMS
Cursor.Current = Cursors.Default;
#endif
}
}

View file

@ -172,8 +172,11 @@ extern "C"
RawMouse* RawMouse_New(void* hwnd)
{
//return new RawMouse(hwnd);
#ifdef WIN32
return new RawMouse(hwnd);
#else
return nullptr;
#endif
}
void RawMouse_Delete(RawMouse* mouse)