Compare 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
7 changed files with 16 additions and 117 deletions
+2 -2
View File
@@ -1670,7 +1670,7 @@ LRESULT CSettingsDlg::OnBackup( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL&
ofn.lpstrTitle=title; ofn.lpstrTitle=title;
ofn.lpstrDefExt=L".xml"; ofn.lpstrDefExt=L".xml";
ofn.Flags=OFN_DONTADDTORECENT|OFN_ENABLESIZING|OFN_EXPLORER|OFN_PATHMUSTEXIST|OFN_OVERWRITEPROMPT|OFN_HIDEREADONLY|OFN_NOCHANGEDIR; ofn.Flags=OFN_DONTADDTORECENT|OFN_ENABLESIZING|OFN_EXPLORER|OFN_PATHMUSTEXIST|OFN_OVERWRITEPROMPT|OFN_HIDEREADONLY|OFN_NOCHANGEDIR;
if (GetSaveFileNameSafe(&ofn)) if (GetSaveFileName(&ofn))
{ {
CString err=g_SettingsManager.SaveSettingsXml(path); CString err=g_SettingsManager.SaveSettingsXml(path);
if (!err.IsEmpty()) if (!err.IsEmpty())
@@ -1699,7 +1699,7 @@ LRESULT CSettingsDlg::OnBackup( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL&
CString title=LoadStringEx(IDS_XML_TITLE_LOAD); CString title=LoadStringEx(IDS_XML_TITLE_LOAD);
ofn.lpstrTitle=title; ofn.lpstrTitle=title;
ofn.Flags=OFN_DONTADDTORECENT|OFN_ENABLESIZING|OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_NOCHANGEDIR; ofn.Flags=OFN_DONTADDTORECENT|OFN_ENABLESIZING|OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_NOCHANGEDIR;
if (GetOpenFileNameSafe(&ofn)) if (GetOpenFileName(&ofn))
{ {
SetCurTab(m_Index,true); // reload tab once to force-close any active edit boxes SetCurTab(m_Index,true); // reload tab once to force-close any active edit boxes
CString error=g_SettingsManager.LoadSettingsXml(path); CString error=g_SettingsManager.LoadSettingsXml(path);
+5 -88
View File
@@ -15,7 +15,6 @@
#include <uxtheme.h> #include <uxtheme.h>
#include <map> #include <map>
#include <algorithm> #include <algorithm>
#include <thread>
const KNOWNFOLDERID FOLDERID_DesktopRoot={'DESK', 'TO', 'P', {'D', 'E', 'S', 'K', 'T', 'O', 'P', 0x00}}; const KNOWNFOLDERID FOLDERID_DesktopRoot={'DESK', 'TO', 'P', {'D', 'E', 'S', 'K', 'T', 'O', 'P', 0x00}};
@@ -1194,7 +1193,7 @@ bool BrowseCommandHelper( HWND parent, wchar_t *text )
ofn.lpstrFile=text; ofn.lpstrFile=text;
ofn.nMaxFile=_MAX_PATH; ofn.nMaxFile=_MAX_PATH;
ofn.Flags=OFN_DONTADDTORECENT|OFN_ENABLESIZING|OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_NOCHANGEDIR|OFN_NODEREFERENCELINKS; ofn.Flags=OFN_DONTADDTORECENT|OFN_ENABLESIZING|OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_NOCHANGEDIR|OFN_NODEREFERENCELINKS;
if (GetOpenFileNameSafe(&ofn)) if (GetOpenFileName(&ofn))
{ {
wchar_t buf[_MAX_PATH]; wchar_t buf[_MAX_PATH];
UnExpandEnvStrings(text,buf,_countof(buf)); UnExpandEnvStrings(text,buf,_countof(buf));
@@ -1217,8 +1216,7 @@ bool BrowseCommandHelper( HWND parent, wchar_t *text )
return false; return false;
} }
// Internal implementation that must be run on an STA thread with COM initialized. bool BrowseLinkHelper( HWND parent, wchar_t *text, bool bFoldersOnly )
static bool BrowseLinkHelperImpl( HWND parent, wchar_t *text, bool bFoldersOnly )
{ {
DoEnvironmentSubst(text,_MAX_PATH); DoEnvironmentSubst(text,_MAX_PATH);
@@ -1278,41 +1276,6 @@ static bool BrowseLinkHelperImpl( HWND parent, wchar_t *text, bool bFoldersOnly
return pResult!=NULL; return pResult!=NULL;
} }
// Run IFileOpenDialog on a separate STA thread and pump messages on the caller while waiting.
bool BrowseLinkHelper( HWND parent, wchar_t *text, bool bFoldersOnly )
{
bool result = false;
std::thread worker([&parent, &text, &bFoldersOnly, &result]() mutable {
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
result = BrowseLinkHelperImpl(parent, text, bFoldersOnly);
CoUninitialize();
});
// Pump messages while waiting for the worker (dialog) to finish
while (true)
{
HANDLE hWorker = worker.native_handle();
if (MsgWaitForMultipleObjects(1, &hWorker, FALSE, INFINITE, QS_ALLINPUT) == WAIT_OBJECT_0)
break;
MSG msg;
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
if (msg.message == WM_QUIT)
{
PostQuitMessage((int)msg.wParam);
break;
}
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
worker.join();
return result;
}
bool BrowseIconHelper( HWND parent, wchar_t *text ) bool BrowseIconHelper( HWND parent, wchar_t *text )
{ {
int id=0; int id=0;
@@ -2048,7 +2011,7 @@ LRESULT CBrowseForIconDlg::OnBrowse( WORD wNotifyCode, WORD wID, HWND hWndCtl, B
CString title=LoadStringEx(IDS_ICON_TITLE); CString title=LoadStringEx(IDS_ICON_TITLE);
ofn.lpstrTitle=title; ofn.lpstrTitle=title;
ofn.Flags=OFN_DONTADDTORECENT|OFN_ENABLESIZING|OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_NOCHANGEDIR; ofn.Flags=OFN_DONTADDTORECENT|OFN_ENABLESIZING|OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_NOCHANGEDIR;
if (GetOpenFileNameSafe(&ofn)) if (GetOpenFileName(&ofn))
{ {
wchar_t buf[_MAX_PATH]; wchar_t buf[_MAX_PATH];
UnExpandEnvStrings(path,buf,_countof(buf)); UnExpandEnvStrings(path,buf,_countof(buf));
@@ -2247,7 +2210,7 @@ bool BrowseForBitmap( HWND hWndParent, wchar_t *path, bool bAllowJpeg )
CString title=LoadStringEx(IDS_BMP_TITLE); CString title=LoadStringEx(IDS_BMP_TITLE);
ofn.lpstrTitle=title; ofn.lpstrTitle=title;
ofn.Flags=OFN_DONTADDTORECENT|OFN_ENABLESIZING|OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_NOCHANGEDIR; ofn.Flags=OFN_DONTADDTORECENT|OFN_ENABLESIZING|OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_NOCHANGEDIR;
if (GetOpenFileNameSafe(&ofn)) if (GetOpenFileName(&ofn))
{ {
wchar_t buf[_MAX_PATH]; wchar_t buf[_MAX_PATH];
UnExpandEnvStrings(path,buf,_countof(buf)); UnExpandEnvStrings(path,buf,_countof(buf));
@@ -2279,7 +2242,7 @@ bool BrowseForSound( HWND hWndParent, wchar_t *path )
CString title=LoadStringEx(IDS_WAV_TITLE); CString title=LoadStringEx(IDS_WAV_TITLE);
ofn.lpstrTitle=title; ofn.lpstrTitle=title;
ofn.Flags=OFN_DONTADDTORECENT|OFN_ENABLESIZING|OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_NOCHANGEDIR; ofn.Flags=OFN_DONTADDTORECENT|OFN_ENABLESIZING|OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_NOCHANGEDIR;
if (GetOpenFileNameSafe(&ofn)) if (GetOpenFileName(&ofn))
{ {
wchar_t buf[_MAX_PATH]; wchar_t buf[_MAX_PATH];
UnExpandEnvStrings(path,buf,_countof(buf)); UnExpandEnvStrings(path,buf,_countof(buf));
@@ -3667,49 +3630,3 @@ DWORD ParseColor(const wchar_t* str)
wchar_t* end; wchar_t* end;
return wcstoul(str, &end, 16) & 0xFFFFFF; return wcstoul(str, &end, 16) & 0xFFFFFF;
} }
// Run GetOpenFileName/GetSaveFileName on a separate STA thread and pump messages on the caller
template <typename auto Fnc>
static BOOL GetFileNameSafe(OPENFILENAME* pOfn)
{
BOOL result = FALSE;
std::thread worker([&pOfn, &result]() mutable {
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
result = Fnc(pOfn);
CoUninitialize();
});
// Pump messages while waiting for the worker (dialog) to finish
while (true)
{
HANDLE hWorker = worker.native_handle();
if (MsgWaitForMultipleObjects(1, &hWorker, FALSE, INFINITE, QS_ALLINPUT) == WAIT_OBJECT_0)
break;
MSG msg;
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
if (msg.message == WM_QUIT)
{
PostQuitMessage((int)msg.wParam);
break;
}
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
worker.join();
return result;
}
BOOL GetOpenFileNameSafe(OPENFILENAME* pOfn)
{
return GetFileNameSafe<GetOpenFileNameW>(pOfn);
}
BOOL GetSaveFileNameSafe(OPENFILENAME* pOfn)
{
return GetFileNameSafe<GetSaveFileNameW>(pOfn);
}
-4
View File
@@ -395,7 +395,3 @@ DWORD BgrToRgb(DWORD val);
// parse color from hexadecimal string // parse color from hexadecimal string
DWORD ParseColor(const wchar_t* str); DWORD ParseColor(const wchar_t* str);
// safe versions of GetOpenFileName/GetSaveFileName (run API on a separate STA thread and pump messages on the caller)
BOOL GetOpenFileNameSafe(OPENFILENAME* pOfn);
BOOL GetSaveFileNameSafe(OPENFILENAME* pOfn);
+1 -1
View File
@@ -31,7 +31,7 @@
<String Id="Advanced_Font_Bigger_Size" Overridable="yes">12</String> <String Id="Advanced_Font_Bigger_Size" Overridable="yes">12</String>
<String Id="Advanced_Font_Title_Size" Overridable="yes">9</String> <String Id="Advanced_Font_Title_Size" Overridable="yes">9</String>
<String Id="Advanced_Font_Emphasized_Size" Overridable="yes">8</String> <String Id="Advanced_Font_Emphasized_Size" Overridable="yes">8</String>
<String Id="Advanced_Font_FaceName" Overridable="yes">"MS UI Gothic", "MS PGothic", "MS Pゴシック", "MS Gothic", "MS ゴシック", Yu Gothic UI, Tahoma</String> <String Id="Advanced_Font_FaceName" Overridable="yes">"MS UI Gothic", "MS PGothic", "MS Pゴシック", "MS Gothic", "MS ゴシック", Osaka, Tahoma</String>
<String Id="BrowseDlg_Title" Overridable="yes">[ProductName] セットアップ</String> <String Id="BrowseDlg_Title" Overridable="yes">[ProductName] セットアップ</String>
<String Id="BrowseDlgComboLabel" Overridable="yes">場所(&amp;L):</String> <String Id="BrowseDlgComboLabel" Overridable="yes">場所(&amp;L):</String>
+1 -4
View File
@@ -6366,10 +6366,7 @@ LRESULT CMenuContainer::OnRefresh( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL
} }
} }
else if (m_Items[m_OriginalCount].id==MENU_SEARCH_CATEGORY) else if (m_Items[m_OriginalCount].id==MENU_SEARCH_CATEGORY)
{ hotItem=m_OriginalCount+1;
if (!bSearching || !s_SearchResults.programs.empty())
hotItem=m_OriginalCount+1;
}
} }
else else
hotItem=-1; hotItem=-1;
+6 -17
View File
@@ -1624,7 +1624,7 @@ static void ComputeTaskbarColors( int *data )
{ {
bool bDefLook; bool bDefLook;
int look=GetSettingInt(L"TaskbarLook",bDefLook); int look=GetSettingInt(L"TaskbarLook",bDefLook);
if (GetWinVersion()<WIN_VER_WIN10 || !IsAppThemed() || look==TASKBAR_AEROGLASS || (look==TASKBAR_TRANSPARENT && g_TaskbarTexture)) if (GetWinVersion()<WIN_VER_WIN10 || look==TASKBAR_AEROGLASS || (look==TASKBAR_TRANSPARENT && g_TaskbarTexture))
{ {
memset(data,0,16); memset(data,0,16);
} }
@@ -1872,7 +1872,6 @@ static LRESULT CALLBACK SubclassTaskBarProc( HWND hWnd, UINT uMsg, WPARAM wParam
ComputeTaskbarColors(data); ComputeTaskbarColors(data);
WINCOMPATTRDATA attrData={0x13,&data,sizeof(data)}; WINCOMPATTRDATA attrData={0x13,&data,sizeof(data)};
SetWindowCompositionAttribute(hWnd,&attrData); SetWindowCompositionAttribute(hWnd,&attrData);
UpdateTaskBars(TASKBAR_UPDATE_TEXTURE);
return res; return res;
} }
if ((uMsg==WM_DWMCOLORIZATIONCOLORCHANGED || uMsg==WM_SETTINGCHANGE) && taskBar && taskBar->bCustomLook && SetWindowCompositionAttribute && GetWinVersion()<WIN_VER_WIN10) if ((uMsg==WM_DWMCOLORIZATIONCOLORCHANGED || uMsg==WM_SETTINGCHANGE) && taskBar && taskBar->bCustomLook && SetWindowCompositionAttribute && GetWinVersion()<WIN_VER_WIN10)
@@ -1933,7 +1932,7 @@ static LRESULT CALLBACK SubclassTaskBarProc( HWND hWnd, UINT uMsg, WPARAM wParam
WINCOMPATTRDATA attrData={0x13,&data,sizeof(data)}; WINCOMPATTRDATA attrData={0x13,&data,sizeof(data)};
SetWindowCompositionAttribute(hWnd,&attrData); SetWindowCompositionAttribute(hWnd,&attrData);
} }
if (g_TaskbarTexture) if (g_TaskbarTexture && IsAppThemed())
{ {
// draw taskbar background (behind start button and separators) // draw taskbar background (behind start button and separators)
PAINTSTRUCT ps; PAINTSTRUCT ps;
@@ -2384,19 +2383,12 @@ void UpdateTaskBars( TUpdateTaskbar update )
} }
} }
} }
else if ((GetWinVersion()<WIN_VER_WIN10 && (!bDefColor || !bDefOpacity)) || !IsAppThemed()) else if (GetWinVersion()<WIN_VER_WIN10 && (!bDefColor || !bDefOpacity))
{ {
if (bDefColor && GetWinVersion()>WIN_VER_WIN7) if (bDefColor && GetWinVersion()>WIN_VER_WIN7)
{ {
if (IsAppThemed()) color=GetSystemGlassColor8();
{ color=((color&0xFF)<<16)|(color&0xFF00)|((color>>16)&0xFF);
color=GetSystemGlassColor8();
color=((color&0xFF)<<16)|(color&0xFF00)|((color>>16)&0xFF);
}
else
{
color=GetSysColor(COLOR_BTNFACE);
}
} }
BITMAPINFO bi={0}; BITMAPINFO bi={0};
bi.bmiHeader.biSize=sizeof(BITMAPINFOHEADER); bi.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
@@ -3020,10 +3012,7 @@ static void InitStartMenuDLL( void )
if (GetWinVersion()<=WIN_VER_WIN81) if (GetWinVersion()<=WIN_VER_WIN81)
g_DrawThemeBackgroundHook=SetIatHook(module,"uxtheme.dll","DrawThemeBackground",DrawThemeBackground2); g_DrawThemeBackgroundHook=SetIatHook(module,"uxtheme.dll","DrawThemeBackground",DrawThemeBackground2);
g_DrawThemeTextHook=SetIatHook(module,"uxtheme.dll","DrawThemeText",DrawThemeText2); g_DrawThemeTextHook=SetIatHook(module,"uxtheme.dll","DrawThemeText",DrawThemeText2);
if (IsAppThemed()) g_DrawThemeTextExHook=SetIatHook(module,"uxtheme.dll","DrawThemeTextEx",DrawThemeTextEx2);
{
g_DrawThemeTextExHook=SetIatHook(module,"uxtheme.dll","DrawThemeTextEx",DrawThemeTextEx2);
}
g_DrawThemeTextCtlHook=SetIatHook(GetModuleHandle(L"comctl32.dll"),"uxtheme.dll","DrawThemeText",DrawThemeText2); g_DrawThemeTextCtlHook=SetIatHook(GetModuleHandle(L"comctl32.dll"),"uxtheme.dll","DrawThemeText",DrawThemeText2);
if (GetWinVersion()>=WIN_VER_WIN10) if (GetWinVersion()>=WIN_VER_WIN10)
g_SetWindowCompositionAttributeHook=SetIatHook(module,"user32.dll","SetWindowCompositionAttribute",SetWindowCompositionAttribute2); g_SetWindowCompositionAttributeHook=SetIatHook(module,"user32.dll","SetWindowCompositionAttribute",SetWindowCompositionAttribute2);
+1 -1
View File
@@ -21,5 +21,5 @@ deploy:
on: on:
APPVEYOR_ACCOUNT_NAME: passionate-coder APPVEYOR_ACCOUNT_NAME: passionate-coder
auth_token: auth_token:
secure: SOu6Y71k0oIxXJR35x+7ZeU/+WRW8kaGnCWcbR3OVOd8HeCJwB1Tw3hUJa5EveLGKaGoMKGqAh01Pwc8tWX4xmphZsYYUr09IVjA0+rqgN5VT87CXD6OQxUxBJ7g+9IN secure: SOu6Y71k0oIxXJR35x+7ZTrqDa3HqUM4kLNJc+DbohPz9zhVHh9O8QYwmI7LI0qslug5L11fo9pZVfVgZttw4eBgooHaX9TNBTTA6sJItkXqMX+M6mKAG7tbI/O3Eg0v
prerelease: true prerelease: true