mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-09 09:38:19 +00:00
Only activate double-clicks with left mouse button again
Double-clicks could also be activated with other mouse buttons on some UI elements, which was unintentionally added by #8489.
This commit is contained in:
parent
e97b8e1818
commit
2c7c391ff0
|
@ -1471,7 +1471,7 @@ void CMenus::RenderServerbrowserFriends(CUIRect View)
|
|||
continue;
|
||||
|
||||
const bool Inside = Ui()->HotItem() == Friend.ListItemId() || Ui()->HotItem() == Friend.RemoveButtonId() || Ui()->HotItem() == Friend.CommunityTooltipId();
|
||||
bool ButtonResult = Ui()->DoButtonLogic(Friend.ListItemId(), 0, &Rect);
|
||||
int ButtonResult = Ui()->DoButtonLogic(Friend.ListItemId(), 0, &Rect);
|
||||
if(Friend.ServerInfo())
|
||||
{
|
||||
GameClient()->m_Tooltips.DoToolTip(Friend.ListItemId(), &Rect, Localize("Click to select server. Double click to join your friend."));
|
||||
|
@ -1553,7 +1553,7 @@ void CMenus::RenderServerbrowserFriends(CUIRect View)
|
|||
if(Ui()->DoButtonLogic(Friend.RemoveButtonId(), 0, &RemoveButton))
|
||||
{
|
||||
m_pRemoveFriend = &Friend;
|
||||
ButtonResult = false;
|
||||
ButtonResult = 0;
|
||||
}
|
||||
GameClient()->m_Tooltips.DoToolTip(Friend.RemoveButtonId(), &RemoveButton, Friend.FriendState() == IFriends::FRIEND_PLAYER ? Localize("Click to remove this player from your friends list.") : Localize("Click to remove this clan from your friends list."));
|
||||
}
|
||||
|
@ -1563,7 +1563,7 @@ void CMenus::RenderServerbrowserFriends(CUIRect View)
|
|||
{
|
||||
str_copy(g_Config.m_UiServerAddress, Friend.ServerInfo()->m_aAddress);
|
||||
m_ServerBrowserShouldRevealSelection = true;
|
||||
if(Ui()->DoDoubleClickLogic(Friend.ListItemId()))
|
||||
if(ButtonResult == 1 && Ui()->DoDoubleClickLogic(Friend.ListItemId()))
|
||||
{
|
||||
Connect(g_Config.m_UiServerAddress);
|
||||
}
|
||||
|
|
|
@ -160,24 +160,20 @@ CListboxItem CListBox::DoNextItem(const void *pId, bool Selected, float CornerRa
|
|||
}
|
||||
|
||||
CListboxItem Item = DoNextRow();
|
||||
bool ItemClicked = false;
|
||||
|
||||
if(Item.m_Visible && Ui()->DoButtonLogic(pId, 0, &Item.m_Rect))
|
||||
const int ItemClicked = Item.m_Visible ? Ui()->DoButtonLogic(pId, 0, &Item.m_Rect) : 0;
|
||||
if(ItemClicked)
|
||||
{
|
||||
ItemClicked = true;
|
||||
m_ListBoxNewSelected = ThisItemIndex;
|
||||
m_ListBoxItemSelected = true;
|
||||
m_Active = true;
|
||||
}
|
||||
else
|
||||
ItemClicked = false;
|
||||
|
||||
// process input, regard selected index
|
||||
if(m_ListBoxNewSelected == ThisItemIndex)
|
||||
{
|
||||
if(m_Active)
|
||||
{
|
||||
if(Ui()->ConsumeHotkey(CUi::HOTKEY_ENTER) || (ItemClicked && Ui()->DoDoubleClickLogic(pId)))
|
||||
if(Ui()->ConsumeHotkey(CUi::HOTKEY_ENTER) || (ItemClicked == 1 && Ui()->DoDoubleClickLogic(pId)))
|
||||
{
|
||||
m_ListBoxItemActivated = true;
|
||||
Ui()->SetActiveItem(nullptr);
|
||||
|
|
Loading…
Reference in a new issue