aboutsummaryrefslogtreecommitdiff
path: root/engines/wage
diff options
context:
space:
mode:
authorEugene Sandulenko2016-04-24 09:58:09 +0200
committerEugene Sandulenko2016-04-24 09:58:36 +0200
commitca4a948240b771e0bb3eeeb4d21fd357b89818b2 (patch)
tree2f2abfc33e0ec752e351d4c71ecc9496fea376ba /engines/wage
parentbb6bf4b1cb8ce256c6cb16603a9c2a2c892088e2 (diff)
downloadscummvm-rg350-ca4a948240b771e0bb3eeeb4d21fd357b89818b2.tar.gz
scummvm-rg350-ca4a948240b771e0bb3eeeb4d21fd357b89818b2.tar.bz2
scummvm-rg350-ca4a948240b771e0bb3eeeb4d21fd357b89818b2.zip
WAGE: Fixed window dragging up
Diffstat (limited to 'engines/wage')
-rw-r--r--engines/wage/macwindow.cpp20
-rw-r--r--engines/wage/macwindow.h2
-rw-r--r--engines/wage/macwindowmanager.cpp2
3 files changed, 12 insertions, 12 deletions
diff --git a/engines/wage/macwindow.cpp b/engines/wage/macwindow.cpp
index 36c4e1063d..f72def0a3a 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 96a0e237f3..a271a54566 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 c8454dda87..798d25f4ed 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());