[Scummvm-git-logs] scummvm master -> a30930d6e47d901a2acc54b336949598e5e59b5a

sev- noreply at scummvm.org
Sat Sep 27 21:27:29 UTC 2025


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

Summary:
a9b2af4dd4 DIRECTOR: Remove unused variable
722eab16f9 DIRECTOR: LINGO: Clarified 'the clickOn' behavior, 1/2
02b3aef3c3 DIRECTOR: LINGO: Fix 'the clickOn' behavior
5173220d2b DIRECTOR: LINGO: Implement 'on mouseUpOutSide' D6+ event
7cd447034f DIRECTOR: LINGO: Implement 'on mouseWithin' D6+ event handler
b588b38b39 DIRECTOR: Implement 'on closeWindow' D5+ event
b6bbb9004c DIRECTOR: Actually close window when close button is pressed
21aa70a6ea DIRECTOR: Imlpement 'on openWindow' D5+ event handler
75b2c5ffd0 DIRECTOR: LINGO: Made sending events to window generic
4ff643ea7b GRAPHICS: MACGUI: Added getActiveWindow() method
a30930d6e4 DIRECTOR: LINGO: Implement 'the activeWindow' D5+ system property


Commit: a9b2af4dd4aac975e3b601df9af7bead10dbd3cf
    https://github.com/scummvm/scummvm/commit/a9b2af4dd4aac975e3b601df9af7bead10dbd3cf
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-09-27T23:27:09+02:00

Commit Message:
DIRECTOR: Remove unused variable

Changed paths:
    engines/director/lingo/lingo-events.cpp
    engines/director/movie.cpp
    engines/director/movie.h


diff --git a/engines/director/lingo/lingo-events.cpp b/engines/director/lingo/lingo-events.cpp
index 61fd41efd5e..46dcc6eff68 100644
--- a/engines/director/lingo/lingo-events.cpp
+++ b/engines/director/lingo/lingo-events.cpp
@@ -129,7 +129,6 @@ void Movie::resolveScriptEvent(LingoEvent &event) {
 		else
 			spriteId = _score->getMouseSpriteIDFromPos(event.mousePos);
 		_currentActiveSpriteId = _score->getActiveSpriteIDFromPos(event.mousePos); // the clickOn
-		_currentMouseSpriteId = _score->getMouseSpriteIDFromPos(event.mousePos);
 	}
 	// Very occasionally, we want to specify an event with a channel ID
 	// rather than infer it from the position. Allow it to override.
