Merge pull request #5 from Jaehyuk-Lee/click-through
Enable click-through
This commit is contained in:
commit
8f4baef063
2 changed files with 39 additions and 6 deletions
|
@ -61,9 +61,6 @@ namespace DutyContent.Overlay
|
||||||
|
|
||||||
private void DoMoveDown(MouseEventArgs e)
|
private void DoMoveDown(MouseEventArgs e)
|
||||||
{
|
{
|
||||||
if (DcConfig.Duty.OverlayClickThru)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (e.Button == MouseButtons.Left)
|
if (e.Button == MouseButtons.Left)
|
||||||
{
|
{
|
||||||
ThirdParty.NativeMethods.ReleaseCapture();
|
ThirdParty.NativeMethods.ReleaseCapture();
|
||||||
|
@ -73,9 +70,6 @@ namespace DutyContent.Overlay
|
||||||
|
|
||||||
protected override void OnMouseDown(MouseEventArgs e)
|
protected override void OnMouseDown(MouseEventArgs e)
|
||||||
{
|
{
|
||||||
if (DcConfig.Duty.OverlayClickThru)
|
|
||||||
return;
|
|
||||||
|
|
||||||
base.OnMouseDown(e);
|
base.OnMouseDown(e);
|
||||||
DoMoveDown(e);
|
DoMoveDown(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace DutyContent.Tab
|
namespace DutyContent.Tab
|
||||||
{
|
{
|
||||||
|
@ -34,6 +35,12 @@ namespace DutyContent.Tab
|
||||||
_overlay = new Overlay.DutyOvForm();
|
_overlay = new Overlay.DutyOvForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Used for click-through function
|
||||||
|
[DllImport("user32.dll", SetLastError = true)]
|
||||||
|
static extern int GetWindowLong(IntPtr hWnd, int nIndex);
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
|
||||||
|
|
||||||
private void DutyTabForm_FormClosing(object sender, FormClosingEventArgs e)
|
private void DutyTabForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -75,6 +82,8 @@ namespace DutyContent.Tab
|
||||||
_overlay.Show();
|
_overlay.Show();
|
||||||
else
|
else
|
||||||
_overlay.Hide();
|
_overlay.Hide();
|
||||||
|
if (DcConfig.Duty.OverlayClickThru)
|
||||||
|
EnableOverlayClickThru();
|
||||||
|
|
||||||
//
|
//
|
||||||
chkEnableSound.Checked = DcConfig.Duty.EnableSound;
|
chkEnableSound.Checked = DcConfig.Duty.EnableSound;
|
||||||
|
@ -669,6 +678,10 @@ namespace DutyContent.Tab
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DcConfig.Duty.OverlayClickThru = chkOverlayClickThru.Checked;
|
DcConfig.Duty.OverlayClickThru = chkOverlayClickThru.Checked;
|
||||||
|
if (DcConfig.Duty.OverlayClickThru)
|
||||||
|
EnableOverlayClickThru();
|
||||||
|
else
|
||||||
|
DisableOverlayClickThru();
|
||||||
|
|
||||||
SaveConfig();
|
SaveConfig();
|
||||||
}
|
}
|
||||||
|
@ -1314,5 +1327,31 @@ namespace DutyContent.Tab
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EnableOverlayClickThru()
|
||||||
|
{
|
||||||
|
int initialStyle = GetWindowLong(_overlay.Handle, -20);
|
||||||
|
if (DcConfig.Duty.OverlayClickThru)
|
||||||
|
{
|
||||||
|
SetWindowLong(_overlay.Handle, -20, initialStyle | 0x80000 | 0x20);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetWindowLong(_overlay.Handle, -20, (0x00000 | 0x80000));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DisableOverlayClickThru()
|
||||||
|
{
|
||||||
|
int initialStyle = GetWindowLong(_overlay.Handle, -20);
|
||||||
|
if (DcConfig.Duty.OverlayClickThru)
|
||||||
|
{
|
||||||
|
SetWindowLong(_overlay.Handle, -20, initialStyle | 0x80000 | 0x20);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetWindowLong(_overlay.Handle, -20, (0x00000 | 0x80000));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue