From 92a190392858c2f4fbb1cde1b8be4d58db7b2105 Mon Sep 17 00:00:00 2001 From: mat Date: Mon, 22 Aug 2022 21:09:05 +0300 Subject: [PATCH] Fix context menu handling --- night.ahk | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/night.ahk b/night.ahk index 51c3e76..c43a282 100644 --- a/night.ahk +++ b/night.ahk @@ -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%() @@ -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