[SOLVED] Flicker when moving a window?

After some discussions about my application’s architecture. I’ve moved to running all the GUI stuff in the main thread, and the various BWindow’s just send events over to the main thread. This is looking like a great match for the way things work on Win/Mac/GTK. However what I’m noticing is that the client area flickers white a LOT when I move my window. Not when I resize, just when I move.

Both the BWindow and BView override classes are in here. In the ::Draw override I’m just painting a memory context onto the BView. Not much else. As soon as I do anything more than paint a blank grey rectangle the AppServer decides to clear the screen to white before painting my image. Causing the flicker. This happens the same on both my virtual machine install, and my bare metal machine (which is now running an ATI 6600XT).

Many other apps don’t have this issue. So it seems like I’m at fault here… the view is set to B_TRANSPARENT_BACKGROUND. And the BWindow subclass:
BWindow(
/* frame: */ BRect(100,100,400,400),
/* title: */ MakeName(owner),
/* look: */ B_DOCUMENT_WINDOW_LOOK,
/* feel: */ B_NORMAL_WINDOW_FEEL,
/* flags: */ B_WILL_ACCEPT_FIRST_CLICK),

Is there something I can do to stop it flickering like that?

If I remember correctly, you have to set your view color to B_TRANSPARENT_COLOR otherwise the default white gets used.

I’m already doing that (line 73). Which is why I’m surprised it’s flickering.

Unless you want to make your BView transparent (content under BView will be drawn before BView::Draw call), you do not need B_TRANSPARENT_BACKGROUND flag.

3 Likes

Oh fantastic… getting rid of that fixes the flickering! So good!

2 Likes