Преглед на файлове

Added check if event has already handled by captured_widget

rsredsq преди 10 години
родител
ревизия
bc7f3b601a
променени са 1 файла, в които са добавени 4 реда и са изтрити 2 реда
  1. 4 2
      Source/ThirdParty/TurboBadger/tb_widgets.cpp

+ 4 - 2
Source/ThirdParty/TurboBadger/tb_widgets.cpp

@@ -1376,6 +1376,8 @@ void TBWidget::InvokePointerUp(int x, int y, MODIFIER_KEYS modifierkeys, bool to
     //save x and y to restore it later
     int ox = x;
     int oy = y;
+    //true if pointer up event handled by captured_widget
+    bool handled = false;
     //save old_capture for later check, because captured_widget can be nullptr after releasing capture
     TBWidget *old_capture = captured_widget;
     if (captured_widget && captured_widget->touchId_ == touchId)
@@ -1386,7 +1388,7 @@ void TBWidget::InvokePointerUp(int x, int y, MODIFIER_KEYS modifierkeys, bool to
         captured_widget->InvokeEvent(ev_up);
         if (!cancel_click && captured_widget->GetHitStatus(x, y))
         {
-            captured_widget->InvokeEvent(ev_click);
+            handled = captured_widget->InvokeEvent(ev_click);
         }
         captured_widget->ReleaseCapture();
     }
@@ -1395,7 +1397,7 @@ void TBWidget::InvokePointerUp(int x, int y, MODIFIER_KEYS modifierkeys, bool to
     y = oy;
     TBWidget* down_widget = GetWidgetAt(x, y, true);
     //make sure that down_widget is not captured_widget to don't sent event twice
-    if (down_widget && down_widget->touchId_ == touchId && old_capture != down_widget)
+    if (down_widget && down_widget->touchId_ == touchId && old_capture != down_widget && !handled)
     {
         down_widget->ConvertFromRoot(x, y);
         TBWidgetEvent ev_up(EVENT_TYPE_POINTER_UP, x, y, touch, modifierkeys);