-
Notifications
You must be signed in to change notification settings - Fork 303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The Window size (client area) is incorrect when using Windows display driver. #86
Comments
We need some feedback on this issue. Now we mark this as "stale" because there was no activity here for 14 days. Remove the "stale" label or comment else this will be closed in 7 days. |
Thank you for reporting it! @MouriNaruto could you take look at this issue? |
I believe there are also 2 one-off errors in this call. Specifically: width should be = rc.right - rc.left + 1 + (2 * edge_width); or width should be = rc.right - rc.left + 1 + (edge_width << 1); if your compiler doesn't optimize multiplying by 2. I am a little rusty on Width = Right - Left and I am 100% certain that: Right = 1 pixel PAST right edge, and Note: There are ways to create a window where the width and height passed are for the CLIENT AREA, which is what is wanted. This question/answer on stackexchange.com covers one way to do that. Kind regards, |
I will try to fix that. Kenji Mouri |
We need some feedback on this issue. Now we mark this as "stale" because there was no activity here for 14 days. Remove the "stale" label or comment else this will be closed in 7 days. |
@MouriNaruto did you have time to look into this? |
I will look into this issue in the recent days. Kenji Mouri |
We need some feedback on this issue. Now we mark this as "Abandoned" because there was no activity here for 14 days. Remove the "Stale" label or comment else this will be closed in 7 days. |
not stale |
We need some feedback on this issue. Now we mark this as "Abandoned" because there was no activity here for 14 days. Remove the "Stale" label or comment else this will be closed in 7 days. |
How are we doing with this issue? |
Actually, it should not have the issue when people use the simulator mode in the current stage Note: My screen is 125% DPI scaling, so I set the zoom_level to 80% for rendering the content without scaling (1.25 * 0.8 = 1). It shows the client area is the same as which I set for the lv_windows_create_display. Kenji Mouri |
Transferred to |
Hello, Please try the following parameters when initializing the windows display. I think you may reproduce this issue. |
You need to use the simulator mode to achieve your needs by design. Read https://docs.lvgl.io/master/details/integration/driver/windows.html for more information. Kenji Mouri |
Hello, The problem is if not using simulator mode, the WM_SIZE will update the "context->requested_display_resolution" to actual window client size. refer to (https://learn.microsoft.com/en-us/windows/win32/winmsg/wm-size) , it says the LPARAM represents the windows client area width and height. The reason why it works good in simulator mode is because the code will re-calculate the actual window size and the non-client area size will be taken into account. I think we can fix it when handling the WM_CREATE message. What do you think about ? |
@sliang951753 It's actually the designed behavior for non-simulator mode because non-simulator mode is designed for developing Windows desktop applications with LVGL. So, you need to support auto-resizing if you want to develop Windows desktop applications with LVGL. Kenji Mouri |
@sliang951753 Also, for desktop application development, the resolution you set should be the window size instead of the window client area size for following the convention of other desktop UI infrastructures. Kenji Mouri |
@sliang951753 If you want to make your window client area size must be equal to the resolution you set. You should choose the simulator mode because it's designed for that. Kenji Mouri |
I have created the simulator mode and application mode for LVGL v9 Windows backend because I think we should make LVGL have the ability to develop Windows desktop applications, but the classic simulator behavior also should be provided with the option enabled if users want to have. Kenji Mouri |
@MouriNaruto Sure, I understand your design. However, I don't want the window being scaled and the zoom level should be always 100%. Because if the window is scaled, all widgets and any drawing on this window will be blurred. That's not really good. I saw the code will try to get the current monitor's DPI but simulator should keeps the same DPI as the real device. So that the UI appearance will be consistently on both PC and device. What about we add customized DPI parameter in the create display function or other options to achieve this requirement ? If so, I thinks this would be perfect. |
@sliang951753 zoom_level and allow_dpi_override will help you achieve that.
If you use a tablet with a High DPI screen like the Surface Pro series, you will know why we need DPI scaling for content in the simulator mode by default. (I added that feature because some people said they cannot see the simulation result properly in high DPI environments.) Kenji Mouri |
Of course, I can imagine that. But what about adding customized DPI to not following the monitor DPI settings as an extra option for this display driver. I think that wouldn't conflict with the original design concept but we might have an additional choice. |
You can set the zoom_level and allow_dpi_override parameters when calling lv_windows_create_display. These two are for achieving that goal. Kenji Mouri |
How can I determine the actual zoom level to achieve the desired resolution for different monitor DPI ? |
You can disable the dpi override in simulator mode when creating LVGL display. Kenji Mouri |
That didn't work. |
Or you should change the zoom-level. But I don't think we should keep 100% scaling all time in simulator mode because the PPI for desktop and your embedded device are different. We keep the LVGL display resolution and dpi, but post-process for showing on desktop device screen properly is important. Kenji Mouri |
The goal of simulator mode is showing the UI layout properly on any desktop devices with specific LVGL display resolution and dpi. Due to the desktop screen PPI and embedded device PPI are different in most of cases. We should not disable post-process scaling for simulator mode. Kenji Mouri |
Of course we can't keep 100% scaling, otherwise it is not possible to achieve the desired Window size in simulator mode. |
Currently, the post-process DPI scaling is followed by Windows current monitor DPI, and keep the DPI setting in LVGL display to ensure the LVGL content layout is properly in the simulator mode. If you want to have the more flexible scenario, please use the application mode. Don't be lazy for that. Kenji Mouri |
Currently, Windows backend doesn't support simulator mode without post-process DPI scaling. The simulator mode is not designed for more flexible scenario because it's only for simulation. If you want to have the DPI scaling behavior like Windows desktop application, please don't be lazy, use the application mode instead. Kenji Mouri |
@MouriNaruto Hi! Can you direct me on where to find out more about the "application mode" you are referring to? Kind regards, |
Read https://docs.lvgl.io/master/details/integration/driver/windows.html you will know what's the differences between two modes. Kenji Mouri |
Thank you!! |
LVGL version
v9.0.0
What happened?
When using lv_windows_create_display() to create LVGL display, the Window's client area always smaller than the specified screen resolution.
for example, lv_windows_create_display(L"LVGL Window", 1024, 600, 100, true, false);
then, the created window is at the resolution of 1024*600, however, its client area is smaller and about to 1000 * 550.
This is because the specified display resolution does not consider the window caption and client edge size.
Here's a possible fix for this issue.
In lv_windows_display_thread_entrypoint() function, calling AdjustWindowRectEx before CreateWindowExW.
` RECT rc = {0, 0, data->hor_res, data->ver_res};
AdjustWindowRectEx(&rc, window_style, FALSE, WS_EX_CLIENTEDGE);
How to reproduce?
No response
The text was updated successfully, but these errors were encountered: