mirror of
https://github.com/edubart/otclient.git
synced 2025-10-18 21:43:26 +02:00
fix focus bug, change battle events
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include "eventdispatcher.h"
|
||||
|
||||
#include <framework/core/clock.h>
|
||||
#include "timer.h"
|
||||
|
||||
EventDispatcher g_eventDispatcher;
|
||||
|
||||
@@ -53,10 +54,10 @@ void EventDispatcher::poll()
|
||||
int count = 0;
|
||||
while(m_pollEventsSize > 0) {
|
||||
if(count > 50) {
|
||||
static bool reported = false;
|
||||
if(!reported) {
|
||||
static Timer reportTimer;
|
||||
if(reportTimer.running() && reportTimer.ticksElapsed() > 250) {
|
||||
logError("ATTENTION the event list is not getting empty, this could be caused by some bad code");
|
||||
reported = true;
|
||||
reportTimer.restart();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@@ -88,10 +88,7 @@ void UIManager::inputEvent(const InputEvent& event)
|
||||
|
||||
m_mouseReceiver->propagateOnMouseEvent(event.mousePos, widgetList);
|
||||
for(const UIWidgetPtr& widget : widgetList) {
|
||||
if(widget->isFocusable()) {
|
||||
if(UIWidgetPtr parent = widget->getParent())
|
||||
parent->focusChild(widget, Fw::MouseFocusReason);
|
||||
}
|
||||
widget->recursiveFocus(Fw::MouseFocusReason);
|
||||
if(widget->onMousePress(event.mousePos, event.mouseButton))
|
||||
break;
|
||||
}
|
||||
|
@@ -579,6 +579,18 @@ void UIWidget::focus()
|
||||
parent->focusChild(asUIWidget(), Fw::ActiveFocusReason);
|
||||
}
|
||||
|
||||
void UIWidget::recursiveFocus(Fw::FocusReason reason)
|
||||
{
|
||||
if(m_destroyed)
|
||||
return;
|
||||
|
||||
if(UIWidgetPtr parent = getParent()) {
|
||||
if(m_focusable)
|
||||
parent->focusChild(asUIWidget(), reason);
|
||||
parent->recursiveFocus(reason);
|
||||
}
|
||||
}
|
||||
|
||||
void UIWidget::lower()
|
||||
{
|
||||
if(m_destroyed)
|
||||
|
@@ -100,6 +100,7 @@ public:
|
||||
void lock();
|
||||
void unlock();
|
||||
void focus();
|
||||
void recursiveFocus(Fw::FocusReason reason);
|
||||
void lower();
|
||||
void raise();
|
||||
void grabMouse();
|
||||
|
Reference in New Issue
Block a user