lv_port_pc_visual_studio
lv_port_pc_visual_studio copied to clipboard
Size of the screen is not perfect.
Problem
When you specify 800x480 for example, the size of the content screen is less than that since is taking space from the title bar.
Potential Solution
When initializing the screen in the wind32drv.c, we can modify the CreateWindowExW in this way:
HWND display_window_handle = CreateWindowExW(
NULL,
LVGL_SIMULATOR_WINDOW_CLASS,
window_title,
WS_POPUP,
CW_USEDEFAULT,
0,
hor_res,
ver_res,
NULL,
NULL,
instance_handle,
NULL);
Basically we change
- WINDOW_EX_STYLE to NULL
- WINDOW_STYLE to WS_POPUP
This way the screen wont have title bar but the content size will be the exact one.
When you specify 800x480 for example, the size of the content screen is less than that since is taking space from the title bar.
If you have read the implementation, you will know the implementation will adjust to the correct content resolution. So, it won’t affect.
https://github.com/lvgl/lv_port_pc_visual_studio/blob/c042c669ba4881fd273890e0c2aeff843bc4e53a/LvglWindowsSimulator/win32drv.c#L1518-L1523
https://github.com/lvgl/lv_port_pc_visual_studio/blob/c042c669ba4881fd273890e0c2aeff843bc4e53a/LvglWindowsSimulator/win32drv.c#L1585-L1627
Kenji Mouri
When you specify 800x480 for example, the size of the content screen is less than that since is taking space from the title bar.
If you have read the implementation, you will know the implementation will adjust to the correct content resolution. So, it won’t affect.
https://github.com/lvgl/lv_port_pc_visual_studio/blob/c042c669ba4881fd273890e0c2aeff843bc4e53a/LvglWindowsSimulator/win32drv.c#L1518-L1523
https://github.com/lvgl/lv_port_pc_visual_studio/blob/c042c669ba4881fd273890e0c2aeff843bc4e53a/LvglWindowsSimulator/win32drv.c#L1585-L1627
Kenji Mouri
Hi Kenji, that looks like it should do the trick, however, when i tested it, i took several screenshots with different sizes, etc... they were all having less because of the title bar, i'm not sure if it was a bug on my side or what.
Hi, regarding this problem, it looks like it's related to the DPI of 125% from Windows of my screen, 400 x 300 is 320 x 240 * 1.25 that is my scale. I tried to put the overrideDPI as false and true and nothing changes there.
Even in the latest commit is still like that, i'm not sure if i'm doing something wrong.
Hi, regarding this problem, it looks like it's related to the DPI of 125% from Windows of my screen, 400 x 300 is 320 x 240 * 1.25 that is my scale.
https://docs.lvgl.io/master/integration/driver/windows.html
Maybe this doc will do some help.
Kenji Mouri
Hi there @MouriNaruto thanks for the link, sadly it doesn't work. Let me explain the situation...
If i run LVGLSimulator project with DPI 100% in Windows, it works. ✅ If i run LVGLSimulator project with DPI 125% in Windows, it doesn't work. ❌
I tried both simulator and desktop mode, also i tried to change DPI Override etc..., it doesn't work.
320 x 240 pixels.
DPI 100% Simulator Mode ✅
DPI 125% Simulator Mode ❌
You can check that the size is different, changing the desktop and dpi in code doesn't work.
Got it. I will try to do some fix.
Kenji Mouri
my computer DPI = 125%, I change
LvglWindowsSimulator.cpp
26 line
bool simulator_mode = false;
it present 100%
Default is true, display 125%, font is blurry