mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:47:34 +00:00
LibGUI+AK: Add DRAG_DEBUG opt and put drag operations behind dbgln_if
No need to have this enabled all the time.
This commit is contained in:
parent
f43b69f8e2
commit
4459cb33ed
4 changed files with 14 additions and 7 deletions
|
@ -102,6 +102,10 @@
|
||||||
#cmakedefine01 DOUBLECLICK_DEBUG
|
#cmakedefine01 DOUBLECLICK_DEBUG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef DRAG_DEBUG
|
||||||
|
#cmakedefine01 DRAG_DEBUG
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef DWARF_DEBUG
|
#ifndef DWARF_DEBUG
|
||||||
#cmakedefine01 DWARF_DEBUG
|
#cmakedefine01 DWARF_DEBUG
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -35,6 +35,7 @@ set(DHCPV4_DEBUG ON)
|
||||||
set(DIFF_DEBUG ON)
|
set(DIFF_DEBUG ON)
|
||||||
set(DISASM_DUMP_DEBUG ON)
|
set(DISASM_DUMP_DEBUG ON)
|
||||||
set(DOUBLECLICK_DEBUG ON)
|
set(DOUBLECLICK_DEBUG ON)
|
||||||
|
set(DRAG_DEBUG ON)
|
||||||
set(DWARF_DEBUG ON)
|
set(DWARF_DEBUG ON)
|
||||||
set(DYNAMIC_LOAD_DEBUG ON)
|
set(DYNAMIC_LOAD_DEBUG ON)
|
||||||
set(E1000_DEBUG ON)
|
set(E1000_DEBUG ON)
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <AK/Debug.h>
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
#include <AK/Utf8View.h>
|
#include <AK/Utf8View.h>
|
||||||
#include <AK/Vector.h>
|
#include <AK/Vector.h>
|
||||||
|
@ -307,7 +308,7 @@ void AbstractView::mousemove_event(MouseEvent& event)
|
||||||
// Prevent this by just ignoring later drag initiations (until the current drag operation ends).
|
// Prevent this by just ignoring later drag initiations (until the current drag operation ends).
|
||||||
TemporaryChange dragging { m_is_dragging, true };
|
TemporaryChange dragging { m_is_dragging, true };
|
||||||
|
|
||||||
dbgln("Initiate drag!");
|
dbgln_if(DRAG_DEBUG, "Initiate drag!");
|
||||||
auto drag_operation = DragOperation::construct();
|
auto drag_operation = DragOperation::construct();
|
||||||
|
|
||||||
drag_operation->set_mime_data(m_model->mime_data(m_selection));
|
drag_operation->set_mime_data(m_model->mime_data(m_selection));
|
||||||
|
@ -316,10 +317,10 @@ void AbstractView::mousemove_event(MouseEvent& event)
|
||||||
|
|
||||||
switch (outcome) {
|
switch (outcome) {
|
||||||
case DragOperation::Outcome::Accepted:
|
case DragOperation::Outcome::Accepted:
|
||||||
dbgln("Drag was accepted!");
|
dbgln_if(DRAG_DEBUG, "Drag was accepted!");
|
||||||
break;
|
break;
|
||||||
case DragOperation::Outcome::Cancelled:
|
case DragOperation::Outcome::Cancelled:
|
||||||
dbgln("Drag was cancelled!");
|
dbgln_if(DRAG_DEBUG, "Drag was cancelled!");
|
||||||
m_might_drag = false;
|
m_might_drag = false;
|
||||||
break;
|
break;
|
||||||
default:
|
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
|
// We might be able to reduce event traffic by communicating the set of drag-accepting
|
||||||
// rects in this widget to the windowing system somehow.
|
// rects in this widget to the windowing system somehow.
|
||||||
event.accept();
|
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)
|
void AbstractView::drag_move_event(DragEvent& event)
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/Assertions.h>
|
#include <AK/Assertions.h>
|
||||||
|
#include <AK/Debug.h>
|
||||||
#include <AK/JsonObject.h>
|
#include <AK/JsonObject.h>
|
||||||
#include <LibGUI/Action.h>
|
#include <LibGUI/Action.h>
|
||||||
#include <LibGUI/Application.h>
|
#include <LibGUI/Application.h>
|
||||||
|
@ -553,17 +554,17 @@ void Widget::drag_enter_event(DragEvent& event)
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
builder.join(',', event.mime_types());
|
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&)
|
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)
|
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();
|
event.ignore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue