Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small Tray Icons on Touch 1.0.0 #1119

Merged
merged 1 commit into from
Oct 21, 2024
Merged
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
75 changes: 75 additions & 0 deletions mods/small-tray-icons-on-touch.wh.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// ==WindhawkMod==
// @id small-tray-icons-on-touch
// @name Small Tray Icons on Touch
// @description Reduces the size of tray icons on touch screens
// @version 1.0.0
// @author aubymori
// @github https://github.com/aubymori
// @include explorer.exe
// ==/WindhawkMod==

// ==WindhawkModReadme==
/*
# Small Tray Icons on Touch
The Windows 10 taskbar has increased tray icon size on touch screens.
This mod disables that functionality.

# IMPORTANT: READ!
Windhawk needs to hook into `winlogon.exe` to successfully capture Explorer starting. Please
navigate to Windhawk's Settings, Advanced settings, More advanced settings, and make sure that
`winlogon.exe` is in the Process inclusion list.

**Before**:

![Before](https://raw.githubusercontent.com/aubymori/images/refs/heads/main/small-tray-icons-on-touch-before.png)

**After**:

![After](https://raw.githubusercontent.com/aubymori/images/refs/heads/main/small-tray-icons-on-touch-after.png)
*/
// ==/WindhawkModReadme==

BOOL (WINAPI *GetPointerDevices_orig)(UINT32 *, POINTER_DEVICE_INFO *);
BOOL WINAPI GetPointerDevices_hook(UINT32 *deviceCount, POINTER_DEVICE_INFO *pointerDevices)
{
if (!deviceCount)
return FALSE;

UINT32 realDeviceCount;
if (!GetPointerDevices_orig(&realDeviceCount, nullptr))
return FALSE;

if (!realDeviceCount)
{
*deviceCount = 0;
return TRUE;
}

POINTER_DEVICE_INFO *devices = new POINTER_DEVICE_INFO[realDeviceCount];
UINT32 reportedDeviceCount = 0;
if (!GetPointerDevices_orig(&realDeviceCount, devices))
return FALSE;

for (UINT32 i = 0; i < realDeviceCount; i++)
{
if (devices[i].pointerDeviceType != POINTER_DEVICE_TYPE_TOUCH)
{
if (pointerDevices)
pointerDevices[reportedDeviceCount] = devices[i];
reportedDeviceCount++;
}
}

*deviceCount = reportedDeviceCount;
return TRUE;
}

BOOL Wh_ModInit(void)
{
Wh_SetFunctionHook(
(void *)GetPointerDevices,
(void *)GetPointerDevices_hook,
(void **)&GetPointerDevices_orig
);
return TRUE;
}
Loading