Skip to content

Commit 6397cce

Browse files
committed
added setting for start button offset
1 parent b780ac2 commit 6397cce

4 files changed

Lines changed: 19 additions & 9 deletions

File tree

Src/StartMenu/StartMenuDLL/SettingsUI.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4456,6 +4456,7 @@ CSetting g_Settings[]={
44564456
{L"CustomButton",CSetting::TYPE_RADIO,IDS_CUSTOM_BUTTON,IDS_CUSTOM_BUTTON_TIP},
44574457
{L"StartButtonPath",CSetting::TYPE_BITMAP,IDS_BUTTON_IMAGE,IDS_BUTTON_IMAGE_TIP,L"",0,L"#StartButtonType=2",L"CustomButton"},
44584458
{L"StartButtonSize",CSetting::TYPE_INT,IDS_BUTTON_SIZE,IDS_BUTTON_SIZE_TIP2,0,0,L"#StartButtonType=2",L"CustomButton"},
4459+
{L"StartButtonOffset",CSetting::TYPE_INT,IDS_BUTTON_OFFSET,IDS_BUTTON_OFFSET_TIP,0,0,L"#StartButtonType=2",L"CustomButton"},
44594460
{L"StartButtonAlign",CSetting::TYPE_BOOL,IDS_BUTTON_ALIGN,IDS_BUTTON_ALIGN_TIP,0,0,L"#StartButtonType=2",L"CustomButton"},
44604461
{L"StartButtonIcon",CSetting::TYPE_ICON,IDS_BUTTON_ICON,IDS_BUTTON_ICON_TIP,L",1",0,L"#StartButtonType=1",L"ClasicButton"},
44614462
{L"StartButtonIconSize",CSetting::TYPE_INT,IDS_BUTTON_ICON_SIZE,IDS_BUTTON_ICON_SIZE_TIP,0,0,L"#StartButtonType=1",L"ClasicButton"},
@@ -5157,7 +5158,7 @@ void InitSettings( void )
51575158
InitSettings(g_Settings,COMPONENT_MENU,&g_CustomSettings);
51585159
}
51595160

5160-
static int g_ButtonPath, g_ButtonSize, g_ButtonIcon, g_ButtonIconSize, g_ButtonText, g_ButtonTip;
5161+
static int g_ButtonPath, g_ButtonSize, g_ButtonIcon, g_ButtonOffset, g_ButtonIconSize, g_ButtonText, g_ButtonTip;
51615162
static bool g_bButtonEnable, g_bTaskbarsChanged, g_bTaskbarsUpdated;
51625163

51635164
static void StoreButtonSettings( void )
@@ -5175,6 +5176,7 @@ static void StoreButtonSettings( void )
51755176
if (g_ButtonPath==START_BUTTON_CUSTOM)
51765177
g_ButtonPath=CalcFNVHash(GetSettingString(L"StartButtonPath"));
51775178
g_ButtonSize=GetSettingInt(L"StartButtonSize");
5179+
g_ButtonOffset = GetSettingInt(L"StartButtonOffset");
51785180
g_ButtonIconSize=GetSettingInt(L"StartButtonIconSize");
51795181
}
51805182

