Merge pull request #7574 from Abextm/fix-overlay-menus
Force RUNELITE_OVERLAY menuops to not be left click
This commit is contained in:
@@ -59,5 +59,11 @@ public class MenuEntry
|
||||
* A second additional parameter for the action.
|
||||
*/
|
||||
private int param1;
|
||||
|
||||
/**
|
||||
* If this field is true and you have single mouse button on and this entry is
|
||||
* the top entry the right click menu will not be opened when you left click
|
||||
*
|
||||
* This is used for shift click
|
||||
*/
|
||||
private boolean forceLeftClick;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.MenuAction;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.VarClientInt;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
@@ -72,6 +73,13 @@ class MouseHighlightOverlay extends Overlay
|
||||
MenuEntry menuEntry = menuEntries[last];
|
||||
String target = menuEntry.getTarget();
|
||||
String option = menuEntry.getOption();
|
||||
int type = menuEntry.getType();
|
||||
|
||||
if (type == MenuAction.RUNELITE_OVERLAY.getId() || type == MenuAction.EXAMINE_ITEM_BANK_EQ.getId())
|
||||
{
|
||||
// These are always right click only
|
||||
return null;
|
||||
}
|
||||
|
||||
if (Strings.isNullOrEmpty(option))
|
||||
{
|
||||
|
||||
@@ -546,6 +546,7 @@ public abstract class RSClientMixin implements RSClient
|
||||
int[] menuTypes = getMenuTypes();
|
||||
int[] params0 = getMenuActionParams0();
|
||||
int[] params1 = getMenuActionParams1();
|
||||
boolean[] leftClick = getMenuForceLeftClick();
|
||||
|
||||
MenuEntry[] entries = new MenuEntry[count];
|
||||
for (int i = 0; i < count; ++i)
|
||||
@@ -557,6 +558,7 @@ public abstract class RSClientMixin implements RSClient
|
||||
entry.setType(menuTypes[i]);
|
||||
entry.setParam0(params0[i]);
|
||||
entry.setParam1(params1[i]);
|
||||
entry.setForceLeftClick(leftClick[i]);
|
||||
}
|
||||
return entries;
|
||||
}
|
||||
@@ -572,6 +574,7 @@ public abstract class RSClientMixin implements RSClient
|
||||
int[] menuTypes = getMenuTypes();
|
||||
int[] params0 = getMenuActionParams0();
|
||||
int[] params1 = getMenuActionParams1();
|
||||
boolean[] leftClick = getMenuForceLeftClick();
|
||||
|
||||
for (MenuEntry entry : entries)
|
||||
{
|
||||
@@ -581,6 +584,7 @@ public abstract class RSClientMixin implements RSClient
|
||||
menuTypes[count] = entry.getType();
|
||||
params0[count] = entry.getParam0();
|
||||
params1[count] = entry.getParam1();
|
||||
leftClick[count] = entry.isForceLeftClick();
|
||||
++count;
|
||||
}
|
||||
|
||||
@@ -1406,4 +1410,28 @@ public abstract class RSClientMixin implements RSClient
|
||||
{
|
||||
client.getCallbacks().post(new ClientTick());
|
||||
}
|
||||
|
||||
@Copy("shouldLeftClickOpenMenu")
|
||||
boolean rs$shouldLeftClickOpenMenu()
|
||||
{
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
@Replace("shouldLeftClickOpenMenu")
|
||||
boolean rl$shouldLeftClickOpenMenu()
|
||||
{
|
||||
if (rs$shouldLeftClickOpenMenu())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
int len = getMenuOptionCount();
|
||||
if (len > 0)
|
||||
{
|
||||
int type = getMenuTypes()[len - 1];
|
||||
return type == MenuAction.RUNELITE_OVERLAY.getId();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -307,6 +307,9 @@ public interface RSClient extends RSGameEngine, Client
|
||||
@Import("menuActionParams1")
|
||||
int[] getMenuActionParams1();
|
||||
|
||||
@Import("menuForceLeftClick")
|
||||
boolean[] getMenuForceLeftClick();
|
||||
|
||||
@Import("worldList")
|
||||
@Override
|
||||
RSWorld[] getWorldList();
|
||||
|
||||
Reference in New Issue
Block a user