Skip to content

Commit

Permalink
Fix overlay position bug
Browse files Browse the repository at this point in the history
  • Loading branch information
SaifAqqad committed Nov 24, 2023
1 parent 7297484 commit dce94cb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion ahkpm.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.3.0",
"version": "1.3.1",
"description": "Control your microphone using keyboard and mouse hotkeys.",
"repository": "https://github.com/SaifAqqad/AHK_MicMute",
"website": "https://github.com/SaifAqqad/AHK_MicMute",
Expand Down
5 changes: 2 additions & 3 deletions src/MicMute.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
;compiler directives
;@Ahk2Exe-Let Res = %A_ScriptDir%\resources
;@Ahk2Exe-Let UI = %A_ScriptDir%\UI\config
;@Ahk2Exe-Let Version = 1.3.0
;@Ahk2Exe-Let Version = 1.3.1
;@Ahk2Exe-IgnoreBegin
U_Version:= "1.3.0"
U_Version:= "1.3.1"
;@Ahk2Exe-IgnoreEnd
;@Ahk2Exe-SetMainIcon %U_Res%\icons\1000.ico
;@Ahk2Exe-SetVersion %U_Version%
Expand Down Expand Up @@ -108,7 +108,6 @@ Global A_startupTime:= A_TickCount
, updater_UI:=""
, WM_SETTINGCHANGE:= 0x001A
, WM_DEVICECHANGE := 0x0219
, WM_DISPLAYCHANGE := 0x007E

; parse cli args
parseArgs()
Expand Down
8 changes: 5 additions & 3 deletions src/UI/Overlay.ahk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Overlay {
class Overlay {
static GDI_TOKEN := 0
, BACKGROUND_COLOR := 0x232323
, BACKGROUND_TRANSPARENCY := 0xef000000
Expand Down Expand Up @@ -52,6 +52,8 @@ class Overlay {
}

_calculatePos(){
this.changedPos:= ""

if (this.options.pos.Length() > 1) {
; there's multiple positions -> Apply the first available
isPositionSet:= 0
Expand Down Expand Up @@ -237,10 +239,10 @@ class Overlay {
return

WinGetPos, xPos, yPos, , , % "ahk_id " this.hwnd
if (xPos == "" || yPos == "")
if (xPos == "" || yPos == "" || (this.lastChangedPos && this.lastChangedPos.x == xPos && this.lastChangedPos.y == yPos))
return

this.changedPos := { x: xPos, y: yPos }
this.lastChangedPos := this.changedPos := { x: xPos, y: yPos }
}

_onPosChanged(){
Expand Down

0 comments on commit dce94cb

Please sign in to comment.