Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

flicker when I rezize the Build log control(TextCtrlLogger) issue

(1/1)

ollydbg:
Today, I noticed that when I resize the "Build log" panel, I see this window get flickered a lot. When I drag the panel edge between our cbEditor window and the Build log, I don't see the cbEditor get flickered.

So, I prepared a patch, and it looks like with this patch, the "Build log"'s flicker get reduced, can you try this patch? Or maybe there are many other method to handle this.


--- Code: ---From 015270b1dc35f3020e549c0e7af310fcb682b66d Mon Sep 17 00:00:00 2001
From: asmwarrior <hidehide@hidehide.com>
Date: Wed, 25 Mar 2026 18:08:38 +0800
Subject: [PATCH] text logger: try to enable the double buffering to stop the
 flickering

---
 src/sdk/loggers.cpp | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/sdk/loggers.cpp b/src/sdk/loggers.cpp
index f3ec29f8d..25f8d5c18 100644
--- a/src/sdk/loggers.cpp
+++ b/src/sdk/loggers.cpp
@@ -169,6 +169,17 @@ wxWindow* TextCtrlLogger::CreateControl(wxWindow* parent)
 {
     if (!control)
         control = new wxTextCtrl(parent, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH | wxTE_NOHIDESEL | wxTE_AUTO_URL);
+
+    // Enable double buffering to stop flickering
+    if (control)
+    {
+        control->SetDoubleBuffered(true);
+        // In your event table or Bind calls:
+        control->Bind(wxEVT_ERASE_BACKGROUND, [](wxEraseEvent& event) {
+            // Do nothing here to skip the default background clearing
+        });
+    }
+
     return control;
 }
 

--- End code ---

Thanks.

Miguel Gimenez:
Which version of wxWidgets are you using?

Double buffering behaviour has been modified around wx3.3.2, see for example Revert "Enable double buffering for all generic windows in wxMSW"

ollydbg:

--- Quote from: Miguel Gimenez on March 25, 2026, 02:03:27 pm ---Which version of wxWidgets are you using?
--- End quote ---
I'm using the latest wx 3.3.2 release.



--- Quote ---Double buffering behaviour has been modified around wx3.3.2, see for example Revert "Enable double buffering for all generic windows in wxMSW"

--- End quote ---

So, the double buffering is disabled by default in 3.3.2 for the wxTextCtrl class?

Miguel Gimenez:

--- Quote ---So, the double buffering is disabled by default in 3.3.2 for the wxTextCtrl class?
--- End quote ---

I do not know, try calling control->IsDoubleBuffered() after loggers.cpp:171. With 3.2.10 it returns false, and the control does not flicker (in fact, it is not redrawn until I release the mouse button).

ollydbg:
 I wrote some code snippet like this


--- Code: ---    if (control)
    {
        // Check if it's already enabled (either by default or previously set)
        if (!control->IsDoubleBuffered())
        {
            control->SetDoubleBuffered(true);
        }

        // Always a good idea to bind this if you're still seeing "white flashes"
        control->Bind(wxEVT_ERASE_BACKGROUND, [](wxEraseEvent& event) {
            // Leave empty to prevent background clearing
        });
    }
--- End code ---

I set the breakpoint inside the "if (!control->IsDoubleBuffered())" clause, and I see it hit there. So, under wx 3.3.2, the double buffer is not enabled by default, so calling the "control->SetDoubleBuffered(true);" will enable it.



--- Quote ---in fact, it is not redrawn until I release the mouse button
--- End quote ---
OK, I see such option, it is an option for Windows OS's graphics system to reduce the flicker.

Navigation

[0] Message Index

Go to full version