aboutsummaryrefslogtreecommitdiff
path: root/gui/Tooltip.h
diff options
context:
space:
mode:
authorTorbjörn Andersson2015-03-21 17:41:44 +0100
committerTorbjörn Andersson2015-03-21 17:45:05 +0100
commitc37d4af516b65771b1580ac8cbb03759d04f00c2 (patch)
treeecd50ddb285ca8d2d97d56a2f687f5504a56c8d9 /gui/Tooltip.h
parent16ba21259b2aaf3b9ee9acae2e0aba95df1dea36 (diff)
downloadscummvm-rg350-c37d4af516b65771b1580ac8cbb03759d04f00c2.tar.gz
scummvm-rg350-c37d4af516b65771b1580ac8cbb03759d04f00c2.tar.bz2
scummvm-rg350-c37d4af516b65771b1580ac8cbb03759d04f00c2.zip
GUI: Fix bug #6813, "GUI: Tooltips eat keypresses"
The tooltip isn't really interested in any keyboard and mouse events, other than as a signal to close itself, so pass them back to the parent dialog. From what I understand, the tooltip isn't part of the dialog, so there should be no risk of going into an infinite loop here.
Diffstat (limited to 'gui/Tooltip.h')
-rw-r--r--gui/Tooltip.h33
1 files changed, 27 insertions, 6 deletions
diff --git a/gui/Tooltip.h b/gui/Tooltip.h
index f83fc40966..58b6d8a429 100644
--- a/gui/Tooltip.h
+++ b/gui/Tooltip.h
@@ -32,6 +32,9 @@ namespace GUI {
class Widget;
class Tooltip : public Dialog {
+private:
+ Dialog *_parent;
+
public:
Tooltip();
@@ -39,12 +42,30 @@ public:
void drawDialog();
protected:
- virtual void handleMouseDown(int x, int y, int button, int clickCount) { close(); }
- virtual void handleMouseUp(int x, int y, int button, int clickCount) { close(); }
- virtual void handleMouseWheel(int x, int y, int direction) { close(); }
- virtual void handleKeyDown(Common::KeyState state) { close(); }
- virtual void handleKeyUp(Common::KeyState state) { close(); }
- virtual void handleMouseMoved(int x, int y, int button) { close(); }
+ virtual void handleMouseDown(int x, int y, int button, int clickCount) {
+ close();
+ _parent->handleMouseDown(x + (getAbsX() - _parent->getAbsX()), y + (getAbsY() - _parent->getAbsY()), button, clickCount);
+ }
+ virtual void handleMouseUp(int x, int y, int button, int clickCount) {
+ close();
+ _parent->handleMouseUp(x + (getAbsX() - _parent->getAbsX()), y + (getAbsY() - _parent->getAbsY()), button, clickCount);
+ }
+ virtual void handleMouseWheel(int x, int y, int direction) {
+ close();
+ _parent->handleMouseWheel(x + (getAbsX() - _parent->getAbsX()), y + (getAbsX() - _parent->getAbsX()), direction);
+ }
+ virtual void handleKeyDown(Common::KeyState state) {
+ close();
+ _parent->handleKeyDown(state);
+ }
+ virtual void handleKeyUp(Common::KeyState state) {
+ close();
+ _parent->handleKeyUp(state);
+ }
+ virtual void handleMouseMoved(int x, int y, int button) {
+ close();
+ _parent->handleMouseMoved(x + (getAbsX() - _parent->getAbsX()), y + (getAbsY() - _parent->getAbsY()), button);
+ }
int _maxWidth;
int _xdelta, _ydelta;