[Scummvm-git-logs] scummvm master -> 03b8f6d3a3c086147d0767577c11ba76b34d95ff

lephilousophe noreply at scummvm.org
Sun Apr 26 10:11:58 UTC 2026


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

Summary:
03b8f6d3a3 GUI: Don't close GridItemTray too hastily if mouse is outside of it


Commit: 03b8f6d3a3c086147d0767577c11ba76b34d95ff
    https://github.com/scummvm/scummvm/commit/03b8f6d3a3c086147d0767577c11ba76b34d95ff
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2026-04-26T12:11:55+02:00

Commit Message:
GUI: Don't close GridItemTray too hastily if mouse is outside of it

The mouse can end up outside of the tray when scrolling and the just
clicked game has a short name.
Instead, register the case and close the tray only when mouse ended up
in it and left again.

Fix #16688.

Changed paths:
    gui/widgets/grid.cpp
    gui/widgets/grid.h


diff --git a/gui/widgets/grid.cpp b/gui/widgets/grid.cpp
index 1f2b517907e..b0a82e995c3 100644
--- a/gui/widgets/grid.cpp
+++ b/gui/widgets/grid.cpp
@@ -312,7 +312,7 @@ void GridItemWidget::handleMouseUp(int x, int y, int button, int clickCount) {
 #pragma mark -
 
 GridItemTray::GridItemTray(GuiObject *boss, int x, int y, int w, int h, int entryID, GridWidget *grid)
-	: Dialog(x, y, w, h), CommandSender(boss) {
+	: Dialog(x, y, w, h), CommandSender(boss), _mouseOutside(false) {
 
 	_entryID = entryID;
 	_boss = boss;
@@ -388,12 +388,23 @@ void GridItemTray::handleMouseWheel(int x, int y, int direction) {
 	close();
 }
 
+void GridItemTray::receivedFocus(int x, int y) {
+	// Don't call our handleMouseMoved when receiving focus
+	// to avoid spurious closing if the cursor is outside of the tray
+	if (x >= 0 && y >= 0) {
+		Dialog::handleMouseMoved(x, y, 0);
+		_mouseOutside = ((x < 0 || x > _w) || (y > _h || y < -(_grid->_gridItemHeight)));
+	}
+}
+
 void GridItemTray::handleMouseMoved(int x, int y, int button) {
 	Dialog::handleMouseMoved(x, y, button);
-	if ((x < 0 || x > _w) || (y > _h || y < -(_grid->_gridItemHeight))) {
+	bool mouseOutside = (x < 0 || x > _w) || (y > _h || y < -(_grid->_gridItemHeight));
+	if (mouseOutside && !_mouseOutside) {
 		// Close on going outside
 		close();
 	}
+	_mouseOutside = mouseOutside;
 }
 
 #pragma mark -
diff --git a/gui/widgets/grid.h b/gui/widgets/grid.h
index 20975936664..9391cec6d73 100644
--- a/gui/widgets/grid.h
+++ b/gui/widgets/grid.h
@@ -85,12 +85,15 @@ class GridItemTray: public Dialog, public CommandSender {
 	PicButtonWidget	*_playButton;
 	PicButtonWidget	*_loadButton;
 	PicButtonWidget	*_editButton;
+
+	bool _mouseOutside;
 public:
 	GridItemTray(GuiObject *boss, int x, int y, int w, int h, int entryID, GridWidget *grid);
 	void enableLoadButton(bool canLoad) { _loadButton->setEnabled(canLoad); }
 
 	void reflowLayout() override;
 
+	void receivedFocus(int x = -1, int y = -1) override;
 	void handleCommand(CommandSender *sender, uint32 cmd, uint32 data) override;
 	void handleMouseDown(int x, int y, int button, int clickCount) override;
 	void handleMouseUp(int x, int y, int button, int clickCount) override;




More information about the Scummvm-git-logs mailing list