diff --git a/engines/director/movie.cpp b/engines/director/movie.cpp
index 7222e795e72..e13346103c1 100644
--- a/engines/director/movie.cpp
+++ b/engines/director/movie.cpp
@@ -49,7 +49,6 @@ Movie::Movie(Window *window) {
 	_stageColor = _window->_wm->_colorWhite;
 
 	_currentActiveSpriteId = 0;
-	_currentMouseSpriteId = 0;
 	_currentSpriteNum = 0;
 	_currentEditableTextChannel = 0;
 	_lastEventTime = _vm->getMacTicks();
diff --git a/engines/director/movie.h b/engines/director/movie.h
index 7d964eadc31..63ca486e05b 100644
--- a/engines/director/movie.h
+++ b/engines/director/movie.h
@@ -156,7 +156,6 @@ public:
 	Common::Platform _platform;
 	Common::Rect _movieRect;
 	uint16 _currentActiveSpriteId;
-	uint16 _currentMouseSpriteId;
 	uint _currentSpriteNum;
 	CastMemberID _currentMouseDownCastID;
 	CastMemberID _currentMouseDownSpriteScriptID;


Commit: 722eab16f922a4d69e92a2163f5ffb5170d847cc
    https://github.com/scummvm/scummvm/commit/722eab16f922a4d69e92a2163f5ffb5170d847cc
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-09-27T23:27:09+02:00

Commit Message:
DIRECTOR: LINGO: Clarified 'the clickOn' behavior, 1/2

In the documentation, 'the clickOn' is set only for sprites
with scripts/behaviors attached.

So, zero it if there are no scripts

Changed paths:
    engines/director/lingo/lingo-events.cpp
    engines/director/lingo/lingo-the.cpp
    engines/director/movie.cpp
    engines/director/movie.h


diff --git a/engines/director/lingo/lingo-events.cpp b/engines/director/lingo/lingo-events.cpp
index 46dcc6eff68..e8cdd488c20 100644
--- a/engines/director/lingo/lingo-events.cpp
+++ b/engines/director/lingo/lingo-events.cpp
@@ -128,7 +128,8 @@ void Movie::resolveScriptEvent(LingoEvent &event) {
 			spriteId = _score->getActiveSpriteIDFromPos(event.mousePos);
 		else
 			spriteId = _score->getMouseSpriteIDFromPos(event.mousePos);
-		_currentActiveSpriteId = _score->getActiveSpriteIDFromPos(event.mousePos); // the clickOn
+
+		_lastClickedSpriteId = _score->getActiveSpriteIDFromPos(event.mousePos); // the clickOn
 	}
 	// Very occasionally, we want to specify an event with a channel ID
 	// rather than infer it from the position. Allow it to override.
@@ -251,11 +252,14 @@ void Movie::resolveScriptEvent(LingoEvent &event) {
 						scriptId = sprite->_behaviors[event.behaviorIndex].memberID;
 						initializerParams = sprite->_behaviors[event.behaviorIndex].initializerParams;
 					} else {
+						_lastClickedSpriteId = 0;
 						return;
 					}
 				} else {
-					if (!sprite->_scriptId.member)
+					if (!sprite->_scriptId.member) {
+						_lastClickedSpriteId = 0;
 						return;
+					}
 
 					scriptId = sprite->_scriptId;
 				}
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index 401cc09dcfb..00f2b5933f1 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -534,7 +534,7 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
 		break;
 	case kTheClickOn:
 		// Even in D4, `the clickOn` uses the old "active" sprite instead of mouse sprite.
-		d = (int)movie->_currentActiveSpriteId;
+		d = (int)movie->_lastClickedSpriteId;
 		break;
 	case kTheColorDepth:
 		// bpp. 1, 2, 4, 8, 32
