Jump to content

Recommended Posts

Posted

Hello!
I recorded a video The screen is redrawn more than once. I did not find the reason for this phenomenon quickly. I need help.
When uGFX is initialized, screen elements are formed in the usual way, nothing extra.
At the beginning, when you press the button, the screen with the button is hidden and a function is called that makes the screen with TabSet visible.

    case GEVENT_GWIN_BUTTON:            ///(GEVENT_GWIN_CTRL_FIRST+0)
        if (((GEventGWinButton*)pe)->gwin == mainProductButton) {
            gwinHide(mainContainer);
            _ghActiveScreen = productScreenShow();
        }
GHandle productScreenShow(void)
{
    productScreenUpdate();
    gwinShow(prodTabset);
    return prodTabset;
}

Clicking on tabs only causes one screen repaint. See video.

When returning to the previous screen, it is redrawn twice.

I set a breakpoint on the gwinTabsetDraw_Std function and got this call stack:

image.png.4fcc421d17f145a7122542e16d7013f8.png

What should be done to make the screen redrawn once?

Posted

Looking at the video, whenever you swap screens (using either button) it is doing the double drawing. It is much more visible with the tab with the list because font drawing is relatively slow, but it is also happening when you switch to the button screen.

uGFX's window manager is really dumb because the drawing engine doesn't support multiple clip areas, which means it struggles with overlapping Windows. That can often lead to double draw operations. The reason the tab control doesn't have this issue is because the control code itself understands exactly how the tab pages overlap and therefore optimises its drawing for that

Check if when you are switching between the tab window and the button window that you are hiding the old window before making the new window visible so that there is only one visible full screen page at any time.

I hope that helps

Posted

I went through the debugger and figured out the logic of the window manager. The _gwinFlushRedraws function contains two branches: "Do loss of visibility first" and "Do the visible windows next". The new window is redrawn twice, here's why. The first time as a hidden window, but the visibility flag is already set. The second time as a window that is visible. It turns out that we need to somehow make it so that the new window is not redrawn as invisible. Is it possible to do this?

Posted

It has been a long time since I looked at the code but...

It should be possible to retest the visibility flag in the invisible loop. If the window is now visible don't redraw it because it will get redrawn later.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...