Skip to content

Commit

Permalink
Right click on Win+X moves mouse to "Desktop" entry
Browse files Browse the repository at this point in the history
  • Loading branch information
valinet committed Oct 2, 2021
1 parent 1b1bc67 commit d2956ab
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

This document includes the same release notes as in the [Releases](https://github.com/valinet/ExplorerPatcher/releases) section on GitHub.

## 22000.194.0.22

Tested on build: 22000.194.

* When the taskbar is located at the bottom of the screen, opening the power user menu (`Win`+`X`) now automatically highlights the "Desktop" entry in the list. Also, the menu items can be activated either with left click, either with right click. Thus, this enables a behavior where you can double click the Start button with the right mouse button in order to quickly show the desktop (thanks to @Gaurav-Original-ClassicShellTester for the suggestion)

## 22000.194.0.21

Tested on build: 22000.194.
Expand Down
8 changes: 4 additions & 4 deletions ExplorerPatcher/ExplorerPatcher.rc
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 22000,194,0,21
PRODUCTVERSION 22000,194,0,21
FILEVERSION 22000,194,0,22
PRODUCTVERSION 22000,194,0,22
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -69,12 +69,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "VALINET Solutions SRL"
VALUE "FileDescription", "ExplorerPatcher"
VALUE "FileVersion", "22000.194.0.21"
VALUE "FileVersion", "22000.194.0.22"
VALUE "InternalName", "ExplorerPatcher.dll"
VALUE "LegalCopyright", "Copyright (C) 2006-2021 VALINET Solutions SRL. All rights reserved."
VALUE "OriginalFilename", "ExplorerPatcher.dll"
VALUE "ProductName", "ExplorerPatcher"
VALUE "ProductVersion", "22000.194.0.21"
VALUE "ProductVersion", "22000.194.0.22"
END
END
BLOCK "VarFileInfo"
Expand Down
48 changes: 48 additions & 0 deletions ExplorerPatcher/dllmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
#include "StartMenu.h"
#include "GUI.h"

#define WINX_ADJUST_X 5
#define WINX_ADJUST_Y 5

#define SB_MICA_EFFECT_SUBCLASS_OFFSET 0x5C70
#define SB_INIT1 0x26070
#define SB_INIT2 0x252C0
Expand Down Expand Up @@ -356,6 +359,51 @@ INT64 CLauncherTipContextMenu_ShowLauncherTipContextMenuHook(
if (pt)
{
point = *pt;
BOOL bBottom, bRight;
POINT dPt = GetDefaultWinXPosition(FALSE, &bBottom, &bRight);
if (bBottom)
{
HMONITOR hMonitor = MonitorFromPoint(point, MONITOR_DEFAULTTOPRIMARY);
MONITORINFO mi;
mi.cbSize = sizeof(MONITORINFO);
GetMonitorInfo(hMonitor, &mi);
UINT dpiX, dpiY;
HRESULT hr = GetDpiForMonitor(
hMonitor,
MDT_DEFAULT,
&dpiX,
&dpiY
);
double dx = dpiX / 96.0, dy = dpiY / 96.0;
BOOL xo = FALSE, yo = FALSE;
if (point.x - WINX_ADJUST_X * dx < mi.rcMonitor.left)
{
xo = TRUE;
}
if (point.y + WINX_ADJUST_Y * dy > mi.rcMonitor.bottom)
{
yo = TRUE;
}
POINT ptCursor;
GetCursorPos(&ptCursor);
if (xo)
{
ptCursor.x += (WINX_ADJUST_X * 2) * dx;
}
else
{
point.x -= WINX_ADJUST_X * dx;
}
if (yo)
{
ptCursor.y -= (WINX_ADJUST_Y * 2) * dy;
}
else
{
point.y += WINX_ADJUST_Y * dy;
}
SetCursorPos(ptCursor.x, ptCursor.y);
}
}
else
{
Expand Down

0 comments on commit d2956ab

Please sign in to comment.