From 9e52243831ceffced1e9f0ef27041770fe13a85a Mon Sep 17 00:00:00 2001 From: Neil Date: Thu, 17 Jun 2021 09:28:05 +1000 Subject: Add SciFnDirectStatus, a direct access function which also returns status so can improve performance for client code that called SCI_GETSTATUS after every API to check for failure. --- gtk/ScintillaGTK.cxx | 11 ++++++++++- gtk/ScintillaGTK.h | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'gtk') diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx index 93a952357..62f1e1e94 100755 --- a/gtk/ScintillaGTK.cxx +++ b/gtk/ScintillaGTK.cxx @@ -3100,7 +3100,16 @@ AtkObject *ScintillaGTK::GetAccessible(GtkWidget *widget) { sptr_t ScintillaGTK::DirectFunction( sptr_t ptr, unsigned int iMessage, uptr_t wParam, sptr_t lParam) { - return reinterpret_cast(ptr)->WndProc(static_cast(iMessage), wParam, lParam); + ScintillaGTK *sci = reinterpret_cast(ptr); + return sci->WndProc(static_cast(iMessage), wParam, lParam); +} + +sptr_t ScintillaGTK::DirectStatusFunction( + sptr_t ptr, unsigned int iMessage, uptr_t wParam, sptr_t lParam, int *pStatus) { + ScintillaGTK *sci = reinterpret_cast(ptr); + const sptr_t returnValue = sci->WndProc(static_cast(iMessage), wParam, lParam); + *pStatus = static_cast(sci->errorStatus); + return returnValue; } /* legacy name for scintilla_object_send_message */ diff --git a/gtk/ScintillaGTK.h b/gtk/ScintillaGTK.h index 715e7ed50..2db733c87 100755 --- a/gtk/ScintillaGTK.h +++ b/gtk/ScintillaGTK.h @@ -271,6 +271,8 @@ private: static sptr_t DirectFunction(sptr_t ptr, unsigned int iMessage, uptr_t wParam, sptr_t lParam); + static sptr_t DirectStatusFunction(sptr_t ptr, + unsigned int iMessage, uptr_t wParam, sptr_t lParam, int *pStatus); }; // helper class to watch a GObject lifetime and get notified when it dies -- cgit v1.2.3