From d16122cae03202761d75384388f52ca084f91ea4 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 14 Mar 2017 18:47:16 +0300 Subject: Fix shadow variables in PopupMenu and Desktop. --- src/gui/popups/popupmenu.cpp | 34 +++++++++++++++++----------------- src/gui/popups/popupmenu.h | 2 +- src/gui/widgets/desktop.cpp | 3 ++- src/gui/widgets/desktop.h | 1 - 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 846c29174..913ebdeba 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -115,7 +115,7 @@ PopupMenu::PopupMenu() : mMapItem(nullptr), mTab(nullptr), mSpell(nullptr), - mWindow(nullptr), + mCallerWindow(nullptr), mRenameListener(), mPlayerListener(), mDialog(nullptr), @@ -733,7 +733,7 @@ void PopupMenu::showMapPopup(const int x, const int y, mY = y2; if (isMinimap) - mWindow = minimap; + mCallerWindow = minimap; mBrowserBox->clearRows(); @@ -776,7 +776,7 @@ void PopupMenu::showOutfitsWindowPopup(const int x, const int y) { mX = x; mY = y; - mWindow = outfitWindow; + mCallerWindow = outfitWindow; mBrowserBox->clearRows(); @@ -838,7 +838,7 @@ void PopupMenu::showChatPopup(const int x, const int y, ChatTab *const tab) mTab = tab; mX = x; mY = y; - mWindow = chatWindow; + mCallerWindow = chatWindow; mBrowserBox->clearRows(); @@ -1078,7 +1078,7 @@ void PopupMenu::showWindowPopup(Window *const window) return; setMousePos(); - mWindow = window; + mCallerWindow = window; mBrowserBox->clearRows(); // TRANSLATORS: popup menu header mBrowserBox->addRow(_("window")); @@ -1478,20 +1478,20 @@ void PopupMenu::handleLink(const std::string &link, showPlayerMenu(); return; } - else if (link == "window close" && mWindow) + else if (link == "window close" && mCallerWindow) { - if (Widget::widgetExists(mWindow)) - mWindow->close(); + if (Widget::widgetExists(mCallerWindow)) + mCallerWindow->close(); } - else if (link == "window unlock" && mWindow) + else if (link == "window unlock" && mCallerWindow) { - if (Widget::widgetExists(mWindow)) - mWindow->setSticky(false); + if (Widget::widgetExists(mCallerWindow)) + mCallerWindow->setSticky(false); } - else if (link == "window lock" && mWindow) + else if (link == "window lock" && mCallerWindow) { - if (Widget::widgetExists(mWindow)) - mWindow->setSticky(true); + if (Widget::widgetExists(mCallerWindow)) + mCallerWindow->setSticky(true); } else if (link == "join chat" && being) { @@ -1715,7 +1715,7 @@ void PopupMenu::handleLink(const std::string &link, mMapItem = nullptr; mTab = nullptr; mSpell = nullptr; - mWindow = nullptr; + mCallerWindow = nullptr; mDialog = nullptr; mButton = nullptr; mName.clear(); @@ -1740,7 +1740,7 @@ void PopupMenu::showPopup(Window *const parent, for (int f = 0; f < maxCards; f ++) mItemCards[f] = item->getCard(f); mItemColor = item->getColor(); - mWindow = parent; + mCallerWindow = parent; mX = x; mY = y; mName.clear(); @@ -2876,7 +2876,7 @@ void PopupMenu::clear() mMapItem = nullptr; mTab = nullptr; mSpell = nullptr; - mWindow = nullptr; + mCallerWindow = nullptr; mButton = nullptr; mTextField = nullptr; } diff --git a/src/gui/popups/popupmenu.h b/src/gui/popups/popupmenu.h index c42976359..539424592 100644 --- a/src/gui/popups/popupmenu.h +++ b/src/gui/popups/popupmenu.h @@ -280,7 +280,7 @@ class PopupMenu final : public Popup, public LinkHandler MapItem *mMapItem; ChatTab *mTab; TextCommand *mSpell; - Window *mWindow; + Window *mCallerWindow; RenameListener mRenameListener; PlayerListener mPlayerListener; TextDialog *mDialog; diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp index 46bb3cba3..4aeea03b5 100644 --- a/src/gui/widgets/desktop.cpp +++ b/src/gui/widgets/desktop.cpp @@ -55,10 +55,11 @@ Desktop::Desktop(const Widget2 *const widget) : mVersionLabel(new BrowserBox(this, BrowserBoxMode::AUTO_WRAP, Opaque_false, "browserbox.xml")), mSkin(nullptr), - mBackgroundColor(getThemeColor(ThemeColorId::BACKGROUND, 128)), mBackgroundGrayColor(getThemeColor(ThemeColorId::BACKGROUND_GRAY)), mShowBackground(true) { + mBackgroundColor = getThemeColor(ThemeColorId::BACKGROUND, 128); + addWidgetListener(this); Wallpaper::loadWallpapers(); diff --git a/src/gui/widgets/desktop.h b/src/gui/widgets/desktop.h index 44f312c21..0a7ecf82d 100644 --- a/src/gui/widgets/desktop.h +++ b/src/gui/widgets/desktop.h @@ -79,7 +79,6 @@ class Desktop final : public Container, Image *mWallpaper; BrowserBox *mVersionLabel; Skin *mSkin; - Color mBackgroundColor; Color mBackgroundGrayColor; bool mShowBackground; }; -- cgit v1.2.3-60-g2f50