浏览代码

LibGUI: Don't bubble window events up to parent windows

Always accept the events so that they don't bubble up to the
parent object.

Fixes #4967
Tom 4 年之前
父节点
当前提交
20f53c7462
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      Userland/Libraries/LibGUI/Window.cpp

+ 5 - 0
Userland/Libraries/LibGUI/Window.cpp

@@ -27,6 +27,7 @@
 #include <AK/HashMap.h>
 #include <AK/JsonObject.h>
 #include <AK/NeverDestroyed.h>
+#include <AK/ScopeGuard.h>
 #include <LibCore/EventLoop.h>
 #include <LibCore/MimeData.h>
 #include <LibGUI/Action.h>
@@ -490,6 +491,10 @@ void Window::handle_left_event()
 
 void Window::event(Core::Event& event)
 {
+    ScopeGuard guard([&] {
+        // Accept the event so it doesn't bubble up to parent windows!
+        event.accept();
+    });
     if (event.type() == Event::Drop)
         return handle_drop_event(static_cast<DropEvent&>(event));