[Scummvm-cvs-logs] scummvm master -> c37d4af516b65771b1580ac8cbb03759d04f00c2

eriktorbjorn eriktorbjorn at telia.com
Sat Mar 21 17:46:10 CET 2015


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
16ba21259b GUI: Adjust x and y to handleMouseWheel() for consistency
c37d4af516 GUI: Fix bug #6813, "GUI: Tooltips eat keypresses"


Commit: 16ba21259b2aaf3b9ee9acae2e0aba95df1dea36
    https://github.com/scummvm/scummvm/commit/16ba21259b2aaf3b9ee9acae2e0aba95df1dea36
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2015-03-21T17:45:05+01:00

Commit Message:
GUI: Adjust x and y to handleMouseWheel() for consistency

This means x and y has the same meaning as in the other handlers,
e.g. handleMouseUp(). Though as far as I can tell, these coordinates
aren't actually used anywhere at the moment.

Changed paths:
    gui/dialog.cpp



diff --git a/gui/dialog.cpp b/gui/dialog.cpp
index fa4e508..315c24e 100644
--- a/gui/dialog.cpp
+++ b/gui/dialog.cpp
@@ -219,7 +219,7 @@ void Dialog::handleMouseWheel(int x, int y, int direction) {
 	if (!w)
 		w = _focusedWidget;
 	if (w)
-		w->handleMouseWheel(x, y, direction);
+		w->handleMouseWheel(x - (w->getAbsX() - _x), y - (w->getAbsY() - _y), direction);
 }
 
 void Dialog::handleKeyDown(Common::KeyState state) {


Commit: c37d4af516b65771b1580ac8cbb03759d04f00c2
    https://github.com/scummvm/scummvm/commit/c37d4af516b65771b1580ac8cbb03759d04f00c2
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2015-03-21T17:45:05+01:00

Commit Message:
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.

Changed paths:
    gui/Tooltip.cpp
    gui/Tooltip.h



diff --git a/gui/Tooltip.cpp b/gui/Tooltip.cpp
index e5f06bc..ba313ee 100644
--- a/gui/Tooltip.cpp
+++ b/gui/Tooltip.cpp
@@ -40,6 +40,8 @@ Tooltip::Tooltip() :
 void Tooltip::setup(Dialog *parent, Widget *widget, int x, int y) {
 	assert(widget->hasTooltip());
 
+	_parent = parent;
+
 	_maxWidth = g_gui.xmlEval()->getVar("Globals.Tooltip.MaxWidth", 100);
 	_xdelta = g_gui.xmlEval()->getVar("Globals.Tooltip.XDelta", 0);
 	_ydelta = g_gui.xmlEval()->getVar("Globals.Tooltip.YDelta", 0);
diff --git a/gui/Tooltip.h b/gui/Tooltip.h
index f83fc40..58b6d8a 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;






More information about the Scummvm-git-logs mailing list