Takenumber Window: Keep arranger focused after clicks into the script's window

This commit is contained in:
Ludwig Frühschütz 2020-04-17 17:13:12 +02:00
parent 83616afb05
commit 8d3c45c09e

View File

@ -659,15 +659,23 @@ end
function mainloop()
-- mouseclicks?
local RMB_state = mouse.cap(mouse.RB)
local LMB_state = mouse.cap(mouse.LB)
local mx = gfx.mouse_x
local my = gfx.mouse_y
if not mouse.last_RMB_state and gfx.mouse_cap&2 == 2 then
-- right click pressed down -> show "right click menu" at mouse cursor
-- right click pressed down -> show "right click menu" at mouse cursor and focus arranger afterwards
rc_menu:show(mx, my)
reaper.Main_OnCommand( reaper.NamedCommandLookup('_BR_FOCUS_ARRANGE_WND'), 0 ) -- focus arranger
end
if not mouse.last_LMB_state and gfx.mouse_cap&1 == 1 then
-- left click pressed down -> only focus arranger
reaper.Main_OnCommand( reaper.NamedCommandLookup('_BR_FOCUS_ARRANGE_WND'), 0 ) -- focus arranger
end
mouse.last_RMB_state = RMB_state -- store current right mouse button state
mouse.last_LMB_state = LMB_state -- store current left mouse button state
drawGui()
gfx.update()