From 27d55062622c0045083dec18b810340bf147d636 Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Tue, 22 Jan 2013 19:48:25 -0200 Subject: [PATCH] Some fixes in entergame and widget clipping --- modules/client_entergame/characterlist.lua | 9 ++++----- modules/client_entergame/entergame.lua | 4 +++- src/client/game.h | 1 + src/client/luafunctions.cpp | 1 + src/framework/ui/uiwidget.cpp | 10 +++++++--- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/modules/client_entergame/characterlist.lua b/modules/client_entergame/characterlist.lua index 634cc189..33cf728c 100644 --- a/modules/client_entergame/characterlist.lua +++ b/modules/client_entergame/characterlist.lua @@ -261,11 +261,10 @@ function CharacterList.destroy() end function CharacterList.show() - if not loadBox and not errorBox and charactersWindow then - charactersWindow:show() - charactersWindow:raise() - charactersWindow:focus() - end + if loadBox or errorBox or not charactersWindow then return end + charactersWindow:show() + charactersWindow:raise() + charactersWindow:focus() end function CharacterList.hide(showLogin) diff --git a/modules/client_entergame/entergame.lua b/modules/client_entergame/entergame.lua index ab5a075b..d9f1f227 100644 --- a/modules/client_entergame/entergame.lua +++ b/modules/client_entergame/entergame.lua @@ -147,6 +147,7 @@ function EnterGame.terminate() end function EnterGame.show() + if loadBox then return end enterGame:show() enterGame:raise() enterGame:focus() @@ -159,7 +160,7 @@ end function EnterGame.openWindow() if g_game.isOnline() then CharacterList.show() - elseif not CharacterList.isVisible() then + elseif not g_game.isLogging() and not CharacterList.isVisible() then EnterGame.show() end end @@ -223,6 +224,7 @@ end function EnterGame.displayMotd() if not motdWindow or not motdWindow:isVisible() then motdWindow = displayInfoBox(tr('Message of the day'), G.motdMessage) + motdWindow.onOk = function() motdWindow = nil end end end diff --git a/src/client/game.h b/src/client/game.h index a697a7fa..e927128d 100644 --- a/src/client/game.h +++ b/src/client/game.h @@ -272,6 +272,7 @@ public: bool checkBotProtection(); bool isOnline() { return m_online; } + bool isLogging() { return !m_online && m_protocolGame; } bool isDead() { return m_dead; } bool isAttacking() { return !!m_attackingCreature; } bool isFollowing() { return !!m_followingCreature; } diff --git a/src/client/luafunctions.cpp b/src/client/luafunctions.cpp index b6336379..877355a4 100644 --- a/src/client/luafunctions.cpp +++ b/src/client/luafunctions.cpp @@ -212,6 +212,7 @@ void Client::registerLuaFunctions() g_lua.bindSingletonFunction("g_game", "canReportBugs", &Game::canReportBugs, &g_game); g_lua.bindSingletonFunction("g_game", "checkBotProtection", &Game::checkBotProtection, &g_game); g_lua.bindSingletonFunction("g_game", "isOnline", &Game::isOnline, &g_game); + g_lua.bindSingletonFunction("g_game", "isLogging", &Game::isLogging, &g_game); g_lua.bindSingletonFunction("g_game", "isDead", &Game::isDead, &g_game); g_lua.bindSingletonFunction("g_game", "isAttacking", &Game::isAttacking, &g_game); g_lua.bindSingletonFunction("g_game", "isFollowing", &Game::isFollowing, &g_game); diff --git a/src/framework/ui/uiwidget.cpp b/src/framework/ui/uiwidget.cpp index 871c47d5..0e7e7aa0 100644 --- a/src/framework/ui/uiwidget.cpp +++ b/src/framework/ui/uiwidget.cpp @@ -55,8 +55,11 @@ UIWidget::~UIWidget() void UIWidget::draw(const Rect& visibleRect, Fw::DrawPane drawPane) { - if(m_clipping) + Rect oldClipRect; + if(m_clipping) { + oldClipRect = g_painter->getClipRect(); g_painter->setClipRect(visibleRect); + } if(m_rotation != 0.0f) { g_painter->pushTransformMatrix(); @@ -75,8 +78,9 @@ void UIWidget::draw(const Rect& visibleRect, Fw::DrawPane drawPane) if(m_rotation != 0.0f) g_painter->popTransformMatrix(); - if(m_clipping) - g_painter->resetClipRect(); + if(m_clipping) { + g_painter->setClipRect(oldClipRect); + } } void UIWidget::drawSelf(Fw::DrawPane drawPane)