Resize buffer on window change


I want to use LVGL with the V programming language to write basic GUI apps across desktops, mobile and some specific targets (homebrew for consoles like the PS Vita).

Since the resoltuion is always the same on mobile devices - since they use a fullscreen “window” by default - there is no need to resize the frame buffer. However, what about desktop? I know LVGL is ment for smaller, embedded devices - but take a look around the landscape of GUI libraries and you’ll find yourself surprised at just how lackluster some of them are. So, long story short, after a long time of going from idea to idea, I want to settle on LVGL as the GUI library for my projects.

Since V has a feature that conditionally picks source files (i.e. foo_windows.v on Windows but foo_darwin.v on macOS instead), I have quite some leeway of implementing the actual rendering code. After taking a look at the lv_disp_drv_t type, it seems that I can update a display driver - even in it’s height and width.

So, can I rely on being able to update the display driver during a window resize event handler? And how will components on screen behave? Will they be responsive and adjust to the changed dimensions?

What MCU/Processor/Board and compiler are you using?

Depends on the platform; but generally, ARM and AMD64.

What LVGL version are you using?

Currently reading the docs of 7.10.x, but I will start with version 8 once I have my resources together.

What do you want to achieve?

To recap from above: When V compiles code, it can determine source files to be used per platform, so I have a chance to implement a “responsive” display driver at this point. Now, I just want to figure out the best way to resize the buffer when on desktop and the host window changes it’s size.

What have you tried so far?

I have been reading the documentation and greping my way through the LVGL git master to find certain information. I also took a long look at the config template.

Code to reproduce


Screenshot and/or video