From: Toni Wilen Date: Sun, 18 Aug 2019 18:01:45 +0000 (+0300) Subject: High DPI support updates, box art full screen mode. X-Git-Tag: 4300~144 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=f98ae34a86215a5660a5ab1e685a017b62fab26e;p=francis%2Fwinuae.git High DPI support updates, box art full screen mode. --- diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index 99fd4e34..4398e3e4 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -5528,6 +5528,11 @@ static void WIN32_HandleRegistryStuff (void) else regsetint(NULL, _T("ArtImageWidth"), stored_boxart_window_width); + if (regexists(NULL, _T("ArtImageWidthFS"))) + regqueryint(NULL, _T("ArtImageWidthFS"), &stored_boxart_window_width_fsgui); + else + regsetint(NULL, _T("ArtImageWidthFS"), stored_boxart_window_width_fsgui); + if (regexists (NULL, _T("SaveImageOriginalPath"))) regqueryint (NULL, _T("SaveImageOriginalPath"), &saveimageoriginalpath); else diff --git a/od-win32/win32gfx.cpp b/od-win32/win32gfx.cpp index 59b5c1ff..b464a389 100644 --- a/od-win32/win32gfx.cpp +++ b/od-win32/win32gfx.cpp @@ -913,10 +913,6 @@ static void modesList (struct MultiDisplay *md) } } -#ifndef ABM_GETAUTOHIDEBAREX -#define ABM_GETAUTOHIDEBAREX 0x0000000b -#endif - static void adjustappbar(RECT *monitor, RECT *workrect) { if (!os_vista) @@ -3543,15 +3539,7 @@ static void movecursor (int x, int y) static void getextramonitorpos(struct AmigaMonitor *mon, RECT *r) { - typedef HRESULT(CALLBACK* DWMGETWINDOWATTRIBUTE)(HWND hwnd, DWORD dwAttribute, PVOID pvAttribute, DWORD cbAttribute); - static DWMGETWINDOWATTRIBUTE pDwmGetWindowAttribute; - RECT r1, r2; - if (!pDwmGetWindowAttribute && os_vista) { - HMODULE dwmapihandle = GetModuleHandle(_T("dwmapi.dll")); - if (dwmapihandle) - pDwmGetWindowAttribute = (DWMGETWINDOWATTRIBUTE)GetProcAddress(dwmapihandle, "DwmGetWindowAttribute"); - } // find rightmost window edge int monid = MAX_AMIGAMONITORS - 1; @@ -3577,9 +3565,7 @@ static void getextramonitorpos(struct AmigaMonitor *mon, RECT *r) GetWindowRect(hwnd, &r1); r2 = r1; - if (pDwmGetWindowAttribute) { - pDwmGetWindowAttribute(hwnd, DWMWA_EXTENDED_FRAME_BOUNDS, &r2, sizeof(r2)); - } + getextendedframebounds(hwnd, &r2); int width = r->right - r->left; int height = r->bottom - r->top; diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index e150de77..d1b14cc8 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -102,13 +102,12 @@ #include "gayle.h" #define GUI_SCALE_DEFAULT 100 -#define MIN_GUI_INTERNAL_WIDTH 512 -#define MIN_GUI_INTERNAL_HEIGHT 400 + #define ARCHIVE_STRING _T("*.zip;*.7z;*.rar;*.lha;*.lzh;*.lzx") #define DISK_FORMAT_STRING _T("(*.adf;*.adz;*.gz;*.dms;*.ipf;*.scp;*.fdi;*.exe)\0*.adf;*.adz;*.gz;*.dms;*.ipf;*.scp;*.fdi;*.exe;*.ima;*.wrp;*.dsq;*.st;*.raw;") ARCHIVE_STRING _T("\0") -#define ROM_FORMAT_STRING _T("(*.rom;*.roz;*.a500;*.a600;*.a1200;*.a4000)\0*.rom;*.roz;*.a500;*.a600;*.a1200;*.a4000;") ARCHIVE_STRING _T("\0") +#define ROM_FORMAT_STRING _T("(*.rom;*.roz;*.bin;*.a500;*.a600;*.a1200;*.a4000)\0*.rom;*.roz;*.bin;*.a500;*.a600;*.a1200;*.a4000;") ARCHIVE_STRING _T("\0") #define USS_FORMAT_STRING_RESTORE _T("(*.uss)\0*.uss;*.gz;") ARCHIVE_STRING _T("\0") #define USS_FORMAT_STRING_SAVE _T("(*.uss)\0*.uss\0") #define HDF_FORMAT_STRING _T("(*.hdf;*.vhd;*.rdf;*.hdz;*.rdz;*.chd)\0*.hdf;*.vhd;*.rdf;*.hdz;*.rdz;*.chd\0") @@ -368,6 +367,14 @@ static int gui_get_string_cursor(int *table, HWND hDlg, int item) return table[posn]; } +static void commonproc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + if (msg == WM_DPICHANGED) { + RECT *const r = (RECT *)lParam; + SetWindowPos(hDlg, NULL, r->left, r->top, r->right - r->left, r->bottom - r->top, SWP_NOZORDER | SWP_NOACTIVATE); + } +} + static int stringboxdialogactive; static INT_PTR CALLBACK StringBoxDialogProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { @@ -396,6 +403,7 @@ static INT_PTR CALLBACK StringBoxDialogProc (HWND hDlg, UINT msg, WPARAM wParam, } break; } + commonproc(hDlg, msg, wParam, lParam); return FALSE; } @@ -1730,6 +1738,7 @@ static INT_PTR CALLBACK InfoBoxDialogProc (HWND hDlg, UINT msg, WPARAM wParam, L } break; } + commonproc(hDlg, msg, wParam, lParam); return FALSE; } static bool scan_rom_hook (const TCHAR *name, int line) @@ -2184,13 +2193,13 @@ end: return ret; } -static void box_art_check(struct uae_prefs *p) +static void box_art_check(struct uae_prefs *p, const TCHAR *config) { TCHAR tmp1[MAX_DPATH]; if (cfgfile_detect_art(p, tmp1)) { - show_box_art(tmp1); + show_box_art(tmp1, config); } else { - show_box_art(NULL); + show_box_art(NULL, NULL); } } @@ -2259,6 +2268,7 @@ int target_cfgfile_load (struct uae_prefs *p, const TCHAR *filename, int type, i TCHAR tmp1[MAX_DPATH], tmp2[MAX_DPATH]; TCHAR fname[MAX_DPATH], cname[MAX_DPATH]; + error_log(NULL); _tcscpy (fname, filename); cname[0] = 0; if (!zfile_exists (fname)) { @@ -2306,7 +2316,7 @@ int target_cfgfile_load (struct uae_prefs *p, const TCHAR *filename, int type, i return v; if (cname[0]) _tcscpy(config_filename, cname); - box_art_check(p); + box_art_check(p, fname); for (i = 1; i <= 2; i++) { if (type != i) { size = sizeof (ct); @@ -2328,7 +2338,8 @@ int target_cfgfile_load (struct uae_prefs *p, const TCHAR *filename, int type, i } static int gui_width, gui_height; -static int gui_fullscreen; +int gui_fullscreen; +static RECT gui_fullscreen_rect; static bool gui_resize_enabled; static bool gui_resize_allowed; @@ -5721,6 +5732,7 @@ static INT_PTR CALLBACK InfoSettingsProc (HWND hDlg, UINT msg, WPARAM wParam, LP recursive--; break; } + commonproc(hDlg, msg, wParam, lParam); return FALSE; } @@ -5940,7 +5952,11 @@ static void InitializeConfig (HWND hDlg, struct ConfigStruct *config) } else { SetDlgItemText (hDlg, IDC_EDITDESCRIPTION, config->Description); } - show_box_art(config && config->Artpath[0] ? config->Artpath : NULL); + if (config && config->Artpath[0]) { + show_box_art(config->Artpath, config->Name); + } else { + show_box_art(NULL, NULL); + } } static void DeleteConfigTree (HWND hDlg) @@ -6209,7 +6225,11 @@ static INT_PTR CALLBACK LoadSaveDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPA case WM_USER + 1: if (config) { - show_box_art(config && config->Artpath[0] ? config->Artpath : NULL); + if (config->Artpath[0]) { + show_box_art(config->Artpath, config->Name); + } else { + show_box_art(NULL, NULL); + } } break; @@ -6329,6 +6349,7 @@ static INT_PTR CALLBACK ErrorLogProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM SendDlgItemMessage (hDlg, IDC_ERRORLOGMESSAGE, EM_SETCHARFORMAT, SCF_ALL, (LPARAM) & CharFormat); return TRUE; } + commonproc(hDlg, msg, wParam, lParam); return FALSE; } @@ -6362,6 +6383,7 @@ static INT_PTR CALLBACK ContributorsProc (HWND hDlg, UINT msg, WPARAM wParam, LP SendDlgItemMessage (hDlg, IDC_CONTRIBUTORS, EM_SETCHARFORMAT, SCF_ALL, (LPARAM) & CharFormat); return TRUE; } + commonproc(hDlg, msg, wParam, lParam); return FALSE; } @@ -12324,10 +12346,7 @@ static INT_PTR MiscDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) gui_fullscreen = ischecked (hDlg, IDC_GUI_FULLSCREEN); if (!gui_fullscreen) { gui_fullscreen = -1; - gui_resize_enabled = false; getstoredguisize(); - } else { - gui_resize_enabled = true; } gui_size_changed = 10; break; @@ -13649,6 +13668,7 @@ static INT_PTR CALLBACK VolumeSettingsProc (HWND hDlg, UINT msg, WPARAM wParam, recursive--; break; } + commonproc(hDlg, msg, wParam, lParam); return FALSE; } @@ -14219,6 +14239,7 @@ static INT_PTR CALLBACK TapeDriveSettingsProc (HWND hDlg, UINT msg, WPARAM wPara recursive--; break; } + commonproc(hDlg, msg, wParam, lParam); return FALSE; } @@ -14280,6 +14301,7 @@ static INT_PTR CALLBACK CDDriveSettingsProc (HWND hDlg, UINT msg, WPARAM wParam, recursive--; break; } + commonproc(hDlg, msg, wParam, lParam); return FALSE; } @@ -14580,6 +14602,7 @@ static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam break; } + commonproc(hDlg, msg, wParam, lParam); return FALSE; } @@ -14818,6 +14841,7 @@ static INT_PTR CALLBACK HarddriveSettingsProc (HWND hDlg, UINT msg, WPARAM wPara recursive--; break; } + commonproc(hDlg, msg, wParam, lParam); return FALSE; } @@ -18324,6 +18348,7 @@ static INT_PTR CALLBACK InputMapDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPA break; } handlerawinput (hDlg, msg, wParam, lParam); + commonproc(hDlg, msg, wParam, lParam); return FALSE; } @@ -18581,6 +18606,7 @@ static INT_PTR CALLBACK QualifierProc (HWND hDlg, UINT msg, WPARAM wParam, LPARA recursive--; break; } + commonproc(hDlg, msg, wParam, lParam); return FALSE; } @@ -20435,7 +20461,6 @@ static HWND updatePanel (int id, UINT action) HWND hDlg = guiDlg; static HWND hwndTT; static bool first = true; - int w, h, x , y, i, pw, ph; int fullpanel; struct newresource *tres; @@ -20470,7 +20495,7 @@ static HWND updatePanel (int id, UINT action) DestroyWindow (ToolTipHWND); ToolTipHWND = NULL; } - for (i = 0; ToolTipHWNDS2[i].hwnd; i++) { + for (int i = 0; ToolTipHWNDS2[i].hwnd; i++) { DestroyWindow (ToolTipHWNDS2[i].hwnd); ToolTipHWNDS2[i].hwnd = NULL; } @@ -20711,7 +20736,8 @@ static void centerWindow (HWND hDlg) owner = GetDesktopWindow (); if (gui_fullscreen) { - x = y = 0; + x = gui_fullscreen_rect.left; + y = gui_fullscreen_rect.top; } else { if (isfullscreen () == 0) { regqueryint (NULL, _T("GUIPosX"), &x); @@ -21070,10 +21096,6 @@ int dragdrop (HWND hDlg, HDROP hd, struct uae_prefs *prefs, int currentpage) return ret; } -#ifndef WM_DPICHANGED -#define WM_DPICHANGED 0x02E0 -#endif - static int dialogreturn; static int devicechangetimer = -1; static INT_PTR CALLBACK DialogProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) @@ -21085,7 +21107,7 @@ static INT_PTR CALLBACK DialogProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l { case WM_DPICHANGED: { - if (!gui_size_changed && hGUIWnd != NULL) { + if (!gui_size_changed && hGUIWnd) { int dx = LOWORD(wParam); int dy = HIWORD(wParam); RECT *const r = (RECT*)lParam; @@ -21107,9 +21129,18 @@ static INT_PTR CALLBACK DialogProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l case WM_MOVE: move_box_art_window(); return TRUE; + case WM_SIZE: + if (!gui_size_changed && hGUIWnd && (wParam == SIZE_MAXIMIZED || wParam == SIZE_RESTORED)) { + getguisize(hDlg, &gui_width, &gui_height); + oldwidth = gui_width; + oldheight = gui_height; + saveguisize(); + gui_size_changed = 1; + return 0; + } + break; case WM_SIZING: { - close_box_art_window(); if (!recursive && gui_resize_enabled) { RECT *r = (RECT*)lParam; if (r->right - r->left < MIN_GUI_INTERNAL_WIDTH) @@ -21186,7 +21217,7 @@ static INT_PTR CALLBACK DialogProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM l devicechangetimer = 0; addnotifications (hDlg, TRUE, TRUE); updatePanel (-1, 0); - show_box_art(NULL); + show_box_art(NULL, NULL); DestroyWindow(hDlg); if (dialogreturn < 0) { dialogreturn = 0; @@ -21567,6 +21598,7 @@ static int GetSettings (int all_options, HWND hwnd) } int fmultx = 0, fmulty = 0; + bool boxart_reopen = false; setdefaultguisize(); getstoredguisize(); scaleresource_setsize(-1, -1, -1); @@ -21612,6 +21644,7 @@ static int GetSettings (int all_options, HWND hwnd) if (first) write_log (_T("Entering GUI idle loop\n")); + memset(&gui_fullscreen_rect, 0, sizeof(RECT)); if (gui_fullscreen) { gui_width = GetSystemMetrics(SM_CXSCREEN); gui_height = GetSystemMetrics(SM_CYSCREEN); @@ -21632,6 +21665,24 @@ static int GetSettings (int all_options, HWND hwnd) gui_height = h; write_log(_T("GUI Fullscreen %dx%d\n"), gui_width, gui_height); } + } else { + int x = 0, y = 0, w = 0, h = 0; + regqueryint(NULL, _T("GUIPosX"), &x); + regqueryint(NULL, _T("GUIPosY"), &y); + regqueryint(NULL, _T("GUISizeX"), &w); + regqueryint(NULL, _T("GUISizeY"), &h); + POINT pt; + pt.x = x + w / 2; + pt.y = y + h / 2; + HMONITOR mon = MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY); + MONITORINFO mi; + mi.cbSize = sizeof(mi); + if (GetMonitorInfo(mon, &mi)) { + RECT *r = &mi.rcWork; + gui_fullscreen_rect = *r; + gui_width = r->right - r->left; + gui_height = r->bottom - r->top; + } } scaleresource_setsize(gui_width, gui_height, 1); int gw = gui_width; @@ -21659,7 +21710,7 @@ static int GetSettings (int all_options, HWND hwnd) panelresource->width = gui_width; panelresource->height = gui_height; freescaleresource(tres); - tres = scaleresource (panelresource, &maindctx, hwnd, gui_resize_enabled, gui_fullscreen, workprefs.win32_gui_alwaysontop || workprefs.win32_main_alwaysontop ? WS_EX_TOPMOST : 0, 0); + tres = scaleresource (panelresource, &maindctx, hwnd, gui_resize_enabled && gui_resize_allowed, gui_fullscreen, workprefs.win32_gui_alwaysontop || workprefs.win32_main_alwaysontop ? WS_EX_TOPMOST : 0, 0); HWND phwnd = hwnd; if (isfullscreen() == 0) phwnd = 0; @@ -21677,8 +21728,6 @@ static int GetSettings (int all_options, HWND hwnd) DWORD v; int w, h; - //rescaleresource(dhwnd); - getguisize (dhwnd, &w, &h); write_log (_T("Got GUI size = %dx%d\n"), w, h); if (w < 100 || h < 100 || (w > 8192 && w > dw + 500) || (h > 8192 && h > dh + 500)) { @@ -21704,6 +21753,11 @@ static int GetSettings (int all_options, HWND hwnd) if (currentpage == LOADSAVE_ID) { // update boxart SendMessage(pages[LOADSAVE_ID], WM_USER + 1, 0, 0); + boxart_reopen = false; + } + if (boxart_reopen) { + reset_box_art_window(); + boxart_reopen = false; } if (devicechangetimer < 0) SetTimer(dhwnd, 4, 2000, NULL); @@ -21758,6 +21812,10 @@ static int GetSettings (int all_options, HWND hwnd) scaleresource_setsize(gui_width, gui_height, 0); rescaleresource(tres, &maindctx, dhwnd, panelDlg); gui_size_changed = 0; + reset_box_art_window(); + } else { + close_box_art_window(); + boxart_reopen = true; } } if (gui_size_changed >= 10) { diff --git a/od-win32/win32gui.h b/od-win32/win32gui.h index 006deac3..03365dc2 100644 --- a/od-win32/win32gui.h +++ b/od-win32/win32gui.h @@ -47,6 +47,9 @@ struct newresource int setparamcnt; }; +#define MIN_GUI_INTERNAL_WIDTH 512 +#define MIN_GUI_INTERNAL_HEIGHT 400 + #define GUI_INTERNAL_WIDTH 800 #define GUI_INTERNAL_HEIGHT 600 #define GUI_INTERNAL_FONT 8 @@ -65,10 +68,14 @@ extern int scaleresource_choosefont (HWND hDlg, int fonttype); extern void scaleresource_setdefaults (void); extern void scalaresource_listview_font_info(int*); extern int getscaledfontsize(int size); -extern bool show_box_art(const TCHAR*); +extern bool show_box_art(const TCHAR*, const TCHAR*); extern void move_box_art_window(void); extern void close_box_art_window(void); extern LRESULT CALLBACK BoxArtWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); extern int max_visible_boxart_images; extern int stored_boxart_window_width; +extern int stored_boxart_window_width_fsgui; +extern int calculated_boxart_window_width; +void getextendedframebounds(HWND hwnd, RECT *r); +void reset_box_art_window(void); #endif diff --git a/od-win32/win32gui_extra.cpp b/od-win32/win32gui_extra.cpp index dc62541b..39d92830 100644 --- a/od-win32/win32gui_extra.cpp +++ b/od-win32/win32gui_extra.cpp @@ -415,7 +415,7 @@ static struct newresource *scaleresource2 (struct newresource *res, HWND parent, if (resize > 0) { d->style &= ~DS_MODALFRAME; - d->style |= WS_THICKFRAME; + d->style |= WS_THICKFRAME | WS_MAXIMIZEBOX; } else if (resize == 0) { d->style |= DS_MODALFRAME; d->style &= ~WS_THICKFRAME; @@ -708,11 +708,14 @@ static int total_images; static int imagemode; static bool imagemodereset; static int lastimage; -static TCHAR image_path[MAX_DPATH]; +static TCHAR image_path[MAX_DPATH], config_path[MAX_DPATH]; static int image_coords[MAX_VISIBLE_IMAGES + 1]; int max_visible_boxart_images = MAX_VISIBLE_IMAGES; int stored_boxart_window_width = 400; +int stored_boxart_window_width_fsgui = 33; +int calculated_boxart_window_width; +static int stored_boxart_window_height; static void boxart_init(void) { @@ -731,26 +734,53 @@ typedef HRESULT(CALLBACK* DWMGETWINDOWATTRIBUTE)(HWND hwnd, DWORD dwAttribute, P static DWMGETWINDOWATTRIBUTE pDwmGetWindowAttribute; static HMODULE dwmapihandle; -static void getpos(RECT *r) +extern int gui_fullscreen; + +void getextendedframebounds(HWND hwnd, RECT *r) { - RECT r1, r2; + r->left = r->right = 0; + r->top = r->bottom = 0; if (!pDwmGetWindowAttribute && !dwmapihandle && os_vista) { dwmapihandle = LoadLibrary(_T("dwmapi.dll")); if (dwmapihandle) pDwmGetWindowAttribute = (DWMGETWINDOWATTRIBUTE)GetProcAddress(dwmapihandle, "DwmGetWindowAttribute"); } + if (pDwmGetWindowAttribute) { + pDwmGetWindowAttribute(hwnd, DWMWA_EXTENDED_FRAME_BOUNDS, r, sizeof(RECT)); + } +} + +static void getpos(RECT *r) +{ + RECT r1, r2; GetWindowRect(hGUIWnd, &r1); - r2 = r1; - if (pDwmGetWindowAttribute) { - pDwmGetWindowAttribute(hGUIWnd, DWMWA_EXTENDED_FRAME_BOUNDS, &r2, sizeof(r2)); + calculated_boxart_window_width = stored_boxart_window_width; + if (gui_fullscreen && stored_boxart_window_width_fsgui >= 10 && stored_boxart_window_width_fsgui <= 90) { + calculated_boxart_window_width = (r1.right - r1.left) * stored_boxart_window_width_fsgui / 100; + } + + if (gui_fullscreen && (r1.right - r1.left) - calculated_boxart_window_width >= MIN_GUI_INTERNAL_WIDTH) { + HMONITOR mon = MonitorFromRect(&r1, MONITOR_DEFAULTTOPRIMARY); + MONITORINFO mi; + mi.cbSize = sizeof(mi); + if (GetMonitorInfo(mon, &mi)) { + RECT r = mi.rcWork; + if (r1.right + calculated_boxart_window_width > r.right) { + r1.right -= calculated_boxart_window_width - (r.right - r1.right); + SetWindowPos(hGUIWnd, NULL, r1.left, r1.top, r1.right - r1.left, r1.bottom - r1.top, SWP_NOZORDER | SWP_NOACTIVATE); + } + } } + r2 = r1; + getextendedframebounds(hGUIWnd, &r2); + r->left = r1.right - ((r2.left - r1.left) + (r1.right - r2.right)); r->top = r1.top; r->bottom = r1.bottom; - r->right = r->left + stored_boxart_window_width; + r->right = r->left + calculated_boxart_window_width; } void move_box_art_window(void) @@ -787,13 +817,14 @@ static bool open_box_art_window(void) DWORD exstyle = GetWindowLong(hGUIWnd, GWL_EXSTYLE); DWORD style = GetWindowLong(hGUIWnd, GWL_STYLE); - style &= ~(WS_VISIBLE); + style &= ~(WS_VISIBLE | WS_MINIMIZEBOX | WS_MAXIMIZEBOX); + stored_boxart_window_height = r.bottom - r.top; boxarthwnd = CreateWindowEx(exstyle | WS_EX_NOACTIVATE, _T("BoxArt"), _T("WinUAE"), style, r.left, r.top, - stored_boxart_window_width, r.bottom - r.top, + calculated_boxart_window_width, r.bottom - r.top, hGUIWnd, NULL, hInst, NULL); if (boxarthwnd) { RECT r; @@ -806,6 +837,14 @@ static bool open_box_art_window(void) InsertMenu(menu, -1, MF_BYPOSITION, 1, _T("Open Game Folder")); } } else { + GetWindowRect(hGUIWnd, &r); + if (stored_boxart_window_height != r.bottom - r.top) { + stored_boxart_window_height = r.bottom - r.top; + SetWindowPos(boxarthwnd, HWND_TOPMOST, 0, 0, calculated_boxart_window_width, stored_boxart_window_height, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOMOVE); + GetClientRect(boxarthwnd, &r); + boxart_window_width = r.right - r.left; + boxart_window_height = r.bottom - r.top; + } move_box_art_window(); } @@ -929,7 +968,7 @@ static void boxartpaint(HDC hdc, HWND hwnd) extern int full_property_sheet; -bool show_box_art(const TCHAR *path) +bool show_box_art(const TCHAR *path, const TCHAR *configpath) { TCHAR tmp1[MAX_DPATH]; @@ -958,8 +997,16 @@ bool show_box_art(const TCHAR *path) if (!open_box_art_window()) return false; - if (path != image_path) + if (path != image_path) { _tcscpy(image_path, path); + _tcscpy(config_path, configpath); + } + + int len = _tcslen(config_path); + if (len > 4 && !_tcsicmp(config_path + len - 4, _T(".uae"))) + config_path[len - 4] = 0; + if (_tcslen(config_path) > 0) + SetWindowText(boxarthwnd, config_path); if (max_visible_boxart_images < 1 || max_visible_boxart_images > 3) max_visible_boxart_images = 2; @@ -1027,7 +1074,14 @@ static void image_reload(int cnt) { max_visible_boxart_images = cnt; regsetint(NULL, _T("ArtImageCount"), max_visible_boxart_images); - show_box_art(image_path); + show_box_art(image_path, config_path); +} + +void reset_box_art_window(void) +{ + if (!image_path[0]) + return; + show_box_art(image_path, config_path); } LRESULT CALLBACK BoxArtWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) @@ -1134,6 +1188,13 @@ LRESULT CALLBACK BoxArtWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM return FALSE; } break; + case WM_DPICHANGED: + { + RECT *const r = (RECT *)lParam; + SetWindowPos(hWnd, NULL, r->left, r->top, r->right - r->left, r->bottom - r->top, SWP_NOZORDER | SWP_NOACTIVATE); + return FALSE; + } + break; } return DefWindowProc(hWnd, message, wParam, lParam); }