Author Topic: Please help to review the patch to fix the caret blinking issue (#92)  (Read 3368 times)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5916
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Hi, I have a patch to fix the Ticket #92 cursor blinking speed
Please help the review the code (I don't know how to add comments like /* C::B begin */ and /* C::B end */, since I remove some code, I just comment out the code with the C::B style comment wrapped.

Code
 src/sdk/wxscintilla/src/ScintillaWX.cpp | 20 ++++++++++++++++----
 src/sdk/wxscintilla/src/ScintillaWX.h   |  4 +++-
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/src/sdk/wxscintilla/src/ScintillaWX.cpp b/src/sdk/wxscintilla/src/ScintillaWX.cpp
index da1538c..96ed629 100644
--- a/src/sdk/wxscintilla/src/ScintillaWX.cpp
+++ b/src/sdk/wxscintilla/src/ScintillaWX.cpp
@@ -343,7 +343,10 @@ void ScintillaWX::Initialise() {
 
 void ScintillaWX::Finalise() {
     ScintillaBase::Finalise();
-    SetTicking(false);
+/* C::B begin */
+// SetTicking function is deprecated since we implement fine grained timers
+//    SetTicking(false);
+/* C::B end */
     SetIdle(false);
     DestroySystemCaret();
 }
@@ -405,7 +408,9 @@ bool ScintillaWX::SetIdle(bool on) {
     return idler.state;
 }
 
-
+/* C::B begin */
+#if 0 // SetTicking function get deprecated
+/* C::B end */
 void ScintillaWX::SetTicking(bool on) {
     wxSCITimer* sciTimer;
     if (timer.ticking != on) {
@@ -423,6 +428,9 @@ void ScintillaWX::SetTicking(bool on) {
     }
     timer.ticksToWait = caret.period;
 }
+/* C::B begin */
+#endif
+/* C::B end */
 
 
 void ScintillaWX::SetMouseCapture(bool on) {
@@ -1127,7 +1135,9 @@ void ScintillaWX::DoLoseFocus(){
     SetMouseCapture(false);
 /* C::B end */
     DestroySystemCaret();
-    SetTicking(false);
+/* C::B begin */
+    //SetTicking(false);
+/* C::B end */
 }
 
 void ScintillaWX::DoGainFocus(){
@@ -1136,7 +1146,9 @@ void ScintillaWX::DoGainFocus(){
     focusEvent = false;
     DestroySystemCaret();
     CreateSystemCaret();
-    SetTicking(true);
+/* C::B begin */
+    //SetTicking(true);
+/* C::B end */
 }
 
 void ScintillaWX::DoSysColourChange() {
diff --git a/src/sdk/wxscintilla/src/ScintillaWX.h b/src/sdk/wxscintilla/src/ScintillaWX.h
index 2e02405..96de9d2 100644
--- a/src/sdk/wxscintilla/src/ScintillaWX.h
+++ b/src/sdk/wxscintilla/src/ScintillaWX.h
@@ -119,7 +119,9 @@ public:
     virtual void Finalise();
     virtual void StartDrag();
     virtual bool SetIdle(bool on);
-    virtual void SetTicking(bool on);
+/* C::B begin */
+    //virtual void SetTicking(bool on);
+/* C::B end */
     virtual void SetMouseCapture(bool on);
     virtual bool HaveMouseCapture();
     virtual void ScrollText(int linesToMove);


Thanks.

If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5916
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Please help to review the patch to fix the caret blinking issue (#92)
« Reply #1 on: November 29, 2014, 03:30:49 pm »
In trunk now, feel free to adjust.  ;)
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.