@@ -5191,7 +5193,7 @@ static void UpdateButtons( bool bForce )
51915193
}
51925194
if (path==START_BUTTON_CUSTOM)
51935195
path=CalcFNVHash(GetSettingString(L"StartButtonPath"));
5194-
bool bRecreate=(g_bButtonEnable!=GetSettingBool(L"EnableStartButton") || path!=g_ButtonPath || g_ButtonSize!=GetSettingInt(L"StartButtonSize")
5196+
bool bRecreate = (g_bButtonEnable != GetSettingBool(L"EnableStartButton") || path != g_ButtonPath || g_ButtonSize != GetSettingInt(L"StartButtonSize") || g_ButtonOffset != GetSettingInt(L"StartButtonOffset")
51955197
|| g_ButtonIcon!=icon || g_ButtonIconSize!=GetSettingInt(L"StartButtonIconSize") || g_ButtonText!=text || g_ButtonTip!=tip);
51965198
if ((g_bTaskbarsChanged && !g_bTaskbarsUpdated) || bForce || bRecreate)
51975199
{

Src/StartMenu/StartMenuDLL/StartMenuDLL.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -498,8 +498,8 @@ class CStartMenuTarget: public IDropTarget
498498
return E_NOINTERFACE;
499499
}
500500

501-
virtual ULONG STDMETHODCALLTYPE AddRef( void )
502-
{
501+
virtual ULONG STDMETHODCALLTYPE AddRef( void )
502+
{
503503
return InterlockedIncrement(&m_RefCount);
504504
}
505505

@@ -1345,9 +1345,13 @@ static void UpdateStartButtonPosition(const TaskbarInfo* taskBar, const WINDOWPO
13451345

13461346
// Start button on Win11 is a bit shifted to the right
13471347
// We will shift our Aero button to cover original button
1348-
// We should also shift custom icons, as they're incorrectly aligned to the left edge on Windows 11
1349-
if (IsWin11() && (x == info.rcMonitor.left) && (GetStartButtonType() == START_BUTTON_AERO || GetStartButtonType() == START_BUTTON_CUSTOM) && !g_epTaskbar)
1350-
x += ScaleForDpi(taskBar->taskBar, 6);
1348+
if (IsWin11() && (x == info.rcMonitor.left) && !g_epTaskbar) {
1349+
if (GetStartButtonType() == START_BUTTON_AERO)
1350+
x += ScaleForDpi(taskBar->taskBar, 6);
1351+
// we should also be able to shift our custom icon, as it's also incorrectly aligned to the left edge on Windows 11
1352+
else if (GetStartButtonType() == START_BUTTON_CUSTOM)
1353+
x += ScaleForDpi(taskBar->taskBar, GetSettingInt(L"StartButtonOffset"));
1354+
}
13511355
}
13521356

13531357
RECT rcButton = { x, y, x + taskBar->startButtonSize.cx, y + taskBar->startButtonSize.cy };
@@ -2390,7 +2394,7 @@ void UpdateTaskBars( TUpdateTaskbar update )
23902394
{
23912395
if (bDefColor && GetWinVersion()>WIN_VER_WIN7)
23922396
{
2393-
if (IsAppThemed())
2397+
if (IsAppThemed())
23942398
{
23952399
color=GetSystemGlassColor8();
23962400
color=((color&0xFF)<<16)|(color&0xFF00)|((color>>16)&0xFF);
@@ -4307,7 +4311,7 @@ HBITMAP GetStartScreenIcon( int size )
43074311
}
43084312
SelectObject(hDst,bmp0);
43094313
DeleteDC(hDst);
4310-
4314+
43114315
int i=0;
43124316
int n=size*rc.top;
43134317
for (;i<n;i++)

Src/StartMenu/StartMenuDLL/StartMenuDLL.rc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,6 +1073,8 @@ BEGIN
10731073
IDS_MENU_GLASS "Enable Aero Glass (requires Aero Glass mod)"
10741074
IDS_MENU_GLASS_TIP "Check this to use glass transparency (requires the Aero Glass mod to be installed)"
10751075
IDS_MAIN_MENU_SETTINGS "Main Menu"
1076+
IDS_BUTTON_OFFSET "Button left offset"
1077+
IDS_BUTTON_OFFSET_TIP "Offset the start button horizontally by the amount of pixels specified"
10761078
END
10771079

10781080
STRINGTABLE

Src/StartMenu/StartMenuDLL/resource.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,8 @@
786786
#define IDS_ENABLE_ACCELERATORS_TIP 3687
787787
#define IDS_ALT_ACCELERATORS 3688
788788
#define IDS_ALT_ACCELERATORS_TIP 3689
789+
#define IDS_BUTTON_OFFSET 3690
790+
#define IDS_BUTTON_OFFSET_TIP 3691
789791
#define IDS_STRING7001 7001
790792
#define IDS_STRING7002 7002
791793
#define IDS_STRING7003 7003

0 commit comments

Comments
 (0)