From 50824cc0e1d6ef9cc2ba45a01d86c1af34b6d309 Mon Sep 17 00:00:00 2001 From: Narcasung Date: Thu, 16 Jul 2026 15:34:06 +0200 Subject: [PATCH] Strip Lock/Unlock Frame entry from class resource frames' right-click menu Dragging is now permanently disabled on these frames, so the native Lock/Unlock Frame option is meaningless. Reuses the UIDropDownMenu_AddButton override pattern already used for LayerPickerFrameDropDown, generalized to match any of the tracked frames' dropdowns by name convention or parent. --- Modules/ClassResources.lua | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/Modules/ClassResources.lua b/Modules/ClassResources.lua index c7925bd..cbe12f2 100644 --- a/Modules/ClassResources.lua +++ b/Modules/ClassResources.lua @@ -8,6 +8,42 @@ local FRAMES = { {name = "CoAMultiCastActionBarFrame", moverText = "Multi Cast Action Bar", hideKey = "hideMultiCastActionBar"}, } +local FRAME_NAMES = {} +for _, def in ipairs(FRAMES) do + FRAME_NAMES[def.name] = true +end + +-- These frames' native right-click dropdown offers a "Lock/Unlock Frame" +-- entry that's meaningless now that dragging is permanently disabled (see +-- DisableDrag below), so strip it. Matched loosely (case-insensitive, +-- requiring both words) since the exact wording isn't confirmed, and scoped +-- to only our tracked frames' dropdowns so it can't affect unrelated menus. +do + local function IsTrackedDropdown(menu) + if not menu then return false end + + local name = menu.GetName and menu:GetName() + local ownerName = name and name:match("^(.-)DropDown$") + if ownerName and FRAME_NAMES[ownerName] then return true end + + local parent = menu.GetParent and menu:GetParent() + local parentName = parent and parent.GetName and parent:GetName() + return parentName and FRAME_NAMES[parentName] or false + end + + local orig_AddButton = UIDropDownMenu_AddButton + UIDropDownMenu_AddButton = function(info, level) + if info and info.text and IsTrackedDropdown(UIDROPDOWNMENU_INIT_MENU) then + local text = info.text:lower() + if text:find("lock") and text:find("frame") then + return + end + end + + return orig_AddButton(info, level) + end +end + -- A single nil-out isn't enough: the frame's own update logic re-attaches -- OnDragStart/OnDragStop (and re-registers drag buttons) on refresh, and -- native dragging ends with the engine calling SetPoint directly on the