4 Commits

Author SHA1 Message Date
ge0rdi
b1c5a6abe8 Scale custom button image according to current DPI
Fixes #2246
2025-10-03 08:05:51 +02:00
benja2998
4ebeadd949 Remove another '>' symbol (#2243)
Remove another 'z
2025-06-25 17:27:18 +02:00
benja2998
dc1994e713 Remove random '>' symbol in readme (#2223) 2025-05-25 07:23:42 +02:00
ge0rdi
8c713cc5fd Update ARM notice in readme 2025-05-24 08:31:51 +02:00
4 changed files with 24 additions and 8 deletions

View File

@@ -23,8 +23,11 @@ You can find the latest stable version here:
[![GitHub All Releases](https://img.shields.io/github/downloads/Open-Shell/Open-Shell-Menu/total?style=for-the-badge&color=4bc2ee&logo=github)](https://github.com/Open-Shell/Open-Shell-Menu/releases/latest)
### ⚠️ Windows for ARM compatibility ⚠️
Open-Shell is not compatible with Windows for ARM. If you install it on a Windows for ARM installation (ex. using Parallels Desktop on an Apple Silicon Mac), you will no longer be able to log into your account the next time you reboot. Please refrain from installing Open-Shell on Windows for ARM.
> [!IMPORTANT]
> #### Windows for ARM compatibility
> Open-Shell is compatible with Windows for ARM since version [4.4.196](https://github.com/Open-Shell/Open-Shell-Menu/releases/tag/v4.4.196).
>
> If you install older one on a Windows for ARM installation (ex. using Parallels Desktop on an Apple Silicon Mac), you will no longer be able to log into your account the next time you reboot. Please refrain from installing Open-Shell on Windows for ARM.
### Temporary Translation/Language Solution
1. Download [language DLL](https://coddec.github.io/Classic-Shell/www.classicshell.net/translations/index.html)

View File

@@ -384,14 +384,14 @@ HICON CreateDisabledIcon( HICON hIcon, int iconSize )
}
// Loads an image file into a bitmap and optionally resizes it
HBITMAP LoadImageFile( const wchar_t *path, const SIZE *pSize, bool bUseAlpha, bool bPremultiply, std::vector<unsigned int> *pButtonAnim )
HBITMAP LoadImageFile( const wchar_t *path, const SIZE *pSize, bool bUseAlpha, bool bPremultiply, std::vector<unsigned int> *pButtonAnim, UINT dpi )
{
HBITMAP srcBmp=NULL;
if (_wcsicmp(PathFindExtension(path),L".bmp")==0)
{
srcBmp=(HBITMAP)LoadImage(NULL,path,IMAGE_BITMAP,0,0,LR_CREATEDIBSECTION|LR_LOADFROMFILE);
}
if (srcBmp && !pSize)
if (srcBmp && !pSize && !dpi)
return srcBmp;
CComPtr<IWICImagingFactory> pFactory;
if (FAILED(pFactory.CoCreateInstance(CLSID_WICImagingFactory)))
@@ -482,6 +482,12 @@ HBITMAP LoadImageFile( const wchar_t *path, const SIZE *pSize, bool bUseAlpha, b
else
frameHeightD=frameWidthD*frameHeightS/frameWidthS;
}
if (dpi)
{
frameWidthD=ScaleForDpi(dpi,frameWidthD);
frameHeightD=ScaleForDpi(dpi,frameHeightD);
}
}
BITMAPINFO bi={0};
@@ -946,7 +952,12 @@ UINT GetDpi(HWND hwnd)
return dpi;
}
int ScaleForDpi(UINT dpi, int value)
{
return MulDiv(value, dpi, USER_DEFAULT_SCREEN_DPI);
}
int ScaleForDpi(HWND hwnd, int value)
{
return MulDiv(value, GetDpi(hwnd), USER_DEFAULT_SCREEN_DPI);
return ScaleForDpi(GetDpi(hwnd), value);
}

View File

@@ -35,7 +35,7 @@ HICON ShExtractIcon( const char *path, int index, int iconSize );
HBITMAP BitmapFromIcon( HICON hIcon, int iconSize, unsigned int **pBits, bool bDestroyIcon );
// Loads an image file into a bitmap and optionally resizes it
HBITMAP LoadImageFile( const wchar_t *path, const SIZE *pSize, bool bUseAlpha, bool bPremultiply, std::vector<unsigned int> *pButtonAnim );
HBITMAP LoadImageFile( const wchar_t *path, const SIZE *pSize, bool bUseAlpha, bool bPremultiply, std::vector<unsigned int> *pButtonAnim, UINT dpi=0 );
// Loads a bitmap from a IMAGE resource
HBITMAP LoadImageResource( HMODULE hModule, const wchar_t *name, bool bTopDown, bool bPremultiply );
@@ -88,6 +88,8 @@ HFONT CreateFontSetting( const wchar_t *fontStr, int dpi );
// Return DPI of given window (or system DPI on older systems)
UINT GetDpi(HWND hwnd = nullptr);
// Scale given value according to given DPI
int ScaleForDpi(UINT dpi, int value);
// Scale given value according to DPI of window
int ScaleForDpi(HWND hwnd, int value);

View File

@@ -526,16 +526,16 @@ void CStartButton::LoadBitmap( void )
}
else
{
int dpi=GetDpi(GetParent());
bool bResource=false;
std::vector<unsigned int> buttonAnim;
if (*path)
{
m_Bitmap=LoadImageFile(path,&size,true,true,&buttonAnim);
m_Bitmap=LoadImageFile(path,&size,true,true,&buttonAnim,dpi);
}
if (!m_Bitmap)
{
int id;
int dpi=GetDpi(GetParent());
if (dpi<120)
id=IDB_BUTTON96;
else if (dpi<144)