aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32
diff options
context:
space:
mode:
authorNathaniel Braun <unknown>2026-01-08 08:22:01 +1100
committerNathaniel Braun <unknown>2026-01-08 08:22:01 +1100
commit56c071e2734e3812c7c77b611637cbc2698eb7d3 (patch)
tree5da57f71c12bef0a8bd2706a0d8773cb5442ddfe /win32
parent0627663abd14c81cafde85ce9cc0502d9bc3a6c3 (diff)
downloadscintilla-mirror-56c071e2734e3812c7c77b611637cbc2698eb7d3.tar.gz
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.
Diffstat (limited to 'win32')
-rw-r--r--win32/ScintillaWin.cxx13
1 files changed, 11 insertions, 2 deletions
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;