black window after un-minimizing
2022 build tools win 11 x64 v9.1.1
When LvglWindowDesktopApplication is minimized and then un-minimized the window is black. When the app is then maximized the window recovers.
I also see #71 -- it seems to consume 100% of one of my cpu cores - the memory seems stable.
Thank you - Scott
Nice project!
I need to do some reproduce work to fix the issue.
Kenji Mouri
Found a solution?
The window needs repainting in full when un-minimizing otherwise only dirty areas will be painted when called. Maybe use WM_WINDOWPOSCHANGED or similar.
Is there any remedy currently available?
The window needs repainting in full when un-minimizing otherwise only dirty areas will be painted when called. Maybe use WM_WINDOWPOSCHANGED or similar.
Can you explain in detail how to remedy this problem? Thank you very much!
@ou2356 I'm working on this at the moment. Are you using v9.0.0 release?
@ou2356 I'm working on this at the moment. Are you using v9.0.0 release?
Yes, I am using v9.0.0 release. I am looking forward to hearing good news from you very much.
@ou2356
Hi there.
I deleted my previous message as it turns out my suggestion only worked on my win11 machine and failed on win10.
Maybe try this (which seems to work on both and is simpler):
In lvgl/src/drivers/windows/lv_windows_context.c
Comment out the "if(wParam != SIZE_MINIMIZED) {"
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
case WM_SIZE: { // if(wParam != SIZE_MINIMIZED) { lv_windows_window_context_t * context = (lv_windows_window_context_t *)( lv_windows_get_window_context(hWnd)); if(context) { if(!context->simulator_mode) { context->display_resolution_changed = true; context->requested_display_resolution.x = LOWORD(lParam); context->requested_display_resolution.y = HIWORD(lParam); } else { int32_t window_width = lv_windows_dpi_to_physical( lv_windows_zoom_to_physical( lv_display_get_horizontal_resolution( context->display_device_object), context->zoom_level), context->window_dpi); int32_t window_height = lv_windows_dpi_to_physical( lv_windows_zoom_to_physical( lv_display_get_vertical_resolution( context->display_device_object), context->zoom_level), context->window_dpi);
RECT window_rect;
GetWindowRect(hWnd, &window_rect);
RECT client_rect;
GetClientRect(hWnd, &client_rect);
int32_t original_window_width =
window_rect.right - window_rect.left;
int32_t original_window_height =
window_rect.bottom - window_rect.top;
int32_t original_client_width =
client_rect.right - client_rect.left;
int32_t original_client_height =
client_rect.bottom - client_rect.top;
int32_t reserved_width =
original_window_width - original_client_width;
int32_t reserved_height =
original_window_height - original_client_height;
SetWindowPos(
hWnd,
NULL,
0,
0,
reserved_width + window_width,
reserved_height + window_height,
SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE);
}
}
// }
break;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
nik
@nikthefix Hi ! I commented out the condition 'if (wParam!=SIZE-MIIMIZED) {' based on your suggestion and found that it worked.
case WM_SIZE: {
//if(wParam != SIZE_MINIMIZED) {
lv_windows_window_context_t * context = (lv_windows_window_context_t *)(
lv_windows_get_window_context(hWnd));
if(context) {
if(!context->simulator_mode) {
context->display_resolution_changed = true;
context->requested_display_resolution.x = LOWORD(lParam);
context->requested_display_resolution.y = HIWORD(lParam);
}
else {
int32_t window_width = lv_windows_dpi_to_physical(
lv_windows_zoom_to_physical(
lv_display_get_horizontal_resolution(
context->display_device_object),
context->zoom_level),
context->window_dpi);
int32_t window_height = lv_windows_dpi_to_physical(
lv_windows_zoom_to_physical(
lv_display_get_vertical_resolution(
context->display_device_object),
context->zoom_level),
context->window_dpi);
RECT window_rect;
GetWindowRect(hWnd, &window_rect);
RECT client_rect;
GetClientRect(hWnd, &client_rect);
int32_t original_window_width =
window_rect.right - window_rect.left;
int32_t original_window_height =
window_rect.bottom - window_rect.top;
int32_t original_client_width =
client_rect.right - client_rect.left;
int32_t original_client_height =
client_rect.bottom - client_rect.top;
int32_t reserved_width =
original_window_width - original_client_width;
int32_t reserved_height =
original_window_height - original_client_height;
SetWindowPos(
hWnd,
NULL,
0,
0,
reserved_width + window_width,
reserved_height + window_height,
SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE);
}
}
//}
break;
}
My testing environment is as follows: Visual Studio 2022 win 11 x64 v9.0.0 release LVGL v9.3.0
Thank you very much for your hard work! I am extremely grateful.
@ou2356 You're welcome and thanks for feeding back.
This issue or pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.