[Scummvm-cvs-logs] SF.net SVN: scummvm:[35666] scummvm/trunk/gui/dialog.cpp
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Fri Jan 2 03:48:06 CET 2009
Revision: 35666
http://scummvm.svn.sourceforge.net/scummvm/?rev=35666&view=rev
Author: lordhoto
Date: 2009-01-02 02:48:06 +0000 (Fri, 02 Jan 2009)
Log Message:
-----------
Modified the way button highlights are processed when a widget is in dragging mode. This allows for example unhighlighting of a button when the user clicked on it but moved the mouse away.
Modified Paths:
--------------
scummvm/trunk/gui/dialog.cpp
Modified: scummvm/trunk/gui/dialog.cpp
===================================================================
--- scummvm/trunk/gui/dialog.cpp 2009-01-02 01:36:38 UTC (rev 35665)
+++ scummvm/trunk/gui/dialog.cpp 2009-01-02 02:48:06 UTC (rev 35666)
@@ -250,9 +250,6 @@
void Dialog::handleMouseMoved(int x, int y, int button) {
Widget *w;
- //if (!button)
- // _dragWidget = 0;
-
if (_focusedWidget && !_dragWidget) {
w = _focusedWidget;
int wx = w->getAbsX() - _x;
@@ -271,27 +268,38 @@
w->handleMouseLeft(button);
}
- w->handleMouseMoved(x - wx, y - wy, button);
+ if (w->getFlags() & WIDGET_TRACK_MOUSE)
+ w->handleMouseMoved(x - wx, y - wy, button);
}
- // While a "drag" is in process (i.e. mouse is moved while a button is pressed),
- // only deal with the widget in which the click originated.
- if (_dragWidget)
+ // We process mouseEntered/Left events if we don't have any
+ // currently active dragged widget or if the currently dragged widget
+ // does not want to be informed about the mouse mouse events.
+ if (!_dragWidget || !(_dragWidget->getFlags() & WIDGET_TRACK_MOUSE))
+ w = findWidget(x, y);
+ else
w = _dragWidget;
- else
- w = findWidget(x, y);
if (_mouseWidget != w) {
if (_mouseWidget)
_mouseWidget->handleMouseLeft(button);
+
+ // If we have a widget in drag mode we prevent mouseEntered
+ // events from being sent to other widgets.
+ if (_dragWidget && w != _dragWidget)
+ w = 0;
+
if (w)
w->handleMouseEntered(button);
_mouseWidget = w;
}
- if (w && (w->getFlags() & WIDGET_TRACK_MOUSE)) {
+ // We only sent mouse move events under the following conditions:
+ // 1) We have a widget in drag mode
+ // 2) The widget wants to track the mouse movement
+ w = _dragWidget;
+ if (w && (w->getFlags() & WIDGET_TRACK_MOUSE))
w->handleMouseMoved(x - (w->getAbsX() - _x), y - (w->getAbsY() - _y), button);
- }
}
void Dialog::handleTickle() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list