From 56c071e2734e3812c7c77b611637cbc2698eb7d3 Mon Sep 17 00:00:00 2001 From: Nathaniel Braun Date: Thu, 8 Jan 2026 08:22:01 +1100 Subject: Feature [feature-requests:#184]. Add option to disable drag/drop editing SCI_SETDRAGDROPENABLED. Fully implemented on Win32 but may only prevent dragging on other platforms. --- win32/ScintillaWin.cxx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'win32') diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index dfe075293..17f686c21 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -1754,7 +1754,7 @@ Window::Cursor ScintillaWin::ContextCursor(Point pt) { // Display regular (drag) cursor over selection if (PointInSelMargin(pt)) { return GetMarginCursor(pt); - } else if (!SelectionEmpty() && PointInSelection(pt)) { + } else if (!SelectionEmpty() && PointInSelection(pt) && dragDropEnabled) { return Window::Cursor::arrow; } else if (PointIsHotspot(pt)) { return Window::Cursor::hand; @@ -3721,6 +3721,10 @@ STDMETHODIMP_(ULONG) ScintillaWin::Release() { /// Implement IDropTarget STDMETHODIMP ScintillaWin::DragEnter(LPDATAOBJECT pIDataSource, DWORD grfKeyState, POINTL, PDWORD pdwEffect) { + if (!dragDropEnabled) { + *pdwEffect = DROPEFFECT_NONE; + return S_OK; + } if (!pIDataSource ) return E_POINTER; FORMATETC fmtu = {CF_UNICODETEXT, nullptr, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; @@ -3737,7 +3741,7 @@ STDMETHODIMP ScintillaWin::DragEnter(LPDATAOBJECT pIDataSource, DWORD grfKeyStat STDMETHODIMP ScintillaWin::DragOver(DWORD grfKeyState, POINTL pt, PDWORD pdwEffect) { try { - if (!hasOKText || pdoc->IsReadOnly()) { + if (!dragDropEnabled || !hasOKText || pdoc->IsReadOnly()) { *pdwEffect = DROPEFFECT_NONE; return S_OK; } @@ -3771,6 +3775,11 @@ STDMETHODIMP ScintillaWin::Drop(LPDATAOBJECT pIDataSource, DWORD grfKeyState, try { *pdwEffect = EffectFromState(grfKeyState); + if (!dragDropEnabled) { + *pdwEffect = DROPEFFECT_NONE; + return S_OK; + } + if (!pIDataSource) return E_POINTER; -- cgit v1.2.3