From 8360d3cd6f4e4beeb6564363a49e9b4a0de64b15 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 11 Nov 2015 21:36:27 +0100 Subject: GUI: Do not show splash when ran from launcher --- gui/gui-manager.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gui/gui-manager.cpp') diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp index 9b6cf5a0b6..20c6d3fa13 100644 --- a/gui/gui-manager.cpp +++ b/gui/gui-manager.cpp @@ -64,6 +64,8 @@ GuiManager::GuiManager() : _redrawStatus(kRedrawDisabled), _stateIsSaved(false), _width = _system->getOverlayWidth(); _height = _system->getOverlayHeight(); + _launched = false; + // Clear the cursor memset(_cursor, 0xFF, sizeof(_cursor)); -- cgit v1.2.3 From 841f87bf47821aa1e50969772376180aa287808d Mon Sep 17 00:00:00 2001 From: Lothar Serra Mari Date: Tue, 5 Apr 2016 10:06:41 +0200 Subject: GUI: Update _lastRedraw before calling updateScreen This reduces the cursor lags on some systems. --- gui/gui-manager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gui/gui-manager.cpp') diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp index 20c6d3fa13..6ac52487d1 100644 --- a/gui/gui-manager.cpp +++ b/gui/gui-manager.cpp @@ -304,9 +304,9 @@ void GuiManager::runLoop() { // _system->updateScreen(); if (lastRedraw + waitTime < _system->getMillis(true)) { + lastRedraw = _system->getMillis(true); _theme->updateScreen(); _system->updateScreen(); - lastRedraw = _system->getMillis(true); } Common::Event event; @@ -342,9 +342,9 @@ void GuiManager::runLoop() { if (lastRedraw + waitTime < _system->getMillis(true)) { + lastRedraw = _system->getMillis(true); _theme->updateScreen(); _system->updateScreen(); - lastRedraw = _system->getMillis(true); } } -- cgit v1.2.3 From 8fa543f58f251ef5c695f6c288ecd0303ec14144 Mon Sep 17 00:00:00 2001 From: Lothar Serra Mari Date: Tue, 5 Apr 2016 10:29:14 +0200 Subject: GUI: Increase update screen rate to 60Hz --- gui/gui-manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gui/gui-manager.cpp') diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp index 6ac52487d1..4ddf62b2fe 100644 --- a/gui/gui-manager.cpp +++ b/gui/gui-manager.cpp @@ -286,7 +286,7 @@ void GuiManager::runLoop() { Common::EventManager *eventMan = _system->getEventManager(); uint32 lastRedraw = 0; - const uint32 waitTime = 1000 / 45; + const uint32 waitTime = 1000 / 60; bool tooltipCheck = false; -- cgit v1.2.3 From be1fdf59bb80f963a4f97bfab49f59aca8d73d70 Mon Sep 17 00:00:00 2001 From: Ori Avtalion Date: Wed, 6 Apr 2016 17:22:02 +0300 Subject: GUI: When dialogs gain focus, inform them of the current mouse position Previously, they only reacted to the mouse position once it was moved. This meant that if the cursor was on a button that just gained focus, it did not highlight. Fixes #7101. --- gui/gui-manager.cpp | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) (limited to 'gui/gui-manager.cpp') diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp index 4ddf62b2fe..3ce8bee020 100644 --- a/gui/gui-manager.cpp +++ b/gui/gui-manager.cpp @@ -281,15 +281,10 @@ void GuiManager::runLoop() { redraw(); } - _lastMousePosition.x = _lastMousePosition.y = -1; - _lastMousePosition.time = 0; - Common::EventManager *eventMan = _system->getEventManager(); uint32 lastRedraw = 0; const uint32 waitTime = 1000 / 60; - bool tooltipCheck = false; - while (!_dialogStack.empty() && activeDialog == getTopDialog() && !eventMan->shouldQuit()) { redraw(); @@ -336,11 +331,6 @@ void GuiManager::runLoop() { processEvent(event, activeDialog); - if (event.type == Common::EVENT_MOUSEMOVE) { - tooltipCheck = true; - } - - if (lastRedraw + waitTime < _system->getMillis(true)) { lastRedraw = _system->getMillis(true); _theme->updateScreen(); @@ -348,7 +338,7 @@ void GuiManager::runLoop() { } } - if (tooltipCheck && _lastMousePosition.time + kTooltipDelay < _system->getMillis(true)) { + if (_lastMousePosition.time + kTooltipDelay < _system->getMillis(true)) { Widget *wdg = activeDialog->findWidget(_lastMousePosition.x, _lastMousePosition.y); if (wdg && wdg->hasTooltip() && !(wdg->getFlags() & WIDGET_PRESSED)) { Tooltip *tooltip = new Tooltip(); @@ -415,7 +405,7 @@ void GuiManager::restoreState() { } void GuiManager::openDialog(Dialog *dialog) { - dialog->receivedFocus(); + giveFocusToDialog(dialog); if (!_dialogStack.empty()) getTopDialog()->lostFocus(); @@ -439,8 +429,10 @@ void GuiManager::closeTopDialog() { // Remove the dialog from the stack _dialogStack.pop()->lostFocus(); - if (!_dialogStack.empty()) - getTopDialog()->receivedFocus(); + if (!_dialogStack.empty()) { + Dialog *dialog = getTopDialog(); + giveFocusToDialog(dialog); + } if (_redrawStatus != kRedrawFull) _redrawStatus = kRedrawCloseDialog; @@ -515,6 +507,7 @@ void GuiManager::processEvent(const Common::Event &event, Dialog *const activeDi int button; uint32 time; Common::Point mouse(event.mouse.x - activeDialog->_x, event.mouse.y - activeDialog->_y); + switch (event.type) { case Common::EVENT_KEYDOWN: activeDialog->handleKeyDown(event.kbd); @@ -523,12 +516,12 @@ void GuiManager::processEvent(const Common::Event &event, Dialog *const activeDi activeDialog->handleKeyUp(event.kbd); break; case Common::EVENT_MOUSEMOVE: + _globalMousePosition.x = event.mouse.x; + _globalMousePosition.y = event.mouse.y; activeDialog->handleMouseMoved(mouse.x, mouse.y, 0); if (mouse.x != _lastMousePosition.x || mouse.y != _lastMousePosition.y) { - _lastMousePosition.x = mouse.x; - _lastMousePosition.y = mouse.y; - _lastMousePosition.time = _system->getMillis(true); + setLastMousePos(mouse.x, mouse.y); } break; @@ -571,4 +564,17 @@ void GuiManager::processEvent(const Common::Event &event, Dialog *const activeDi } } +void GuiManager::giveFocusToDialog(Dialog *dialog) { + int16 dialogX = _globalMousePosition.x - dialog->_x; + int16 dialogY = _globalMousePosition.y - dialog->_y; + dialog->receivedFocus(dialogX, dialogY); + setLastMousePos(dialogX, dialogY); +} + +void GuiManager::setLastMousePos(int16 x, int16 y) { + _lastMousePosition.x = x; + _lastMousePosition.y = y; + _lastMousePosition.time = _system->getMillis(true); +} + } // End of namespace GUI -- cgit v1.2.3 From 31e528c070d14baf62dc1e8570075425a2efbb42 Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Wed, 22 Jun 2016 17:29:01 +0600 Subject: GUI: Make ScrollContainerWidget do full redraw --- gui/gui-manager.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gui/gui-manager.cpp') diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp index 3ce8bee020..9acd9434ff 100644 --- a/gui/gui-manager.cpp +++ b/gui/gui-manager.cpp @@ -564,6 +564,12 @@ void GuiManager::processEvent(const Common::Event &event, Dialog *const activeDi } } +void GuiManager::doFullRedraw() { + _redrawStatus = kRedrawFull; + redraw(); + _system->updateScreen(); +} + void GuiManager::giveFocusToDialog(Dialog *dialog) { int16 dialogX = _globalMousePosition.x - dialog->_x; int16 dialogY = _globalMousePosition.y - dialog->_y; -- cgit v1.2.3