diff --git a/AK/Debug.h.in b/AK/Debug.h.in index 85296bc015a009..b6c0c125c6795a 100644 --- a/AK/Debug.h.in +++ b/AK/Debug.h.in @@ -102,6 +102,10 @@ #cmakedefine01 DOUBLECLICK_DEBUG #endif +#ifndef DRAG_DEBUG +#cmakedefine01 DRAG_DEBUG +#endif + #ifndef DWARF_DEBUG #cmakedefine01 DWARF_DEBUG #endif diff --git a/Meta/CMake/all_the_debug_macros.cmake b/Meta/CMake/all_the_debug_macros.cmake index bd2e5f118296c8..c71f3dc0c53af6 100644 --- a/Meta/CMake/all_the_debug_macros.cmake +++ b/Meta/CMake/all_the_debug_macros.cmake @@ -35,6 +35,7 @@ set(DHCPV4_DEBUG ON) set(DIFF_DEBUG ON) set(DISASM_DUMP_DEBUG ON) set(DOUBLECLICK_DEBUG ON) +set(DRAG_DEBUG ON) set(DWARF_DEBUG ON) set(DYNAMIC_LOAD_DEBUG ON) set(E1000_DEBUG ON) diff --git a/Userland/Libraries/LibGUI/AbstractView.cpp b/Userland/Libraries/LibGUI/AbstractView.cpp index 2b0af648c52dc3..c19565c2f771a9 100644 --- a/Userland/Libraries/LibGUI/AbstractView.cpp +++ b/Userland/Libraries/LibGUI/AbstractView.cpp @@ -4,6 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include #include #include #include @@ -307,7 +308,7 @@ void AbstractView::mousemove_event(MouseEvent& event) // Prevent this by just ignoring later drag initiations (until the current drag operation ends). TemporaryChange dragging { m_is_dragging, true }; - dbgln("Initiate drag!"); + dbgln_if(DRAG_DEBUG, "Initiate drag!"); auto drag_operation = DragOperation::construct(); drag_operation->set_mime_data(m_model->mime_data(m_selection)); @@ -316,10 +317,10 @@ void AbstractView::mousemove_event(MouseEvent& event) switch (outcome) { case DragOperation::Outcome::Accepted: - dbgln("Drag was accepted!"); + dbgln_if(DRAG_DEBUG, "Drag was accepted!"); break; case DragOperation::Outcome::Cancelled: - dbgln("Drag was cancelled!"); + dbgln_if(DRAG_DEBUG, "Drag was cancelled!"); m_might_drag = false; break; default: @@ -754,7 +755,7 @@ void AbstractView::drag_enter_event(DragEvent& event) // We might be able to reduce event traffic by communicating the set of drag-accepting // rects in this widget to the windowing system somehow. event.accept(); - dbgln("accepting drag of {}", event.mime_types().first()); + dbgln_if(DRAG_DEBUG, "accepting drag of {}", event.mime_types().first()); } void AbstractView::drag_move_event(DragEvent& event) diff --git a/Userland/Libraries/LibGUI/Widget.cpp b/Userland/Libraries/LibGUI/Widget.cpp index edc1702fa7bd63..78af0d96559f43 100644 --- a/Userland/Libraries/LibGUI/Widget.cpp +++ b/Userland/Libraries/LibGUI/Widget.cpp @@ -5,6 +5,7 @@ */ #include +#include #include #include #include @@ -553,17 +554,17 @@ void Widget::drag_enter_event(DragEvent& event) { StringBuilder builder; builder.join(',', event.mime_types()); - dbgln("{} {:p} DRAG ENTER @ {}, {}", class_name(), this, event.position(), builder.string_view()); + dbgln_if(DRAG_DEBUG, "{} {:p} DRAG ENTER @ {}, {}", class_name(), this, event.position(), builder.string_view()); } void Widget::drag_leave_event(Event&) { - dbgln("{} {:p} DRAG LEAVE", class_name(), this); + dbgln_if(DRAG_DEBUG, "{} {:p} DRAG LEAVE", class_name(), this); } void Widget::drop_event(DropEvent& event) { - dbgln("{} {:p} DROP @ {}, '{}'", class_name(), this, event.position(), event.text()); + dbgln_if(DRAG_DEBUG, "{} {:p} DROP @ {}, '{}'", class_name(), this, event.position(), event.text()); event.ignore(); }