summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/actionmanager.cpp4
-rw-r--r--src/gui/viewport.cpp4
-rw-r--r--src/gui/viewport.h17
-rw-r--r--src/gui/widgets/avatarlistbox.cpp20
-rw-r--r--src/gui/widgets/dropshortcutcontainer.cpp6
-rw-r--r--src/gui/widgets/emoteshortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/itemcontainer.cpp2
-rw-r--r--src/gui/widgets/itemlinkhandler.cpp8
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp8
-rw-r--r--src/gui/widgets/shoplistbox.cpp6
-rw-r--r--src/gui/widgets/skilllistbox.h2
-rw-r--r--src/gui/widgets/spellshortcutcontainer.cpp6
-rw-r--r--src/gui/widgets/tabs/debugwindowtabs.cpp4
-rw-r--r--src/gui/widgets/textfield.cpp4
-rw-r--r--src/gui/widgets/window.cpp4
-rw-r--r--src/gui/windows/chatwindow.cpp4
-rw-r--r--src/gui/windows/itemamountwindow.cpp2
-rw-r--r--src/gui/windows/minimap.cpp4
-rw-r--r--src/gui/windows/npcdialog.cpp4
-rw-r--r--src/gui/windows/outfitwindow.cpp4
-rw-r--r--src/gui/windows/whoisonline.cpp8
21 files changed, 56 insertions, 67 deletions
diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp
index 0c9d75b5b..56447d206 100644
--- a/src/actionmanager.cpp
+++ b/src/actionmanager.cpp
@@ -1126,8 +1126,8 @@ impHandler0(showWindows)
{
if (popupMenu)
{
- popupMenu->showWindowsPopup(viewport->getMouseX(),
- viewport->getMouseY());
+ popupMenu->showWindowsPopup(viewport->mMouseX,
+ viewport->mMouseY);
return true;
}
return false;
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 01e20f55d..96cd080da 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -61,6 +61,8 @@ extern MiniStatusWindow *miniStatusWindow;
Viewport::Viewport() :
WindowContainer(nullptr),
MouseListener(),
+ mMouseX(0),
+ mMouseY(0),
mMap(nullptr),
mHoverBeing(nullptr),
mHoverItem(nullptr),
@@ -69,8 +71,6 @@ Viewport::Viewport() :
mScrollLaziness(config.getIntValue("ScrollLaziness")),
mScrollCenterOffsetX(config.getIntValue("ScrollCenterOffsetX")),
mScrollCenterOffsetY(config.getIntValue("ScrollCenterOffsetY")),
- mMouseX(0),
- mMouseY(0),
mMousePressX(0),
mMousePressY(0),
mPixelViewX(0),
diff --git a/src/gui/viewport.h b/src/gui/viewport.h
index 329b88074..55a0ab1b6 100644
--- a/src/gui/viewport.h
+++ b/src/gui/viewport.h
@@ -128,18 +128,6 @@ class Viewport final : public WindowContainer,
{ return mPixelViewY; }
/**
- * Returns mouse x in pixels.
- */
- int getMouseX() const A_WARN_UNUSED
- { return mMouseX; }
-
- /**
- * Returns mouse y in pixels.
- */
- int getMouseY() const A_WARN_UNUSED
- { return mMouseY; }
-
- /**
* Changes viewpoint by relative pixel coordinates.
*/
void scrollBy(const int x, const int y)
@@ -177,6 +165,9 @@ class Viewport final : public WindowContainer,
void returnCamera();
+ int mMouseX; /**< Current mouse position in pixels. */
+ int mMouseY; /**< Current mouse position in pixels. */
+
protected:
friend class ActorManager;
@@ -220,8 +211,6 @@ class Viewport final : public WindowContainer,
int mScrollLaziness;
int mScrollCenterOffsetX;
int mScrollCenterOffsetY;
- int mMouseX; /**< Current mouse position in pixels. */
- int mMouseY; /**< Current mouse position in pixels. */
int mMousePressX;
int mMousePressY;
int mPixelViewX; /**< Current viewpoint in pixels. */
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp
index 21689311a..909f01618 100644
--- a/src/gui/widgets/avatarlistbox.cpp
+++ b/src/gui/widgets/avatarlistbox.cpp
@@ -395,14 +395,14 @@ void AvatarListBox::mousePressed(MouseEvent &event)
avatar->getName(), ActorType::PLAYER);
if (being)
{
- popupMenu->showPopup(viewport->getMouseX(),
- viewport->getMouseY(),
+ popupMenu->showPopup(viewport->mMouseX,
+ viewport->mMouseY,
being);
}
else
{
- popupMenu->showPlayerPopup(viewport->getMouseX(),
- viewport->getMouseY(),
+ popupMenu->showPlayerPopup(viewport->mMouseX,
+ viewport->mMouseY,
avatar->getName());
}
}
@@ -418,8 +418,8 @@ void AvatarListBox::mousePressed(MouseEvent &event)
else
name = model->getAvatarAt(selected)->getName();
- popupMenu->showAttackMonsterPopup(viewport->getMouseX(),
- viewport->getMouseY(),
+ popupMenu->showAttackMonsterPopup(viewport->mMouseX,
+ viewport->mMouseY,
name,
static_cast<ActorType::Type>(model->getAvatarAt(
selected)->getType()));
@@ -434,8 +434,8 @@ void AvatarListBox::mousePressed(MouseEvent &event)
else
name = model->getAvatarAt(selected)->getName();
- popupMenu->showPickupItemPopup(viewport->getMouseX(),
- viewport->getMouseY(),
+ popupMenu->showPickupItemPopup(viewport->mMouseX,
+ viewport->mMouseY,
name);
break;
}
@@ -460,8 +460,8 @@ void AvatarListBox::mousePressed(MouseEvent &event)
{
MapItem *const mapItem = map->findPortalXY(
ava->getX(), ava->getY());
- popupMenu->showPopup(viewport->getMouseX(),
- viewport->getMouseY(),
+ popupMenu->showPopup(viewport->mMouseX,
+ viewport->mMouseY,
mapItem);
}
break;
diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp
index 9d423f8ac..6d3d259b0 100644
--- a/src/gui/widgets/dropshortcutcontainer.cpp
+++ b/src/gui/widgets/dropshortcutcontainer.cpp
@@ -214,8 +214,8 @@ void DropShortcutContainer::mousePressed(MouseEvent &event)
if (popupMenu)
{
- popupMenu->showDropPopup(viewport->getMouseX(),
- viewport->getMouseY(),
+ popupMenu->showDropPopup(viewport->mMouseX,
+ viewport->mMouseY,
item);
}
}
@@ -278,7 +278,7 @@ void DropShortcutContainer::mouseMoved(MouseEvent &event)
if (item && viewport)
{
itemPopup->setItem(item);
- itemPopup->position(viewport->getMouseX(), viewport->getMouseY());
+ itemPopup->position(viewport->mMouseX, viewport->mMouseY);
}
else
{
diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp
index a1fee31a2..c07482e1b 100644
--- a/src/gui/widgets/emoteshortcutcontainer.cpp
+++ b/src/gui/widgets/emoteshortcutcontainer.cpp
@@ -199,7 +199,7 @@ void EmoteShortcutContainer::mouseMoved(MouseEvent &event)
if (static_cast<size_t>(index) < mEmoteImg.size() && mEmoteImg[index])
{
const EmoteSprite *const sprite = mEmoteImg[index];
- textPopup->show(viewport->getMouseX(), viewport->getMouseY(),
+ textPopup->show(viewport->mMouseX, viewport->mMouseY,
strprintf("%s, %d", sprite->name.c_str(), sprite->id));
}
}
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 27c640df5..37e0c0ffd 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -607,7 +607,7 @@ void ItemContainer::mouseMoved(MouseEvent &event)
if (item && viewport)
{
itemPopup->setItem(item);
- itemPopup->position(viewport->getMouseX(), viewport->getMouseY());
+ itemPopup->position(viewport->mMouseX, viewport->mMouseY);
}
else
{
diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp
index 433639944..589f8f6d1 100644
--- a/src/gui/widgets/itemlinkhandler.cpp
+++ b/src/gui/widgets/itemlinkhandler.cpp
@@ -79,8 +79,8 @@ void ItemLinkHandler::handleLink(const std::string &link, MouseEvent *event)
{
if (popupMenu)
{
- popupMenu->showLinkPopup(viewport->getMouseX(),
- viewport->getMouseY(),
+ popupMenu->showLinkPopup(viewport->mMouseX,
+ viewport->mMouseY,
url);
}
}
@@ -128,8 +128,8 @@ void ItemLinkHandler::handleLink(const std::string &link, MouseEvent *event)
}
else if (viewport)
{
- itemPopup->position(viewport->getMouseX(),
- viewport->getMouseY());
+ itemPopup->position(viewport->mMouseX,
+ viewport->mMouseY);
}
}
}
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index f92fef323..df86c45ae 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -330,8 +330,8 @@ void ItemShortcutContainer::mousePressed(MouseEvent &event)
event.consume();
if (popupMenu && selShortcut && viewport)
{
- popupMenu->showItemPopup(viewport->getMouseX(),
- viewport->getMouseY(),
+ popupMenu->showItemPopup(viewport->mMouseX,
+ viewport->mMouseY,
selShortcut->getItem(index),
selShortcut->getItemColor(index));
}
@@ -409,7 +409,7 @@ void ItemShortcutContainer::mouseMoved(MouseEvent &event)
if (item && viewport)
{
itemPopup->setItem(item);
- itemPopup->position(viewport->getMouseX(), viewport->getMouseY());
+ itemPopup->position(viewport->mMouseX, viewport->mMouseY);
}
else
{
@@ -423,7 +423,7 @@ void ItemShortcutContainer::mouseMoved(MouseEvent &event)
if (spell && viewport)
{
spellPopup->setItem(spell);
- spellPopup->view(viewport->getMouseX(), viewport->getMouseY());
+ spellPopup->view(viewport->mMouseX, viewport->mMouseY);
}
else
{
diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp
index 728e1dc29..a2161d96d 100644
--- a/src/gui/widgets/shoplistbox.cpp
+++ b/src/gui/widgets/shoplistbox.cpp
@@ -211,7 +211,7 @@ void ShopListBox::mouseMoved(MouseEvent &event)
if (item)
{
itemPopup->setItem(item);
- itemPopup->position(viewport->getMouseX(), viewport->getMouseY());
+ itemPopup->position(viewport->mMouseX, viewport->mMouseY);
}
else
{
@@ -233,8 +233,8 @@ void ShopListBox::mouseReleased(MouseEvent& event)
Item *const item = mShopItems->at(mSelected);
if (popupMenu && viewport)
{
- popupMenu->showItemPopup(viewport->getMouseX(),
- viewport->getMouseY(),
+ popupMenu->showItemPopup(viewport->mMouseX,
+ viewport->mMouseY,
item);
}
}
diff --git a/src/gui/widgets/skilllistbox.h b/src/gui/widgets/skilllistbox.h
index c932fc95b..a3b6be059 100644
--- a/src/gui/widgets/skilllistbox.h
+++ b/src/gui/widgets/skilllistbox.h
@@ -168,7 +168,7 @@ class SkillListBox final : public ListBox
if (!skill)
return;
- mPopup->show(viewport->getMouseX(), viewport->getMouseY(),
+ mPopup->show(viewport->mMouseX, viewport->mMouseY,
skill->data->dispName, skill->data->description);
}
diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp
index 1ddf17981..0257cea08 100644
--- a/src/gui/widgets/spellshortcutcontainer.cpp
+++ b/src/gui/widgets/spellshortcutcontainer.cpp
@@ -259,8 +259,8 @@ void SpellShortcutContainer::mouseReleased(MouseEvent &event)
if (spell && popupMenu)
{
- popupMenu->showSpellPopup(viewport->getMouseX(),
- viewport->getMouseY(),
+ popupMenu->showSpellPopup(viewport->mMouseX,
+ viewport->mMouseY,
spell);
}
}
@@ -283,7 +283,7 @@ void SpellShortcutContainer::mouseMoved(MouseEvent &event)
if (spell && !spell->isEmpty())
{
spellPopup->setItem(spell);
- spellPopup->view(viewport->getMouseX(), viewport->getMouseY());
+ spellPopup->view(viewport->mMouseX, viewport->mMouseY);
}
else
{
diff --git a/src/gui/widgets/tabs/debugwindowtabs.cpp b/src/gui/widgets/tabs/debugwindowtabs.cpp
index b50baac78..8e625ac70 100644
--- a/src/gui/widgets/tabs/debugwindowtabs.cpp
+++ b/src/gui/widgets/tabs/debugwindowtabs.cpp
@@ -176,9 +176,9 @@ void MapDebugTab::logic()
if (map && viewport)
{
// Get the current mouse position
- const int mouseTileX = (viewport->getMouseX() + viewport->getCameraX())
+ const int mouseTileX = (viewport->mMouseX + viewport->getCameraX())
/ map->getTileWidth();
- const int mouseTileY = (viewport->getMouseY() + viewport->getCameraY())
+ const int mouseTileY = (viewport->mMouseY + viewport->getCameraY())
/ map->getTileHeight();
mTileMouseLabel->setCaption(strprintf("%s (%d, %d)",
// TRANSLATORS: debug window label
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp
index 0810b9395..e47f1905f 100644
--- a/src/gui/widgets/textfield.cpp
+++ b/src/gui/widgets/textfield.cpp
@@ -707,8 +707,8 @@ void TextField::mousePressed(MouseEvent &event)
{
if (popupMenu)
{
- popupMenu->showTextFieldPopup(viewport->getMouseX(),
- viewport->getMouseY(),
+ popupMenu->showTextFieldPopup(viewport->mMouseX,
+ viewport->mMouseY,
this);
}
}
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index 7a85d5352..f8622bb20 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -770,8 +770,8 @@ void Window::mousePressed(MouseEvent &event)
{
event.consume();
popupMenu->showWindowPopup(this,
- viewport->getMouseX(),
- viewport->getMouseY());
+ viewport->mMouseX,
+ viewport->mMouseY);
}
}
}
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index 363af7284..2be4f7be5 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -678,8 +678,8 @@ void ChatWindow::mousePressed(MouseEvent &event)
ChatTab *const cTab = dynamic_cast<ChatTab*>(tab);
if (cTab)
{
- popupMenu->showChatPopup(viewport->getMouseX(),
- viewport->getMouseY(),
+ popupMenu->showChatPopup(viewport->mMouseX,
+ viewport->mMouseY,
cTab);
}
}
diff --git a/src/gui/windows/itemamountwindow.cpp b/src/gui/windows/itemamountwindow.cpp
index 5f0f063e1..67dc5ee75 100644
--- a/src/gui/windows/itemamountwindow.cpp
+++ b/src/gui/windows/itemamountwindow.cpp
@@ -275,7 +275,7 @@ void ItemAmountWindow::mouseMoved(MouseEvent &event)
if (event.getSource() == mItemIcon)
{
itemPopup->setItem(mItem);
- itemPopup->position(viewport->getMouseX(), viewport->getMouseY());
+ itemPopup->position(viewport->mMouseX, viewport->mMouseY);
}
}
diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp
index 50e78666f..71689805f 100644
--- a/src/gui/windows/minimap.cpp
+++ b/src/gui/windows/minimap.cpp
@@ -456,8 +456,8 @@ void Minimap::mouseReleased(MouseEvent &event)
int x = event.getX();
int y = event.getY();
screenToMap(x, y);
- popupMenu->showMapPopup(viewport->getMouseX(),
- viewport->getMouseY(),
+ popupMenu->showMapPopup(viewport->mMouseX,
+ viewport->mMouseY,
x, y);
}
}
diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp
index 8b7a938b0..584776726 100644
--- a/src/gui/windows/npcdialog.cpp
+++ b/src/gui/windows/npcdialog.cpp
@@ -953,8 +953,8 @@ void NpcDialog::mousePressed(MouseEvent &event)
if (popupMenu)
{
popupMenu->showNpcDialogPopup(mNpcId,
- viewport->getMouseX(),
- viewport->getMouseY());
+ viewport->mMouseX,
+ viewport->mMouseY);
}
}
}
diff --git a/src/gui/windows/outfitwindow.cpp b/src/gui/windows/outfitwindow.cpp
index 0cd35e289..8fda44a2b 100644
--- a/src/gui/windows/outfitwindow.cpp
+++ b/src/gui/windows/outfitwindow.cpp
@@ -426,8 +426,8 @@ void OutfitWindow::mousePressed(MouseEvent &event)
const int index = getIndexFromGrid(event.getX(), event.getY());
if (event.getButton() == MouseButton::RIGHT && popupMenu)
{
- popupMenu->showOutfitsPopup(viewport->getMouseX(),
- viewport->getMouseY());
+ popupMenu->showOutfitsPopup(viewport->mMouseX,
+ viewport->mMouseY);
event.consume();
return;
}
diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp
index c30f19b8e..61a588f00 100644
--- a/src/gui/windows/whoisonline.cpp
+++ b/src/gui/windows/whoisonline.cpp
@@ -210,14 +210,14 @@ void WhoIsOnline::handleLink(const std::string& link, MouseEvent *event)
if (being && popupManager)
{
- popupMenu->showPopup(viewport->getMouseX(),
- viewport->getMouseY(),
+ popupMenu->showPopup(viewport->mMouseX,
+ viewport->mMouseY,
being);
return;
}
}
- popupMenu->showPlayerPopup(viewport->getMouseX(),
- viewport->getMouseY(),
+ popupMenu->showPlayerPopup(viewport->mMouseX,
+ viewport->mMouseY,
link);
}
}