Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Src/StartMenu/StartMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ static bool HookStartMenu( THookMode mode, HWND &menu )
int err=GetLastError();
DllLogToFile(STARTUP_LOG,L"StartMenu: hook failed: 0x%08X",err);
}
else
ConnectWin11Taskbar(process);
PostMessage(g_TaskBar,WM_NULL,0,0); // make sure there is one message in the queue

return true;
Expand Down
28 changes: 27 additions & 1 deletion Src/StartMenu/StartMenuDLL/StartMenuDLL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "ResourceHelper.h"
#include "LogManager.h"
#include "TouchHelper.h"
#include "Win11Taskbar.h"
#include "IatHookHelper.h"
#include "dllmain.h"
#include <uxtheme.h>
Expand Down Expand Up @@ -1296,6 +1297,9 @@ static void UpdateStartButtonPosition(const TaskbarInfo* taskBar, const WINDOWPO
buttonFlags |= SWP_NOZORDER;
}

// rcTask is nudged by a pixel below for the classic Win32 button. Keep the real bar rect.
const RECT rcTaskRaw = rcTask;

if (!IsStartButtonSmallIcons(taskBar->taskbarId))
{
bool bClassic;
Expand Down Expand Up @@ -1343,6 +1347,23 @@ static void UpdateStartButtonPosition(const TaskbarInfo* taskBar, const WINDOWPO
else
y = rcTask.bottom - taskBar->startButtonSize.cy;

// Win11 start hit target, measured at 96 DPI on a 48px bar: a 40px square,
// 4px from the top and bottom and 12px from the screen edge. The classic
// 1px drop and the left-edge pin leave a custom image low and left of it.
if (IsWin11() && GetStartButtonType() == START_BUTTON_CUSTOM && !GetSettingBool(L"StartButtonAlign") && !g_epTaskbar)
{
const int margin = ScaleForDpi(taskBar->taskBar, 4);
const int lead = ScaleForDpi(taskBar->taskBar, 12);
int slot = (rcTaskRaw.bottom - rcTaskRaw.top) - margin * 2;
if (slot < 1)
slot = rcTaskRaw.bottom - rcTaskRaw.top;
if (GetWindowLongPtr(taskBar->rebar, GWL_EXSTYLE) & WS_EX_LAYOUTRTL)
x = rcTaskRaw.right - lead - slot + (slot - taskBar->startButtonSize.cx) / 2;
else
x = rcTaskRaw.left + lead + (slot - taskBar->startButtonSize.cx) / 2;
y = rcTaskRaw.top + margin + (slot - taskBar->startButtonSize.cy) / 2;
}

// Start button on Win11 is a bit shifted to the right
// We will shift our Aero button to cover original button
if (IsWin11() && (x == info.rcMonitor.left) && (GetStartButtonType() == START_BUTTON_AERO) && !g_epTaskbar)
Expand Down Expand Up @@ -1628,7 +1649,8 @@ static void ComputeTaskbarColors( int *data )
{
bool bDefLook;
int look=GetSettingInt(L"TaskbarLook",bDefLook);
if (GetWinVersion()<WIN_VER_WIN10 || !IsAppThemed() || look==TASKBAR_AEROGLASS || (look==TASKBAR_TRANSPARENT && g_TaskbarTexture))
// On Windows 11 a disabled accent is a black plate behind the XAML bar. Keep the accent alive there.
if (GetWinVersion()<WIN_VER_WIN10 || !IsAppThemed() || look==TASKBAR_AEROGLASS || (look==TASKBAR_TRANSPARENT && g_TaskbarTexture && !IsWin11()))
{
memset(data,0,16);
}
Expand Down Expand Up @@ -2643,6 +2665,8 @@ void UpdateTaskBars( TUpdateTaskbar update )
InvalidateRect(taskBar.taskBar,NULL,TRUE);
PostMessage(taskBar.taskBar,WM_THEMECHANGED,0,0);
}
if (IsWin11())
ApplyWin11Taskbar();
}

///////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -3227,6 +3251,8 @@ if (!g_bTrimHooks)

UpdateTaskBars(TASKBAR_RECREATE_BUTTONS);
UpdateTaskBars(TASKBAR_UPDATE_TEXTURE);
if (IsWin11())
StartWin11TaskbarConnect();
}

static void RecreateStartButton( size_t taskbarId )
Expand Down
3 changes: 3 additions & 0 deletions Src/StartMenu/StartMenuDLL/StartMenuDLL.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ STARTMENUAPI HWND FindTaskBar( DWORD process );
// WH_GETMESSAGE hook for the explorer's GUI thread. The start menu exe uses this hook to inject code into the explorer process
STARTMENUAPI LRESULT CALLBACK HookInject( int code, WPARAM wParam, LPARAM lParam );

// Ask Explorer's XAML taskbar to load our tap. Called from StartMenu.exe. No-op on older Windows.
STARTMENUAPI void ConnectWin11Taskbar( DWORD explorerPid );

// Toggle the start menu. bKeyboard - set to true to show the keyboard cues
STARTMENUAPI HWND ToggleStartMenu( int taskbarId, bool bKeyboard );

Expand Down
2 changes: 2 additions & 0 deletions Src/StartMenu/StartMenuDLL/StartMenuDLL.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TouchHelper.cpp" />
<ClCompile Include="Win11Taskbar.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Accessibility.h" />
Expand All @@ -110,6 +111,7 @@
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="TouchHelper.h" />
<ClInclude Include="Win11Taskbar.h" />
</ItemGroup>
<ItemGroup>
<Image Include="..\..\Setup\OpenShell.ico" />
Expand Down
6 changes: 6 additions & 0 deletions Src/StartMenu/StartMenuDLL/StartMenuDLL.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@
<ClCompile Include="TouchHelper.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Win11Taskbar.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Accessibility.h">
Expand Down Expand Up @@ -125,6 +128,9 @@
<ClInclude Include="targetver.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Win11Taskbar.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="TouchHelper.h">
<Filter>Header Files</Filter>
</ClInclude>
Expand Down
Loading