MSW specific: ObjectList: Fixed false possible DnD, when mouse click outside of ObjectList and than mouse move over the ObjectList.

Fix for #13062 too
This commit is contained in:
YuSanka 2024-07-17 15:51:18 +02:00 committed by Lukas Matena
parent d5c7001a7c
commit 92d08da96d
2 changed files with 21 additions and 0 deletions

View File

@ -228,6 +228,15 @@ ObjectList::ObjectList(wxWindow* parent) :
set_tooltip_for_item(this->get_mouse_position_in_control());
event.Skip();
});
GetMainWindow()->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& event) {
m_mouse_left_down = true;
event.Skip();
});
GetMainWindow()->Bind(wxEVT_LEFT_UP, [this](wxMouseEvent& event) {
m_mouse_left_down = false;
event.Skip();
});
#endif //__WXMSW__
Bind(wxEVT_DATAVIEW_ITEM_CONTEXT_MENU, &ObjectList::OnContextMenu, this);
@ -1212,6 +1221,15 @@ void ObjectList::key_event(wxKeyEvent& event)
void ObjectList::OnBeginDrag(wxDataViewEvent &event)
{
#ifdef __WXMSW__
if (!m_mouse_left_down) {
event.Veto();
return;
}
// Invalidate LeftDown flag emmidiately to avoid its unexpected using next time.
m_mouse_left_down = false;
#endif // __WXMSW__
if (m_is_editing_started)
m_is_editing_started = false;
#ifdef __WXGTK__

View File

@ -114,6 +114,9 @@ private:
int m_selected_layers_range_idx {-1};
Clipboard m_clipboard;
#ifdef __WXMSW__
bool m_mouse_left_down{ false };
#endif
struct dragged_item_data
{