summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-02-17 00:09:12 +0300
committerAndrei Karas <akaras@inbox.ru>2014-02-17 00:09:12 +0300
commite78036b3372e5773fac4207ea48bb61e2fd7873e (patch)
treef792fc5ecc4bc5a1fd1c3af7cded74229fbfab10
parente8270acbc5118aabbf10738eb9deee07457ea56d (diff)
downloadplus-e78036b3372e5773fac4207ea48bb61e2fd7873e.tar.gz
plus-e78036b3372e5773fac4207ea48bb61e2fd7873e.tar.bz2
plus-e78036b3372e5773fac4207ea48bb61e2fd7873e.tar.xz
plus-e78036b3372e5773fac4207ea48bb61e2fd7873e.zip
combine mouseinput into one file.
-rw-r--r--src/CMakeLists.txt5
-rw-r--r--src/Makefile.am5
-rw-r--r--src/gui/base/basiccontainer.cpp2
-rw-r--r--src/gui/base/gui.cpp2
-rw-r--r--src/gui/base/gui.hpp2
-rw-r--r--src/gui/base/input.hpp3
-rw-r--r--src/gui/base/mouseinput.cpp136
-rw-r--r--src/gui/base/widget.cpp2
-rw-r--r--src/gui/base/widget.hpp2
-rw-r--r--src/gui/base/widgets/button.cpp3
-rw-r--r--src/gui/base/widgets/checkbox.cpp3
-rw-r--r--src/gui/base/widgets/listbox.cpp3
-rw-r--r--src/gui/base/widgets/radiobutton.cpp3
-rw-r--r--src/gui/base/widgets/slider.cpp3
-rw-r--r--src/gui/base/widgets/textbox.cpp3
-rw-r--r--src/gui/base/widgets/textfield.cpp3
-rw-r--r--src/gui/base/widgets/window.cpp2
-rw-r--r--src/gui/gui.cpp19
-rw-r--r--src/gui/gui.h6
-rw-r--r--src/gui/sdlinput.cpp34
-rw-r--r--src/gui/sdlinput.h8
-rw-r--r--src/gui/widgets/itemlinkhandler.cpp11
-rw-r--r--src/input/mouseinput.h (renamed from src/gui/base/mouseinput.hpp)224
-rw-r--r--src/input/multitouchmanager.cpp2
-rw-r--r--src/mouseinput.cpp34
-rw-r--r--src/mouseinput.h63
-rw-r--r--src/touchactions.cpp4
-rw-r--r--src/touchmanager.cpp7
28 files changed, 159 insertions, 435 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3cc4c3dbc..b523f084c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -685,8 +685,7 @@ SET(SRCS
render/mgl.h
render/mobileopenglgraphics.cpp
render/mobileopenglgraphics.h
- mouseinput.cpp
- mouseinput.h
+ input/mouseinput.h
mumblemanager.cpp
mumblemanager.h
navigationmanager.cpp
@@ -781,7 +780,6 @@ SET(SRCS
listeners/keylistener.h
gui/base/listmodel.hpp
events/mouseevent.h
- gui/base/mouseinput.hpp
listeners/mouselistener.h
gui/base/rectangle.hpp
events/selectionevent.h
@@ -806,7 +804,6 @@ SET(SRCS
gui/base/focushandler.cpp
gui/base/gui.cpp
gui/base/key.cpp
- gui/base/mouseinput.cpp
gui/base/rectangle.cpp
gui/base/widget.cpp
gui/base/widgets/button.cpp
diff --git a/src/Makefile.am b/src/Makefile.am
index aa5314c52..19f8fe4f2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -168,7 +168,6 @@ manaplus_SOURCES += events/actionevent.h \
listeners/keylistener.h \
gui/base/listmodel.hpp \
events/mouseevent.h \
- gui/base/mouseinput.hpp \
listeners/mouselistener.h \
gui/base/rectangle.hpp \
events/selectionevent.h \
@@ -193,7 +192,6 @@ manaplus_SOURCES += events/actionevent.h \
gui/base/focushandler.cpp \
gui/base/gui.cpp \
gui/base/key.cpp \
- gui/base/mouseinput.cpp \
gui/base/rectangle.cpp \
gui/base/widget.cpp \
gui/base/widgets/button.cpp \
@@ -792,8 +790,7 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \
render/mgl.h \
render/mobileopenglgraphics.cpp \
render/mobileopenglgraphics.h \
- mouseinput.cpp \
- mouseinput.h \
+ input/mouseinput.h \
navigationmanager.cpp \
navigationmanager.h \
render/normalopenglgraphics.cpp \
diff --git a/src/gui/base/basiccontainer.cpp b/src/gui/base/basiccontainer.cpp
index 4a745dc63..82ef1c025 100644
--- a/src/gui/base/basiccontainer.cpp
+++ b/src/gui/base/basiccontainer.cpp
@@ -70,7 +70,7 @@
#include <algorithm>
#include "gui/base/focushandler.hpp"
-#include "gui/base/mouseinput.hpp"
+#include "input/mouseinput.h"
#include "render/graphics.h"
diff --git a/src/gui/base/gui.cpp b/src/gui/base/gui.cpp
index 56e40291a..e5291cb60 100644
--- a/src/gui/base/gui.cpp
+++ b/src/gui/base/gui.cpp
@@ -70,10 +70,10 @@
#include "gui/base/basiccontainer.hpp"
#include "gui/base/focushandler.hpp"
#include "gui/base/input.hpp"
-#include "gui/base/mouseinput.hpp"
#include "gui/base/widget.hpp"
#include "input/keyinput.h"
+#include "input/mouseinput.h"
#include "listeners/keylistener.h"
#include "listeners/mouselistener.h"
diff --git a/src/gui/base/gui.hpp b/src/gui/base/gui.hpp
index b853a4210..2ec5d7082 100644
--- a/src/gui/base/gui.hpp
+++ b/src/gui/base/gui.hpp
@@ -70,7 +70,7 @@
#include "events/keyevent.h"
#include "events/mouseevent.h"
-#include "gui/base/mouseinput.hpp"
+#include "input/mouseinput.h"
class Graphics;
class KeyListener;
diff --git a/src/gui/base/input.hpp b/src/gui/base/input.hpp
index 40aed4d84..1643482d3 100644
--- a/src/gui/base/input.hpp
+++ b/src/gui/base/input.hpp
@@ -67,11 +67,10 @@
#include "localconsts.h"
class KeyInput;
+class MouseInput;
namespace gcn
{
- class MouseInput;
-
/**
* Abstract class for providing functions for user input.
*
diff --git a/src/gui/base/mouseinput.cpp b/src/gui/base/mouseinput.cpp
deleted file mode 100644
index bc5d6c8e0..000000000
--- a/src/gui/base/mouseinput.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * The ManaPlus Client
- * Copyright (C) 2011-2014 The ManaPlus Developers
- *
- * This file is part of The ManaPlus Client.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/* _______ __ __ __ ______ __ __ _______ __ __
- * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
- * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
- * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
- * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
- * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
- * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
- *
- * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson
- *
- *
- * Per Larsson a.k.a finalman
- * Olof Naessén a.k.a jansem/yakslem
- *
- * Visit: http://guichan.sourceforge.net
- *
- * License: (BSD)
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name of Guichan nor the names of its contributors may
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * For comments regarding functions please see the header file.
- */
-
-#include "gui/base/mouseinput.hpp"
-
-#include "debug.h"
-
-namespace gcn
-{
- MouseInput::MouseInput(const unsigned int button,
- const unsigned int type,
- const int x,
- const int y,
- const int timeStamp) :
- mType(type),
- mButton(button),
- mTimeStamp(timeStamp),
- mX(x),
- mY(y)
- {
- }
-
- void MouseInput::setType(unsigned int type)
- {
- mType = type;
- }
-
- unsigned int MouseInput::getType() const
- {
- return mType;
- }
-
- void MouseInput::setButton(unsigned int button)
- {
- mButton = button;
- }
-
- unsigned int MouseInput::getButton() const
- {
- return mButton;
- }
-
- int MouseInput::getTimeStamp() const
- {
- return mTimeStamp;
- }
-
- void MouseInput::setTimeStamp(int timeStamp)
- {
- mTimeStamp = timeStamp;
- }
-
- void MouseInput::setX(int x)
- {
- mX = x;
- }
-
- int MouseInput::getX() const
- {
- return mX;
- }
-
- void MouseInput::setY(int y)
- {
- mY = y;
- }
-
- int MouseInput::getY() const
- {
- return mY;
- }
-} // namespace gcn
diff --git a/src/gui/base/widget.cpp b/src/gui/base/widget.cpp
index cf3605446..5b4ada76e 100644
--- a/src/gui/base/widget.cpp
+++ b/src/gui/base/widget.cpp
@@ -73,9 +73,9 @@
#include "gui/base/basiccontainer.hpp"
#include "gui/base/focushandler.hpp"
-#include "gui/base/mouseinput.hpp"
#include "input/keyinput.h"
+#include "input/mouseinput.h"
#include "listeners/actionlistener.h"
#include "listeners/deathlistener.h"
diff --git a/src/gui/base/widget.hpp b/src/gui/base/widget.hpp
index 4043c959a..f2718697e 100644
--- a/src/gui/base/widget.hpp
+++ b/src/gui/base/widget.hpp
@@ -80,6 +80,7 @@ class Font;
class Graphics;
class KeyInput;
class KeyListener;
+class MouseInput;
class MouseListener;
class WidgetListener;
@@ -87,7 +88,6 @@ namespace gcn
{
class BasicContainer;
class FocusHandler;
- class MouseInput;
/**
* Abstract class for widgets of Guichan. It contains basic functions
diff --git a/src/gui/base/widgets/button.cpp b/src/gui/base/widgets/button.cpp
index 9b7473293..56ba72590 100644
--- a/src/gui/base/widgets/button.cpp
+++ b/src/gui/base/widgets/button.cpp
@@ -70,7 +70,8 @@
#include "gui/font.h"
#include "gui/base/key.hpp"
-#include "gui/base/mouseinput.hpp"
+
+#include "input/mouseinput.h"
#include "events/mouseevent.h"
diff --git a/src/gui/base/widgets/checkbox.cpp b/src/gui/base/widgets/checkbox.cpp
index 0a3171fe8..18f635052 100644
--- a/src/gui/base/widgets/checkbox.cpp
+++ b/src/gui/base/widgets/checkbox.cpp
@@ -70,7 +70,8 @@
#include "gui/font.h"
#include "gui/base/key.hpp"
-#include "gui/base/mouseinput.hpp"
+
+#include "input/mouseinput.h"
#include "render/graphics.h"
diff --git a/src/gui/base/widgets/listbox.cpp b/src/gui/base/widgets/listbox.cpp
index 6c6472636..f13a96e39 100644
--- a/src/gui/base/widgets/listbox.cpp
+++ b/src/gui/base/widgets/listbox.cpp
@@ -72,7 +72,8 @@
#include "gui/base/basiccontainer.hpp"
#include "gui/base/key.hpp"
#include "gui/base/listmodel.hpp"
-#include "gui/base/mouseinput.hpp"
+
+#include "input/mouseinput.h"
#include "listeners/selectionlistener.h"
diff --git a/src/gui/base/widgets/radiobutton.cpp b/src/gui/base/widgets/radiobutton.cpp
index f0430c7a2..ff6a39db0 100644
--- a/src/gui/base/widgets/radiobutton.cpp
+++ b/src/gui/base/widgets/radiobutton.cpp
@@ -70,7 +70,8 @@
#include "gui/font.h"
#include "gui/base/key.hpp"
-#include "gui/base/mouseinput.hpp"
+
+#include "input/mouseinput.h"
#include "render/graphics.h"
diff --git a/src/gui/base/widgets/slider.cpp b/src/gui/base/widgets/slider.cpp
index 91c054e7d..d61f2766c 100644
--- a/src/gui/base/widgets/slider.cpp
+++ b/src/gui/base/widgets/slider.cpp
@@ -68,7 +68,8 @@
#include "gui/base/widgets/slider.hpp"
#include "gui/base/key.hpp"
-#include "gui/base/mouseinput.hpp"
+
+#include "input/mouseinput.h"
#include "render/graphics.h"
diff --git a/src/gui/base/widgets/textbox.cpp b/src/gui/base/widgets/textbox.cpp
index e994804d8..db5d91b92 100644
--- a/src/gui/base/widgets/textbox.cpp
+++ b/src/gui/base/widgets/textbox.cpp
@@ -71,7 +71,8 @@
#include "gui/base/basiccontainer.hpp"
#include "gui/base/key.hpp"
-#include "gui/base/mouseinput.hpp"
+
+#include "input/mouseinput.h"
#include "render/graphics.h"
diff --git a/src/gui/base/widgets/textfield.cpp b/src/gui/base/widgets/textfield.cpp
index 1514d3afb..891e7e86b 100644
--- a/src/gui/base/widgets/textfield.cpp
+++ b/src/gui/base/widgets/textfield.cpp
@@ -70,7 +70,8 @@
#include "gui/font.h"
#include "gui/base/key.hpp"
-#include "gui/base/mouseinput.hpp"
+
+#include "input/mouseinput.h"
#include "render/graphics.h"
diff --git a/src/gui/base/widgets/window.cpp b/src/gui/base/widgets/window.cpp
index fbd42aff2..8d33c1dd5 100644
--- a/src/gui/base/widgets/window.cpp
+++ b/src/gui/base/widgets/window.cpp
@@ -69,7 +69,7 @@
#include "gui/font.h"
-#include "gui/base/mouseinput.hpp"
+#include "input/mouseinput.h"
#include "render/graphics.h"
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 85aeb15f5..243b3817e 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -20,8 +20,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "mouseinput.h"
-
#include "gui/gui.h"
#include "gui/focushandler.h"
@@ -44,6 +42,7 @@
#include "input/keydata.h"
#include "input/keyinput.h"
+#include "input/mouseinput.h"
#include "resources/cursor.h"
#include "resources/image.h"
@@ -524,13 +523,13 @@ void Gui::setUseCustomCursor(const bool customCursor)
}
}
-void Gui::handleMouseMoved(const gcn::MouseInput &mouseInput)
+void Gui::handleMouseMoved(const MouseInput &mouseInput)
{
gcn::Gui::handleMouseMoved(mouseInput);
mMouseInactivityTimer = 0;
}
-void Gui::handleMousePressed(const gcn::MouseInput &mouseInput)
+void Gui::handleMousePressed(const MouseInput &mouseInput)
{
const int x = mouseInput.getX();
const int y = mouseInput.getY();
@@ -781,19 +780,19 @@ void Gui::handleMouseInput()
#endif
switch (mouseInput.getType())
{
- case gcn::MouseInput::PRESSED:
+ case MouseInput::PRESSED:
handleMousePressed(mouseInput);
break;
- case gcn::MouseInput::RELEASED:
+ case MouseInput::RELEASED:
handleMouseReleased(mouseInput);
break;
- case gcn::MouseInput::MOVED:
+ case MouseInput::MOVED:
handleMouseMoved(mouseInput);
break;
- case gcn::MouseInput::WHEEL_MOVED_DOWN:
+ case MouseInput::WHEEL_MOVED_DOWN:
handleMouseWheelMovedDown(mouseInput);
break;
- case gcn::MouseInput::WHEEL_MOVED_UP:
+ case MouseInput::WHEEL_MOVED_UP:
handleMouseWheelMovedUp(mouseInput);
break;
default:
@@ -803,7 +802,7 @@ void Gui::handleMouseInput()
BLOCK_END("Gui::handleMouseInput")
}
-void Gui::handleMouseReleased(const gcn::MouseInput &mouseInput)
+void Gui::handleMouseReleased(const MouseInput &mouseInput)
{
gcn::Widget *sourceWidget = getMouseEventSource(
mouseInput.getX(), mouseInput.getY());
diff --git a/src/gui/gui.h b/src/gui/gui.h
index 1660fcfbf..b790d4d2c 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -169,11 +169,11 @@ class Gui final : public gcn::Gui
static uint32_t getMouseState(int *const x, int *const y);
protected:
- void handleMouseMoved(const gcn::MouseInput &mouseInput);
+ void handleMouseMoved(const MouseInput &mouseInput);
- void handleMouseReleased(const gcn::MouseInput &mouseInput);
+ void handleMouseReleased(const MouseInput &mouseInput);
- void handleMousePressed(const gcn::MouseInput &mouseInput);
+ void handleMousePressed(const MouseInput &mouseInput);
void handleMouseInput();
diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp
index b61f858e8..21a8d3957 100644
--- a/src/gui/sdlinput.cpp
+++ b/src/gui/sdlinput.cpp
@@ -119,9 +119,9 @@ bool SDLInput::isMouseQueueEmpty()
return mMouseInputQueue.empty();
}
-gcn::MouseInput SDLInput::dequeueMouseInput()
+MouseInput SDLInput::dequeueMouseInput()
{
- gcn::MouseInput mouseInput;
+ MouseInput mouseInput;
if (mMouseInputQueue.empty())
return MouseInput();
@@ -189,9 +189,9 @@ void SDLInput::pushInput(const SDL_Event &event)
#endif
mouseInput.setButton(-1);
if (y > 0)
- mouseInput.setType(gcn::MouseInput::WHEEL_MOVED_UP);
+ mouseInput.setType(MouseInput::WHEEL_MOVED_UP);
else
- mouseInput.setType(gcn::MouseInput::WHEEL_MOVED_DOWN);
+ mouseInput.setType(MouseInput::WHEEL_MOVED_DOWN);
mouseInput.setTimeStamp(SDL_GetTicks());
mMouseInputQueue.push(mouseInput);
}
@@ -227,12 +227,12 @@ void SDLInput::pushInput(const SDL_Event &event)
#ifndef USE_SDL2
if (event.button.button == SDL_BUTTON_WHEELDOWN)
- mouseInput.setType(gcn::MouseInput::WHEEL_MOVED_DOWN);
+ mouseInput.setType(MouseInput::WHEEL_MOVED_DOWN);
else if (event.button.button == SDL_BUTTON_WHEELUP)
- mouseInput.setType(gcn::MouseInput::WHEEL_MOVED_UP);
+ mouseInput.setType(MouseInput::WHEEL_MOVED_UP);
else
#endif
- mouseInput.setType(gcn::MouseInput::PRESSED);
+ mouseInput.setType(MouseInput::PRESSED);
mouseInput.setTimeStamp(SDL_GetTicks());
mMouseInputQueue.push(mouseInput);
break;
@@ -254,7 +254,7 @@ void SDLInput::pushInput(const SDL_Event &event)
#endif
#endif
mouseInput.setButton(convertMouseButton(event.button.button));
- mouseInput.setType(gcn::MouseInput::RELEASED);
+ mouseInput.setType(MouseInput::RELEASED);
mouseInput.setTimeStamp(SDL_GetTicks());
mMouseInputQueue.push(mouseInput);
break;
@@ -274,8 +274,8 @@ void SDLInput::pushInput(const SDL_Event &event)
event.motion.realy / scale);
#endif
#endif
- mouseInput.setButton(gcn::MouseInput::EMPTY);
- mouseInput.setType(gcn::MouseInput::MOVED);
+ mouseInput.setButton(MouseInput::EMPTY);
+ mouseInput.setType(MouseInput::MOVED);
mouseInput.setTimeStamp(SDL_GetTicks());
mMouseInputQueue.push(mouseInput);
break;
@@ -295,8 +295,8 @@ void SDLInput::pushInput(const SDL_Event &event)
{
mouseInput.setX(-1);
mouseInput.setY(-1);
- mouseInput.setButton(gcn::MouseInput::EMPTY);
- mouseInput.setType(gcn::MouseInput::MOVED);
+ mouseInput.setButton(MouseInput::EMPTY);
+ mouseInput.setType(MouseInput::MOVED);
mMouseInputQueue.push(mouseInput);
}
}
@@ -338,11 +338,11 @@ int SDLInput::convertMouseButton(const int button)
switch (button)
{
case SDL_BUTTON_LEFT:
- return gcn::MouseInput::LEFT;
+ return MouseInput::LEFT;
case SDL_BUTTON_RIGHT:
- return gcn::MouseInput::RIGHT;
+ return MouseInput::RIGHT;
case SDL_BUTTON_MIDDLE:
- return gcn::MouseInput::MIDDLE;
+ return MouseInput::MIDDLE;
default:
// We have an unknown mouse type which is ignored.
return button;
@@ -569,10 +569,10 @@ void SDLInput::simulateMouseClick(const int x, const int y,
mouseInput.setY(y);
mouseInput.setReal(x, y);
mouseInput.setButton(button);
- mouseInput.setType(gcn::MouseInput::PRESSED);
+ mouseInput.setType(MouseInput::PRESSED);
mouseInput.setTimeStamp(SDL_GetTicks());
mMouseInputQueue.push(mouseInput);
- mouseInput.setType(gcn::MouseInput::RELEASED);
+ mouseInput.setType(MouseInput::RELEASED);
mouseInput.setTimeStamp(SDL_GetTicks());
mMouseInputQueue.push(mouseInput);
}
diff --git a/src/gui/sdlinput.h b/src/gui/sdlinput.h
index 73e2896d5..1a19e8790 100644
--- a/src/gui/sdlinput.h
+++ b/src/gui/sdlinput.h
@@ -79,13 +79,13 @@
#define GUI_SDLINPUT_H
#include "input/keyinput.h"
-
-#include "mouseinput.h"
+#include "input/mouseinput.h"
#include <SDL_events.h>
#include "gui/base/input.hpp"
-#include "gui/base/mouseinput.hpp"
+
+#include "input/mouseinput.h"
#include <queue>
@@ -184,7 +184,7 @@ public:
bool isMouseQueueEmpty() override final A_WARN_UNUSED;
- gcn::MouseInput dequeueMouseInput() override final A_WARN_UNUSED;
+ MouseInput dequeueMouseInput() override final A_WARN_UNUSED;
MouseInput dequeueMouseInput2() A_WARN_UNUSED;
diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp
index deb3b4451..3e9a99a2a 100644
--- a/src/gui/widgets/itemlinkhandler.cpp
+++ b/src/gui/widgets/itemlinkhandler.cpp
@@ -35,10 +35,11 @@
#include "resources/db/itemdb.h"
-#include <string>
-
#include "listeners/actionlistener.h"
-#include "gui/base/mouseinput.hpp"
+
+#include "input/mouseinput.h"
+
+#include <string>
#include "debug.h"
@@ -85,7 +86,7 @@ void ItemLinkHandler::handleLink(const std::string &link, MouseEvent *event)
replaceAll(url, " ", "");
listener.url = url;
const int button = event->getButton();
- if (button == gcn::MouseInput::LEFT)
+ if (button == MouseInput::LEFT)
{
ConfirmDialog *const confirmDlg = new ConfirmDialog(
// TRANSLATORS: dialog message
@@ -93,7 +94,7 @@ void ItemLinkHandler::handleLink(const std::string &link, MouseEvent *event)
confirmDlg->postInit();
confirmDlg->addActionListener(&listener);
}
- else if (button == gcn::MouseInput::RIGHT)
+ else if (button == MouseInput::RIGHT)
{
if (viewport)
viewport->showLinkPopup(url);
diff --git a/src/gui/base/mouseinput.hpp b/src/input/mouseinput.h
index 018205740..5ece1f77a 100644
--- a/src/gui/base/mouseinput.hpp
+++ b/src/input/mouseinput.h
@@ -1,6 +1,6 @@
/*
* The ManaPlus Client
- * Copyright (C) 2011-2014 The ManaPlus Developers
+ * Copyright (C) 2012-2014 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -61,148 +61,28 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef GCN_MOUSEINPUT_HPP
-#define GCN_MOUSEINPUT_HPP
+#ifndef MOUSEINPUT_H
+#define MOUSEINPUT_H
+
+#include "input/mouseinput.h"
#include "localconsts.h"
-namespace gcn
+class MouseInput final
{
-
- /**
- * Internal class that represents mouse input. Generally you won't have to
- * bother using this class unless you implement an Input class for
- * a back end.
- *
- * @author Olof Naessén
- * @author Per Larsson
- * @since 0.1.0
- */
- class MouseInput
- {
public:
- /**
- * Constructor.
- */
MouseInput() :
mType(0),
mButton(0),
mTimeStamp(0),
mX(0),
- mY(0)
+ mY(0),
+ mRealX(0),
+ mRealY(0)
{ }
- /**
- * Constructor.
- *
- * @param button The button pressed.
- * @param type The type of mouse input.
- * @param x The mouse x coordinate.
- * @param y The mouse y coordinate.
- * @param timeStamp The timestamp of the mouse input. Used to
- * check for double clicks.
- */
- MouseInput(const unsigned int button,
- const unsigned int type,
- const int x,
- const int y,
- const int timeStamp);
-
- /**
- * Sets the type of the mouse input.
- *
- * @param type The type of the mouse input. Should be a value from the
- * mouse event type enum
- * @see getType
- * @since 0.1.0
- */
- void setType(unsigned int type);
-
- /**
- * Gets the type of the mouse input.
- *
- * @return The type of the mouse input. A value from the mouse event
- * type enum.
- * @see setType
- * @since 0.1.0
- */
- unsigned int getType() const A_WARN_UNUSED;
-
- /**
- * Sets the button pressed.
- *
- * @param button The button pressed. Should be one of the values
- * in the mouse event button enum.
- * @see getButton.
- * @since 0.1.0
- */
- void setButton(unsigned int button);
-
- /**
- * Gets the button pressed.
- *
- * @return The button pressed. A value from the mouse event
- * button enum.
- * @see setButton
- * @since 0.1.0
- */
- unsigned int getButton() const A_WARN_UNUSED;
-
- /**
- * Sets the timestamp for the mouse input.
- * Used to check for double clicks.
- *
- * @param timeStamp The timestamp of the mouse input.
- * @see getTimeStamp
- * @since 0.1.0
- */
- void setTimeStamp(int timeStamp);
-
- /**
- * Gets the time stamp of the input.
- * Used to check for double clicks.
- *
- * @return The time stamp of the mouse input.
- * @see setTimeStamp
- * @since 0.1.0
- */
- int getTimeStamp() const A_WARN_UNUSED;
-
- /**
- * Sets the x coordinate of the mouse input.
- *
- * @param x The x coordinate of the mouse input.
- * @see getX
- * @since 0.6.0
- */
- void setX(int x);
-
- /**
- * Gets the x coordinate of the mouse input.
- *
- * @return The x coordinate of the mouse input.
- * @see setX
- * @since 0.6.0
- */
- int getX() const A_WARN_UNUSED;
-
- /**
- * Sets the y coordinate of the mouse input.
- *
- * @param y The y coordinate of the mouse input.
- * @see getY
- * @since 0.6.0
- */
- void setY(int y);
-
- /**
- * Gets the y coordinate of the mouse input.
- *
- * @return The y coordinate of the mouse input.
- * @see setY
- * @since 0.6.0
- */
- int getY() const A_WARN_UNUSED;
+ ~MouseInput()
+ { }
/**
* Mouse input event types. This enum partially corresponds
@@ -228,6 +108,79 @@ namespace gcn
MIDDLE
};
+ void setType(unsigned int type)
+ {
+ mType = type;
+ }
+
+ unsigned int getType() const
+ {
+ return mType;
+ }
+
+ void setButton(unsigned int button)
+ {
+ mButton = button;
+ }
+
+ unsigned int getButton() const
+ {
+ return mButton;
+ }
+
+ int getTimeStamp() const
+ {
+ return mTimeStamp;
+ }
+
+ void setTimeStamp(int timeStamp)
+ {
+ mTimeStamp = timeStamp;
+ }
+
+ void setX(int x)
+ {
+ mX = x;
+ }
+
+ int getX() const
+ {
+ return mX;
+ }
+
+ void setY(int y)
+ {
+ mY = y;
+ }
+
+ int getY() const
+ {
+ return mY;
+ }
+
+ void setReal(const int x, const int y)
+ { mRealX = x; mRealY = y; }
+
+ int getRealX() const A_WARN_UNUSED
+ { return mRealX; }
+
+ int getRealY() const A_WARN_UNUSED
+ { return mRealY; }
+
+#ifdef ANDROID
+ int getTouchX() const A_WARN_UNUSED
+ { return mRealX; }
+
+ int getTouchY() const A_WARN_UNUSED
+ { return mRealY; }
+#else
+ int getTouchX() const A_WARN_UNUSED
+ { return mX; }
+
+ int getTouchY() const A_WARN_UNUSED
+ { return mY; }
+#endif
+
protected:
/**
* Holds the type of the mouse input.
@@ -254,7 +207,10 @@ namespace gcn
* Holds the y coordinate of the mouse input.
*/
int mY;
- };
-} // namespace gcn
-#endif // end GCN_MOUSEINPUT_HPP
+ int mRealX;
+
+ int mRealY;
+};
+
+#endif // MOUSEINPUT_H
diff --git a/src/input/multitouchmanager.cpp b/src/input/multitouchmanager.cpp
index 7e6798807..446e40aa1 100644
--- a/src/input/multitouchmanager.cpp
+++ b/src/input/multitouchmanager.cpp
@@ -82,7 +82,7 @@ void MultiTouchManager::checkDevice(const int touchId,
const int w = mainGraphics->mWidth;
const int h = mainGraphics->mHeight;
guiInput->simulateMouseClick(finger0.x * w, finger0.y * h,
- gcn::MouseInput::RIGHT);
+ MouseInput::RIGHT);
}
}
}
diff --git a/src/mouseinput.cpp b/src/mouseinput.cpp
deleted file mode 100644
index 208690935..000000000
--- a/src/mouseinput.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * The ManaPlus Client
- * Copyright (C) 2012-2014 The ManaPlus Developers
- *
- * This file is part of The ManaPlus Client.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "mouseinput.h"
-
-#include "debug.h"
-
-MouseInput::MouseInput() :
- gcn::MouseInput(),
- mRealX(0),
- mRealY(0)
-{
-}
-
-MouseInput::~MouseInput()
-{
-}
diff --git a/src/mouseinput.h b/src/mouseinput.h
deleted file mode 100644
index 47e04eceb..000000000
--- a/src/mouseinput.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * The ManaPlus Client
- * Copyright (C) 2012-2014 The ManaPlus Developers
- *
- * This file is part of The ManaPlus Client.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef MOUSEINPUT_H
-#define MOUSEINPUT_H
-
-#include "gui/base/mouseinput.hpp"
-
-#include "localconsts.h"
-
-class MouseInput final : public gcn::MouseInput
-{
- public:
- MouseInput();
-
- ~MouseInput();
-
- void setReal(const int x, const int y)
- { mRealX = x; mRealY = y; }
-
- int getRealX() const A_WARN_UNUSED
- { return mRealX; }
-
- int getRealY() const A_WARN_UNUSED
- { return mRealY; }
-
-#ifdef ANDROID
- int getTouchX() const A_WARN_UNUSED
- { return mRealX; }
-
- int getTouchY() const A_WARN_UNUSED
- { return mRealY; }
-#else
- int getTouchX() const A_WARN_UNUSED
- { return mX; }
-
- int getTouchY() const A_WARN_UNUSED
- { return mY; }
-#endif
-
- protected:
- int mRealX;
- int mRealY;
-};
-
-#endif // MOUSEINPUT_H
diff --git a/src/touchactions.cpp b/src/touchactions.cpp
index a79c14275..d4f7d9f6e 100644
--- a/src/touchactions.cpp
+++ b/src/touchactions.cpp
@@ -20,10 +20,10 @@
#include "touchactions.h"
-#include "mouseinput.h"
#include "touchmanager.h"
#include "input/inputmanager.h"
+#include "input/mouseinput.h"
#include "debug.h"
@@ -109,7 +109,7 @@ impHandler(padClick)
impHandler(padEvents)
{
- if (mouseInput.getType() == gcn::MouseInput::MOVED)
+ if (mouseInput.getType() == MouseInput::MOVED)
{
if (padClicked)
moveChar(mouseInput.getX(), mouseInput.getY());
diff --git a/src/touchmanager.cpp b/src/touchmanager.cpp
index 8c4c8b0db..20c56b8d6 100644
--- a/src/touchmanager.cpp
+++ b/src/touchmanager.cpp
@@ -22,9 +22,10 @@
#include "configuration.h"
#include "graphicsvertexes.h"
-#include "mouseinput.h"
#include "touchactions.h"
+#include "input/mouseinput.h"
+
#include "gui/font.h"
#include "gui/gui.h"
@@ -278,13 +279,13 @@ bool TouchManager::processEvent(const MouseInput &mouseInput)
switch (mouseInput.getType())
{
- case gcn::MouseInput::PRESSED:
+ case MouseInput::PRESSED:
if (!item->eventPressed.empty())
executeAction(item->eventPressed);
else if (item->funcPressed)
item->funcPressed(event);
break;
- case gcn::MouseInput::RELEASED:
+ case MouseInput::RELEASED:
if (!item->eventReleased.empty())
executeAction(item->eventReleased);
else if (item->funcReleased)