|
|
@ -49,52 +49,31 @@ |
|
|
|
Enable = true; |
|
|
|
Enable = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void _hook_MouseWheelExt(object sender, MouseEventExtArgs e) |
|
|
|
private void MouseButtonFunction(MouseEventExtArgs e, bool isDownEvent) |
|
|
|
{ |
|
|
|
|
|
|
|
if (!Enable) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ImGuiIOPtr io = ImGui.GetIO(); |
|
|
|
|
|
|
|
if (io.WantCaptureMouse) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
io.MouseWheel = e.Delta / SystemInformation.MouseWheelScrollDelta; |
|
|
|
|
|
|
|
e.Handled = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void _hook_MouseUpExt(object sender, MouseEventExtArgs e) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!Enable) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ImGuiIOPtr io = ImGui.GetIO(); |
|
|
|
ImGuiIOPtr io = ImGui.GetIO(); |
|
|
|
|
|
|
|
|
|
|
|
switch (e.Button) |
|
|
|
switch (e.Button) |
|
|
|
{ |
|
|
|
{ |
|
|
|
case MouseButtons.Left: |
|
|
|
case MouseButtons.Left: |
|
|
|
io.MouseDown[0] = false; |
|
|
|
io.MouseDown[0] = isDownEvent; |
|
|
|
break; |
|
|
|
|
|
|
|
case MouseButtons.None: |
|
|
|
|
|
|
|
// TODO: Find out what does this None mean |
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case MouseButtons.Right: |
|
|
|
case MouseButtons.Right: |
|
|
|
io.MouseDown[1] = false; |
|
|
|
io.MouseDown[1] = isDownEvent; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case MouseButtons.Middle: |
|
|
|
case MouseButtons.Middle: |
|
|
|
io.MouseDown[2] = false; |
|
|
|
io.MouseDown[2] = isDownEvent; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case MouseButtons.XButton1: |
|
|
|
case MouseButtons.XButton1: |
|
|
|
io.MouseDown[3] = false; |
|
|
|
io.MouseDown[3] = isDownEvent; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case MouseButtons.XButton2: |
|
|
|
case MouseButtons.XButton2: |
|
|
|
io.MouseDown[4] = false; |
|
|
|
io.MouseDown[4] = isDownEvent; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case MouseButtons.None: |
|
|
|
|
|
|
|
// TODO: Find out what does this None mean |
|
|
|
break; |
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
// Make a Logger for the whole Overlay |
|
|
|
// TODO: Make a Logger for the whole Overlay |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -104,6 +83,22 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void _hook_MouseUpExt(object sender, MouseEventExtArgs e) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (Enable) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
MouseButtonFunction(e, false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void _hook_MouseDownExt(object sender, MouseEventExtArgs e) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (Enable) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
MouseButtonFunction(e, true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void _hook_MouseMove(object sender, MouseEventArgs e) |
|
|
|
private void _hook_MouseMove(object sender, MouseEventArgs e) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!Enable) |
|
|
|
if (!Enable) |
|
|
@ -118,7 +113,7 @@ |
|
|
|
// Window32 API ShowCursor(false) |
|
|
|
// Window32 API ShowCursor(false) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void _hook_MouseDownExt(object sender, MouseEventExtArgs e) |
|
|
|
private void _hook_MouseWheelExt(object sender, MouseEventExtArgs e) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!Enable) |
|
|
|
if (!Enable) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -128,33 +123,81 @@ |
|
|
|
ImGuiIOPtr io = ImGui.GetIO(); |
|
|
|
ImGuiIOPtr io = ImGui.GetIO(); |
|
|
|
if (io.WantCaptureMouse) |
|
|
|
if (io.WantCaptureMouse) |
|
|
|
{ |
|
|
|
{ |
|
|
|
switch (e.Button) |
|
|
|
io.MouseWheel = e.Delta / SystemInformation.MouseWheelScrollDelta; |
|
|
|
{ |
|
|
|
|
|
|
|
case MouseButtons.Left: |
|
|
|
|
|
|
|
io.MouseDown[0] = true; |
|
|
|
|
|
|
|
e.Handled = true; |
|
|
|
e.Handled = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void _hook_KeyUp(object sender, KeyEventArgs e) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
var io = ImGui.GetIO(); |
|
|
|
|
|
|
|
io.KeysDown[e.KeyValue] = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (e.KeyCode) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
case Keys.LWin: |
|
|
|
|
|
|
|
case Keys.RWin: |
|
|
|
|
|
|
|
io.KeySuper = false; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case MouseButtons.Right: |
|
|
|
case Keys.LControlKey: |
|
|
|
io.MouseDown[1] = true; |
|
|
|
case Keys.RControlKey: |
|
|
|
e.Handled = true; |
|
|
|
io.KeyCtrl = false; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case MouseButtons.Middle: |
|
|
|
case Keys.LMenu: |
|
|
|
io.MouseDown[2] = true; |
|
|
|
case Keys.RMenu: |
|
|
|
e.Handled = true; |
|
|
|
io.KeyAlt = false; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case MouseButtons.XButton1: |
|
|
|
case Keys.LShiftKey: |
|
|
|
io.MouseDown[3] = true; |
|
|
|
case Keys.RShiftKey: |
|
|
|
e.Handled = true; |
|
|
|
io.KeyShift = false; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case MouseButtons.XButton2: |
|
|
|
default: |
|
|
|
io.MouseDown[4] = true; |
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void _hook_KeyDown(object sender, KeyEventArgs e) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (!Enable) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var io = ImGui.GetIO(); |
|
|
|
|
|
|
|
if (io.WantCaptureKeyboard) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
io.KeysDown[e.KeyValue] = true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (e.KeyCode) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
case Keys.LWin: |
|
|
|
|
|
|
|
case Keys.RWin: |
|
|
|
|
|
|
|
io.KeySuper = true; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case Keys.LControlKey: |
|
|
|
|
|
|
|
case Keys.RControlKey: |
|
|
|
|
|
|
|
io.KeyCtrl = true; |
|
|
|
e.Handled = true; |
|
|
|
e.Handled = true; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case MouseButtons.None: |
|
|
|
case Keys.LMenu: |
|
|
|
// TODO: Find out what does this None mean |
|
|
|
case Keys.RMenu: |
|
|
|
|
|
|
|
io.KeyAlt = true; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
// Alt is LMenu/RMenu |
|
|
|
|
|
|
|
case Keys.LShiftKey: |
|
|
|
|
|
|
|
case Keys.RShiftKey: |
|
|
|
|
|
|
|
io.KeyShift = true; |
|
|
|
break; |
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
// TODO: Make a Logger for the whole Overlay |
|
|
|
// Ignoring ALT key so we can do ALT+TAB or ALT+F4 etc. |
|
|
|
|
|
|
|
// Not sure if ImGUI needs to use ALT+XXX key for anything. |
|
|
|
|
|
|
|
// Ignoring Capital/NumLock key so Windows can use it |
|
|
|
|
|
|
|
// Ignoring Win/Super key so we can do Win+D or other stuff |
|
|
|
|
|
|
|
if (!io.KeyAlt && e.KeyCode != Keys.Capital && e.KeyCode != Keys.NumLock && !io.KeySuper) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
e.Handled = true; |
|
|
|
|
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -169,8 +212,13 @@ |
|
|
|
|
|
|
|
|
|
|
|
var io = ImGui.GetIO(); |
|
|
|
var io = ImGui.GetIO(); |
|
|
|
|
|
|
|
|
|
|
|
if (io.KeyAlt) // Ignoring ALT key so we can do ALT+TAB or ALT+F4 etc. Not sure if ImGUI uses ALT key in anyway. |
|
|
|
// Ignoring Win/Super key so we can do Win+D or other stuff |
|
|
|
|
|
|
|
// Ignoring ALT key so we can do ALT+TAB or ALT+F4 etc. |
|
|
|
|
|
|
|
// Not sure if ImGUI needs to use ALT+XXX or Super+XXX key for anything. |
|
|
|
|
|
|
|
if (io.KeySuper || io.KeyAlt) |
|
|
|
|
|
|
|
{ |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (io.WantTextInput || io.WantCaptureKeyboard) |
|
|
|
if (io.WantTextInput || io.WantCaptureKeyboard) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -179,20 +227,6 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void _hook_KeyUp(object sender, KeyEventArgs e) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// TODO: |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void _hook_KeyDown(object sender, KeyEventArgs e) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (!Enable) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// TODO: |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void Dispose() |
|
|
|
public void Dispose() |
|
|
|
{ |
|
|
|
{ |
|
|
|
_hook.KeyDown -= _hook_KeyDown; |
|
|
|
_hook.KeyDown -= _hook_KeyDown; |
|
|
|