lv_port_pc_visual_studio icon indicating copy to clipboard operation
lv_port_pc_visual_studio copied to clipboard

Size of the screen is not perfect.

Open Kirbyrawr opened this issue 1 year ago • 9 comments

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. imagen

Kirbyrawr avatar Dec 31 '23 21:12 Kirbyrawr

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

MouriNaruto avatar Jan 02 '24 02:01 MouriNaruto

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.

Kirbyrawr avatar Jan 03 '24 02:01 Kirbyrawr

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.

Kirbyrawr avatar Jan 21 '24 17:01 Kirbyrawr

Even in the latest commit is still like that, i'm not sure if i'm doing something wrong.

Kirbyrawr avatar Jan 21 '24 17:01 Kirbyrawr

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

MouriNaruto avatar Jan 22 '24 00:01 MouriNaruto

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.

Kirbyrawr avatar Jan 22 '24 13:01 Kirbyrawr

320 x 240 pixels.

DPI 100% Simulator Mode ✅ imagen

DPI 125% Simulator Mode ❌ imagen

You can check that the size is different, changing the desktop and dpi in code doesn't work.

Kirbyrawr avatar Jan 22 '24 13:01 Kirbyrawr

Got it. I will try to do some fix.

Kenji Mouri

MouriNaruto avatar Jan 22 '24 14:01 MouriNaruto

Snipaste_2024-06-29_13-09-17 my computer DPI = 125%, I change LvglWindowsSimulator.cpp 26 line

bool simulator_mode = false;

it present 100% Snipaste_2024-06-29_12-56-08 Default is true, display 125%, font is blurry Snipaste_2024-06-29_12-56-22

Bendikos avatar Jun 29 '24 05:06 Bendikos