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

sev- sev at scummvm.org
Sun Apr 24 09:58:54 CEST 2016


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

Summary:
ca4a948240 WAGE: Fixed window dragging up


Commit: ca4a948240b771e0bb3eeeb4d21fd357b89818b2
    https://github.com/scummvm/scummvm/commit/ca4a948240b771e0bb3eeeb4d21fd357b89818b2
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-04-24T09:58:36+02:00

Commit Message:
WAGE: Fixed window dragging up

Changed paths:
    engines/wage/macwindow.cpp
    engines/wage/macwindow.h
    engines/wage/macwindowmanager.cpp



diff --git a/engines/wage/macwindow.cpp b/engines/wage/macwindow.cpp
index 36c4e10..f72def0 100644
--- a/engines/wage/macwindow.cpp
+++ b/engines/wage/macwindow.cpp
@@ -103,8 +103,7 @@ void MacWindow::move(int x, int y) {
 		return;
 
 	_dims.moveTo(x, y);
-
-	_innerDims.setWidth(0); // Invalidate rect
+	updateInnerDims();
 
 	_contentIsDirty = true;
 }
@@ -112,8 +111,7 @@ void MacWindow::move(int x, int y) {
 void MacWindow::setDimensions(const Common::Rect &r) {
 	resize(r.width(), r.height());
 	_dims.moveTo(r.left, r.top);
-
-	_innerDims.setWidth(0); // Invalidate rect
+	updateInnerDims();
 }
 
 bool MacWindow::draw(Graphics::ManagedSurface *g, bool forceRedraw) {
@@ -162,14 +160,14 @@ static void drawPixelInverted(int x, int y, int color, void *data) {
 	}
 }
 
+void MacWindow::updateInnerDims() {
+	_innerDims = _dims;
+	_innerDims.grow(-kBorderWidth);
+}
+
 void MacWindow::drawBorder() {
 	_borderIsDirty = false;
 
-	if (_innerDims.isEmpty()) {
-		_innerDims = _dims;
-		_innerDims.grow(-kBorderWidth);
-	}
-
 	bool active = _active, scrollable = _scrollable, closeable = _active, drawTitle = !_title.empty();
 	const int size = kBorderWidth;
 	int x = 0;
@@ -312,11 +310,11 @@ bool MacWindow::processEvent(Common::Event &event) {
 	case Common::EVENT_MOUSEMOVE:
 		if (_beingDragged) {
 			_dims.translate(event.mouse.x - _draggedX, event.mouse.y - _draggedY);
+			updateInnerDims();
+
 			_draggedX = event.mouse.x;
 			_draggedY = event.mouse.y;
 
-			_innerDims.setWidth(0);
-
 			((WageEngine *)g_engine)->_gui->_wm.setFullRefresh(true);
 		}
 		break;
diff --git a/engines/wage/macwindow.h b/engines/wage/macwindow.h
index 96a0e23..a271a54 100644
--- a/engines/wage/macwindow.h
+++ b/engines/wage/macwindow.h
@@ -88,6 +88,7 @@ public:
 	int getId() { return _id; }
 	bool processEvent(Common::Event &event);
 	void setCallback(bool (*callback)(WindowClick, Common::Event &, void *), void *data) { _callback = callback; _dataPtr = data; }
+	bool beingDragged() { return _beingDragged; }
 
 private:
 	void drawBorder();
@@ -95,6 +96,7 @@ private:
 	void fillRect(Graphics::ManagedSurface *g, int x, int y, int w, int h, int color = kColorBlack);
 	const Graphics::Font *getTitleFont();
 	bool builtInFonts();
+	void updateInnerDims();
 
 private:
 	Graphics::ManagedSurface _surface;
diff --git a/engines/wage/macwindowmanager.cpp b/engines/wage/macwindowmanager.cpp
index c8454dd..798d25f 100644
--- a/engines/wage/macwindowmanager.cpp
+++ b/engines/wage/macwindowmanager.cpp
@@ -128,7 +128,7 @@ bool MacWindowManager::processEvent(Common::Event &event) {
         it--;
         MacWindow *w = *it;
 
-        if (w->getDimensions().contains(event.mouse.x, event.mouse.y)) {
+        if (w->beingDragged() || w->getDimensions().contains(event.mouse.x, event.mouse.y)) {
             if (event.type == Common::EVENT_LBUTTONDOWN || event.type == Common::EVENT_LBUTTONUP)
                 setActive(w->getId());
 






More information about the Scummvm-git-logs mailing list