Skip to content

Commit

Permalink
Fix context menu handling
Browse files Browse the repository at this point in the history
  • Loading branch information
t5mat committed Aug 22, 2022
1 parent 6a867b6 commit 92a1903
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions night.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -865,16 +865,16 @@ AutoExec() {
Menu, Tray, Standard
}

IsMenuTime() {
IsContextMenuTime() {
return (MenuTime && A_TickCount - MenuTime <= MaxMenuTime)
}

IsMenu() {
return ((Menu := GetCurrentMenu()) || IsMenuTime())
IsContextMenu(Directive) {
return ((Menu := GetCurrentMenu()) || (Directive && IsContextMenuTime()))
}

HandleMenuHotkeyTimerTick(TestFunc, HandleFunc, MenuTime) {
if (%TestFunc%()) {
if (%TestFunc%(false)) {
SetTimer % HandleMenuHotkeyTimer, Off
HandleMenuHotkeyTimer :=
%HandleFunc%()
Expand Down Expand Up @@ -919,12 +919,18 @@ IsActiveDialog() {
return (WinExist("ahk_id " Hwnd " " AppTitle) || WinExist("ahk_id " Hwnd " " SelfTitle)) && WinExist("ahk_id " Hwnd " " DialogTitle)
}

IsActiveAppMenu() {
return WinExist("ahk_id " (Hwnd := WinExist("A")) " " AppTitle) && IsMenu()
IsActiveAppMenu(Directive := true) {
return WinExist("ahk_id " (Hwnd := WinExist("A")) " " AppTitle) && IsContextMenu(Directive)
}

#If IsActiveAppWindow()

~*RButton::
MenuTime := A_TickCount

~*AppsKey::
MenuTime := A_TickCount

$XButton1::
if (!(Hwnd := WinExist(AppProjectWindowTitle))) {
return
Expand Down

0 comments on commit 92a1903

Please sign in to comment.