diff --git a/engines/director/movie.cpp b/engines/director/movie.cpp
index e13346103c1..827f69f9ace 100644
--- a/engines/director/movie.cpp
+++ b/engines/director/movie.cpp
@@ -48,7 +48,7 @@ Movie::Movie(Window *window) {
 	_flags = 0;
 	_stageColor = _window->_wm->_colorWhite;
 
-	_currentActiveSpriteId = 0;
+	_lastClickedSpriteId = 0;
 	_currentSpriteNum = 0;
 	_currentEditableTextChannel = 0;
 	_lastEventTime = _vm->getMacTicks();
diff --git a/engines/director/movie.h b/engines/director/movie.h
index 63ca486e05b..93472626cbb 100644
--- a/engines/director/movie.h
+++ b/engines/director/movie.h
@@ -155,7 +155,7 @@ public:
 	uint16 _version;
 	Common::Platform _platform;
 	Common::Rect _movieRect;
-	uint16 _currentActiveSpriteId;
+	uint16 _lastClickedSpriteId;
 	uint _currentSpriteNum;
 	CastMemberID _currentMouseDownCastID;
 	CastMemberID _currentMouseDownSpriteScriptID;


Commit: 02b3aef3c37746583ac8dd3ad9bd87bfcc7323b2
    https://github.com/scummvm/scummvm/commit/02b3aef3c37746583ac8dd3ad9bd87bfcc7323b2
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-09-27T23:27:09+02:00

Commit Message:
DIRECTOR: LINGO: Fix 'the clickOn' behavior

It is set only when there is a click. In the previous code
version we also were reacting to mouseUp and mouseMove events

Changed paths:
    engines/director/events.cpp
    engines/director/lingo/lingo-events.cpp


diff --git a/engines/director/events.cpp b/engines/director/events.cpp
index 658399c3d5e..d77fe5405e5 100644
--- a/engines/director/events.cpp
+++ b/engines/director/events.cpp
@@ -135,6 +135,13 @@ bool Movie::processEvent(Common::Event &event) {
 	}
 	uint16 spriteId = 0;
 
+	if (event.mouse != Common::Point(-1, -1)) {
+		if (g_director->getVersion() < 400)
+			spriteId = _score->getActiveSpriteIDFromPos(event.mouse);
+		else
+			spriteId = _score->getMouseSpriteIDFromPos(event.mouse);
+	}
+
 	Common::Point pos;
 
 	switch (event.type) {
@@ -162,11 +169,6 @@ bool Movie::processEvent(Common::Event &event) {
 
 		// for the list style button, we still have chance to trigger events though button.
 		if (!(g_director->_wm->_mode & Graphics::kWMModeButtonDialogStyle) && g_director->_wm->_mouseDown && g_director->_wm->_hilitingWidget) {
-			if (g_director->getVersion() < 400)
-				spriteId = sc->getActiveSpriteIDFromPos(pos);
-			else
-				spriteId = sc->getMouseSpriteIDFromPos(pos);
-
 			if (spriteId > 0 && sc->_channels[spriteId]->_sprite->shouldHilite()) {
 				_currentHiliteChannelId = spriteId;
 				g_director->getCurrentWindow()->setDirty(true);
@@ -189,8 +191,6 @@ bool Movie::processEvent(Common::Event &event) {
 		}
 
 		if (g_director->getVersion() >= 600) {
-			spriteId = sc->getMouseSpriteIDFromPos(pos);
-
 			if (spriteId > 0) {
 				if (spriteId != _lastEnteredChannelId) {
 					if (_lastEnteredChannelId) {
@@ -218,6 +218,8 @@ bool Movie::processEvent(Common::Event &event) {
 		} else {
 			pos = event.mouse;
 
+			_lastClickedSpriteId = spriteId; // for 'the clickOn'
+
 			// FIXME: Check if these are tracked with the right mouse button
 			_lastEventTime = g_director->getMacTicks();
 			_lastClickTime2 = _lastClickTime;
diff --git a/engines/director/lingo/lingo-events.cpp b/engines/director/lingo/lingo-events.cpp
index e8cdd488c20..396a0f62b8d 100644
--- a/engines/director/lingo/lingo-events.cpp
+++ b/engines/director/lingo/lingo-events.cpp
@@ -128,8 +128,6 @@ void Movie::resolveScriptEvent(LingoEvent &event) {
 			spriteId = _score->getActiveSpriteIDFromPos(event.mousePos);
 		else
 			spriteId = _score->getMouseSpriteIDFromPos(event.mousePos);
-
-		_lastClickedSpriteId = _score->getActiveSpriteIDFromPos(event.mousePos); // the clickOn
 	}
 	// Very occasionally, we want to specify an event with a channel ID
 	// rather than infer it from the position. Allow it to override.


Commit: 5173220d2b79a0304b7f62d9013286ca98c047bd
    https://github.com/scummvm/scummvm/commit/5173220d2b79a0304b7f62d9013286ca98c047bd
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-09-27T23:27:09+02:00

Commit Message:
DIRECTOR: LINGO: Implement 'on mouseUpOutSide' D6+ event

Changed paths:
    engines/director/events.cpp
    engines/director/lingo/lingo-events.cpp


diff --git a/engines/director/events.cpp b/engines/director/events.cpp
index d77fe5405e5..01429756f8c 100644
--- a/engines/director/events.cpp
+++ b/engines/director/events.cpp
@@ -218,6 +218,12 @@ bool Movie::processEvent(Common::Event &event) {
 		} else {
 			pos = event.mouse;
 
+			if (g_director->getVersion() >= 600) {
+				if (_lastClickedSpriteId && _lastClickedSpriteId != spriteId) {
+					queueInputEvent(kEventMouseUpOutSide, _lastClickedSpriteId, pos);
+				}
+			}
+
 			_lastClickedSpriteId = spriteId; // for 'the clickOn'
 
 			// FIXME: Check if these are tracked with the right mouse button
diff --git a/engines/director/lingo/lingo-events.cpp b/engines/director/lingo/lingo-events.cpp
index 396a0f62b8d..a5456c903e9 100644
--- a/engines/director/lingo/lingo-events.cpp
+++ b/engines/director/lingo/lingo-events.cpp
@@ -475,6 +475,7 @@ void Movie::queueEvent(Common::Queue<LingoEvent> &queue, LEvent event, int targe
 	case kEventPrepareFrame:
 	case kEventBeginSprite:
 	case kEventEndSprite:
+	case kEventMouseUpOutSide:  // D6+
 		if (targetId != 0) {
 			channelId = targetId;
 		}
@@ -533,6 +534,7 @@ void Movie::queueEvent(Common::Queue<LingoEvent> &queue, LEvent event, int targe
 		case kEventMouseEnter:
 		case kEventMouseLeave:
 		case kEventPrepareFrame:	// D6+
+		case kEventMouseUpOutSide:	// D6+
 			if (_vm->getVersion() >= 600) {
 				if (pointedSpriteId != 0) {
 					Sprite *sprite = _score->getSpriteById(pointedSpriteId);
@@ -546,8 +548,8 @@ void Movie::queueEvent(Common::Queue<LingoEvent> &queue, LEvent event, int targe
 						}
 					}
 
-					if (event == kEventBeginSprite || event == kEventEndSprite) {
-						// beginSprite and endSprite do not go any further than the sprite behaviors
+					if (event == kEventBeginSprite || event == kEventEndSprite || event == kEventMouseUpOutSide) {
+						// These events do not go any further than the sprite behaviors
 						break;
 					}
 				} else {


Commit: 7cd447034fad8403b8c878df72dc1b84994c312b
    https://github.com/scummvm/scummvm/commit/7cd447034fad8403b8c878df72dc1b84994c312b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-09-27T23:27:10+02:00

Commit Message:
DIRECTOR: LINGO: Implement 'on mouseWithin' D6+ event handler

Changed paths:
    engines/director/events.cpp
    engines/director/lingo/lingo-events.cpp
    engines/director/movie.cpp
    engines/director/movie.h
    engines/director/score.cpp


diff --git a/engines/director/events.cpp b/engines/director/events.cpp
index 01429756f8c..993ae31545c 100644
--- a/engines/director/events.cpp
+++ b/engines/director/events.cpp
@@ -140,6 +140,8 @@ bool Movie::processEvent(Common::Event &event) {
 			spriteId = _score->getActiveSpriteIDFromPos(event.mouse);
 		else
 			spriteId = _score->getMouseSpriteIDFromPos(event.mouse);
+
+		_currentHoveredSpriteId = spriteId;
 	}
 
 	Common::Point pos;
@@ -190,6 +192,8 @@ bool Movie::processEvent(Common::Event &event) {
 			}
 		}
 
+		// TODO: In the original, these events are generated only
+		// along with the kEventIdle event which depends on the idleHandlerPeriod property
 		if (g_director->getVersion() >= 600) {
 			if (spriteId > 0) {
 				if (spriteId != _lastEnteredChannelId) {
diff --git a/engines/director/lingo/lingo-events.cpp b/engines/director/lingo/lingo-events.cpp
index a5456c903e9..b06882f2a88 100644
--- a/engines/director/lingo/lingo-events.cpp
+++ b/engines/director/lingo/lingo-events.cpp
@@ -475,7 +475,8 @@ void Movie::queueEvent(Common::Queue<LingoEvent> &queue, LEvent event, int targe
 	case kEventPrepareFrame:
 	case kEventBeginSprite:
 	case kEventEndSprite:
-	case kEventMouseUpOutSide:  // D6+
+	case kEventMouseUpOutSide:	// D6+
+	case kEventMouseWithin:		// D6+
 		if (targetId != 0) {
 			channelId = targetId;
 		}
@@ -535,6 +536,7 @@ void Movie::queueEvent(Common::Queue<LingoEvent> &queue, LEvent event, int targe
 		case kEventMouseLeave:
 		case kEventPrepareFrame:	// D6+
 		case kEventMouseUpOutSide:	// D6+
+		case kEventMouseWithin:		// D6+
 			if (_vm->getVersion() >= 600) {
 				if (pointedSpriteId != 0) {
 					Sprite *sprite = _score->getSpriteById(pointedSpriteId);
diff --git a/engines/director/movie.cpp b/engines/director/movie.cpp
index 827f69f9ace..17b4b5bedee 100644
--- a/engines/director/movie.cpp
+++ b/engines/director/movie.cpp
@@ -69,6 +69,7 @@ Movie::Movie(Window *window) {
 	_currentHiliteChannelId = 0;
 	_mouseDownWasInButton = false;
 	_lastEnteredChannelId = 0;
+	_currentHoveredSpriteId = 0;
 
 	_version = 0;
 	_platform = Common::kPlatformMacintosh;
diff --git a/engines/director/movie.h b/engines/director/movie.h
index 93472626cbb..a463a1d6b6e 100644
--- a/engines/director/movie.h
+++ b/engines/director/movie.h
@@ -156,6 +156,7 @@ public:
 	Common::Platform _platform;
 	Common::Rect _movieRect;
 	uint16 _lastClickedSpriteId;
+	uint16 _currentHoveredSpriteId;
 	uint _currentSpriteNum;
 	CastMemberID _currentMouseDownCastID;
 	CastMemberID _currentMouseDownSpriteScriptID;
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 0ef3529e30e..401e813872d 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -353,6 +353,12 @@ void Score::step() {
 	}
 	if (_version >= kFileVer300 && !_window->_newMovieStarted && _playState != kPlayStopped) {
 		_movie->processEvent(kEventIdle);
+
+		if (_version >= kFileVer600) {
+			if (_movie->_currentHoveredSpriteId) {
+				_movie->processEvent(kEventMouseWithin, _movie->_currentHoveredSpriteId);
+			}
+		}
 	}
 
 	update();


Commit: b588b38b390052a87d6a02e7bbc462d1c945b49b
    https://github.com/scummvm/scummvm/commit/b588b38b390052a87d6a02e7bbc462d1c945b49b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-09-27T23:27:10+02:00

Commit Message:
DIRECTOR: Implement 'on closeWindow' D5+ event

Changed paths:
    engines/director/events.cpp
    engines/director/window.cpp
    engines/director/window.h


diff --git a/engines/director/events.cpp b/engines/director/events.cpp
index 993ae31545c..e4499e1f80c 100644
--- a/engines/director/events.cpp
+++ b/engines/director/events.cpp
@@ -324,4 +324,25 @@ bool Movie::processEvent(Common::Event &event) {
 	return false;
 }
 
+bool Window::processWMEvent(Graphics::WindowClick click, Common::Event &event) {
+	// kEventActivateWindow
+	// kEventDeactivateWindow
+	// kEventMoveWindow
+	// kEventResizeWindow
+	// kEventOpenWindow
+	// kEventZoomWindow
+
+	switch (click) {
+	case Graphics::kBorderCloseButton:
+		if (_currentMovie && event.type == Common::EVENT_LBUTTONUP)
+			_currentMovie->processEvent(kEventCloseWindow, 0);
+		break;
+
+	default:
+		break;
+	}
+
+	return false;
+}
+
 } // End of namespace Director
diff --git a/engines/director/window.cpp b/engines/director/window.cpp
index 7c23adba14c..52d2dc62f0a 100644
--- a/engines/director/window.cpp
+++ b/engines/director/window.cpp
@@ -42,6 +42,11 @@
 
 namespace Director {
 
+bool commandsWindowCallback(Graphics::WindowClick click, Common::Event &event, void *window) {
+	Window *w = (Window*)window;
+	return w->processWMEvent(click, event);
+}
+
 Window::Window(int id, bool scrollable, bool resizable, bool editable, Graphics::MacWindowManager *wm, DirectorEngine *vm, bool isStage)
 	: MacWindow(id, scrollable, resizable, editable, wm), Object<Window>("Window") {
 	_vm = vm;
@@ -66,6 +71,8 @@ Window::Window(int id, bool scrollable, bool resizable, bool editable, Graphics:
 	updateBorderType();
 
 	_draggable = !_isStage;
+
+	setCallback(commandsWindowCallback, this);
 }
 
 Window::~Window() {
diff --git a/engines/director/window.h b/engines/director/window.h
index 8d3729ff5ba..509c8ec2bcb 100644
--- a/engines/director/window.h
+++ b/engines/director/window.h
@@ -173,6 +173,7 @@ public:
 
 	// events.cpp
 	bool processEvent(Common::Event &event) override;
+	bool processWMEvent(Graphics::WindowClick click, Common::Event &event);
 
 	// tests.cpp
 	Common::HashMap<Common::String, Movie *> *scanMovies(const Common::Path &folder);


Commit: b6bbb9004cf092d1b80c7e40812b4cac056a8c46
    https://github.com/scummvm/scummvm/commit/b6bbb9004cf092d1b80c7e40812b4cac056a8c46
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-09-27T23:27:10+02:00

Commit Message:
DIRECTOR: Actually close window when close button is pressed

Changed paths:
    engines/director/events.cpp


diff --git a/engines/director/events.cpp b/engines/director/events.cpp
index e4499e1f80c..c77054fed6d 100644
--- a/engines/director/events.cpp
+++ b/engines/director/events.cpp
@@ -334,8 +334,12 @@ bool Window::processWMEvent(Graphics::WindowClick click, Common::Event &event) {
 
 	switch (click) {
 	case Graphics::kBorderCloseButton:
-		if (_currentMovie && event.type == Common::EVENT_LBUTTONUP)
+		if (_currentMovie && event.type == Common::EVENT_LBUTTONUP) {
 			_currentMovie->processEvent(kEventCloseWindow, 0);
+			setVisible(false);
+
+			return true;
+		}
 		break;
 
 	default:


Commit: 21aa70a6ea2fe86277be536c5ba2523971c3e8bc
    https://github.com/scummvm/scummvm/commit/21aa70a6ea2fe86277be536c5ba2523971c3e8bc
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-09-27T23:27:10+02:00

Commit Message:
DIRECTOR: Imlpement 'on openWindow' D5+ event handler

Changed paths:
    engines/director/events.cpp
    engines/director/lingo/lingo-object.cpp
    engines/director/window.h


diff --git a/engines/director/events.cpp b/engines/director/events.cpp
index c77054fed6d..26ba0b8f21c 100644
--- a/engines/director/events.cpp
+++ b/engines/director/events.cpp
@@ -329,7 +329,6 @@ bool Window::processWMEvent(Graphics::WindowClick click, Common::Event &event) {
 	// kEventDeactivateWindow
 	// kEventMoveWindow
 	// kEventResizeWindow
-	// kEventOpenWindow
 	// kEventZoomWindow
 
 	switch (click) {
@@ -349,4 +348,14 @@ bool Window::processWMEvent(Graphics::WindowClick click, Common::Event &event) {
 	return false;
 }
 
+void Window::sendOpenWindowEvent() {
+	if (_currentMovie && _visible && !_isStage) {
+		// We cannot call processEvent here directly because it might
+		// be called from within another event processing (like 'on startMovie'	)
+		// which would mess up the Lingo state.
+		_currentMovie->queueInputEvent(kEventOpenWindow, 0, Common::Point(-1, -1));
+	}
+}
+
+
 } // End of namespace Director
diff --git a/engines/director/lingo/lingo-object.cpp b/engines/director/lingo/lingo-object.cpp
index afe4085b3d8..b1d2322c0dc 100644
--- a/engines/director/lingo/lingo-object.cpp
+++ b/engines/director/lingo/lingo-object.cpp
@@ -889,7 +889,11 @@ void LM::m_forget(int nargs) {
 
 void LM::m_open(int nargs) {
 	Window *me = static_cast<Window *>(g_lingo->_state->me.u.obj);
+	bool wasVisible = me->isVisible();
 	me->setVisible(true);
+
+	if (!wasVisible)
+		me->sendOpenWindowEvent();
 }
 
 void LM::m_moveToBack(int nargs) {
@@ -901,7 +905,11 @@ void LM::m_moveToFront(int nargs) {
 	Window *me = static_cast<Window *>(g_lingo->_state->me.u.obj);
 	me->ensureMovieIsLoaded();
 
+	bool wasActive = me->_active;
 	g_director->_wm->setActiveWindow(me->getId());
+
+	if (!wasActive)
+		me->sendOpenWindowEvent();
 }
 
 } // End of namespace Director
diff --git a/engines/director/window.h b/engines/director/window.h
index 509c8ec2bcb..94020d1fd1f 100644
--- a/engines/director/window.h
+++ b/engines/director/window.h
@@ -174,6 +174,7 @@ public:
 	// events.cpp
 	bool processEvent(Common::Event &event) override;
 	bool processWMEvent(Graphics::WindowClick click, Common::Event &event);
+	void sendOpenWindowEvent();
 
 	// tests.cpp
 	Common::HashMap<Common::String, Movie *> *scanMovies(const Common::Path &folder);


Commit: 75b2c5ffd027a12d69765ecc3c8c37c7f3df845f
    https://github.com/scummvm/scummvm/commit/75b2c5ffd027a12d69765ecc3c8c37c7f3df845f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-09-27T23:27:10+02:00

Commit Message:
DIRECTOR: LINGO: Made sending events to window generic

Changed paths:
    engines/director/events.cpp
    engines/director/lingo/lingo-object.cpp
    engines/director/window.h


diff --git a/engines/director/events.cpp b/engines/director/events.cpp
index 26ba0b8f21c..b4be385ec92 100644
--- a/engines/director/events.cpp
+++ b/engines/director/events.cpp
@@ -348,12 +348,12 @@ bool Window::processWMEvent(Graphics::WindowClick click, Common::Event &event) {
 	return false;
 }
 
-void Window::sendOpenWindowEvent() {
+void Window::sendWindowEvent(LEvent event) {
 	if (_currentMovie && _visible && !_isStage) {
 		// We cannot call processEvent here directly because it might
 		// be called from within another event processing (like 'on startMovie'	)
 		// which would mess up the Lingo state.
-		_currentMovie->queueInputEvent(kEventOpenWindow, 0, Common::Point(-1, -1));
+		_currentMovie->queueInputEvent(event, 0, Common::Point(-1, -1));
 	}
 }
 
diff --git a/engines/director/lingo/lingo-object.cpp b/engines/director/lingo/lingo-object.cpp
index b1d2322c0dc..293cdb03028 100644
--- a/engines/director/lingo/lingo-object.cpp
+++ b/engines/director/lingo/lingo-object.cpp
@@ -893,7 +893,7 @@ void LM::m_open(int nargs) {
 	me->setVisible(true);
 
 	if (!wasVisible)
-		me->sendOpenWindowEvent();
+		me->sendWindowEvent(kEventOpenWindow);
 }
 
 void LM::m_moveToBack(int nargs) {
@@ -909,7 +909,7 @@ void LM::m_moveToFront(int nargs) {
 	g_director->_wm->setActiveWindow(me->getId());
 
 	if (!wasActive)
-		me->sendOpenWindowEvent();
+		me->sendWindowEvent(kEventOpenWindow);
 }
 
 } // End of namespace Director
diff --git a/engines/director/window.h b/engines/director/window.h
index 94020d1fd1f..c3120f7231c 100644
--- a/engines/director/window.h
+++ b/engines/director/window.h
@@ -174,7 +174,7 @@ public:
 	// events.cpp
 	bool processEvent(Common::Event &event) override;
 	bool processWMEvent(Graphics::WindowClick click, Common::Event &event);
-	void sendOpenWindowEvent();
+	void sendWindowEvent(LEvent event);
 
 	// tests.cpp
 	Common::HashMap<Common::String, Movie *> *scanMovies(const Common::Path &folder);


Commit: 4ff643ea7bddaaba0c9fac63654300cbcead20b2
    https://github.com/scummvm/scummvm/commit/4ff643ea7bddaaba0c9fac63654300cbcead20b2
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-09-27T23:27:10+02:00

Commit Message:
GRAPHICS: MACGUI: Added getActiveWindow() method

Changed paths:
    graphics/macgui/macwindowmanager.h


diff --git a/graphics/macgui/macwindowmanager.h b/graphics/macgui/macwindowmanager.h
index 18f31544dc4..466f966b135 100644
--- a/graphics/macgui/macwindowmanager.h
+++ b/graphics/macgui/macwindowmanager.h
@@ -233,6 +233,8 @@ public:
 	 */
 	void setActiveWindow(int id);
 
+	int getActiveWindow() { return _activeWindow; }
+
 	/**
 	 * Return Top Window containing a point
 	 * @param x x coordinate of point


Commit: a30930d6e47d901a2acc54b336949598e5e59b5a
    https://github.com/scummvm/scummvm/commit/a30930d6e47d901a2acc54b336949598e5e59b5a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-09-27T23:27:10+02:00

Commit Message:
DIRECTOR: LINGO: Implement 'the activeWindow' D5+ system property

Changed paths:
    engines/director/lingo/lingo-object.cpp
    engines/director/lingo/lingo-the.cpp


diff --git a/engines/director/lingo/lingo-object.cpp b/engines/director/lingo/lingo-object.cpp
index 293cdb03028..6d7f44bef17 100644
--- a/engines/director/lingo/lingo-object.cpp
+++ b/engines/director/lingo/lingo-object.cpp
@@ -905,7 +905,7 @@ void LM::m_moveToFront(int nargs) {
 	Window *me = static_cast<Window *>(g_lingo->_state->me.u.obj);
 	me->ensureMovieIsLoaded();
 
-	bool wasActive = me->_active;
+	bool wasActive = (g_director->_wm->getActiveWindow() == me->getId());
 	g_director->_wm->setActiveWindow(me->getId());
 
 	if (!wasActive)
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index 00f2b5933f1..938f0863358 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -488,6 +488,16 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
 	Score *score = movie->getScore();
 
 	switch (entity) {
+	case kTheActiveWindow:
+		{
+			Window *win = (Window *)g_director->_wm->getWindow(g_director->_wm->getActiveWindow());
+			if (win) {
+				d = Datum(win);
+			} else {
+				d.type = VOID;
+			}
+		}
+		break;
 	case kTheActorList:
 		d = g_lingo->_actorList;
 		break;




More information about the Scummvm-git-logs mailing list