Skip to content

Commit d2956ab

Browse files
committed
Right click on Win+X moves mouse to "Desktop" entry
1 parent 1b1bc67 commit d2956ab

File tree

3 files changed

+58
-4
lines changed

3 files changed

+58
-4
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

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

5+
## 22000.194.0.22
6+
7+
Tested on build: 22000.194.
8+
9+
* 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)
10+
511
## 22000.194.0.21
612

713
Tested on build: 22000.194.

ExplorerPatcher/ExplorerPatcher.rc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ END
5151
//
5252

5353
VS_VERSION_INFO VERSIONINFO
54-
FILEVERSION 22000,194,0,21
55-
PRODUCTVERSION 22000,194,0,21
54+
FILEVERSION 22000,194,0,22
55+
PRODUCTVERSION 22000,194,0,22
5656
FILEFLAGSMASK 0x3fL
5757
#ifdef _DEBUG
5858
FILEFLAGS 0x1L
@@ -69,12 +69,12 @@ BEGIN
6969
BEGIN
7070
VALUE "CompanyName", "VALINET Solutions SRL"
7171
VALUE "FileDescription", "ExplorerPatcher"
72-
VALUE "FileVersion", "22000.194.0.21"
72+
VALUE "FileVersion", "22000.194.0.22"
7373
VALUE "InternalName", "ExplorerPatcher.dll"
7474
VALUE "LegalCopyright", "Copyright (C) 2006-2021 VALINET Solutions SRL. All rights reserved."
7575
VALUE "OriginalFilename", "ExplorerPatcher.dll"
7676
VALUE "ProductName", "ExplorerPatcher"
77-
VALUE "ProductVersion", "22000.194.0.21"
77+
VALUE "ProductVersion", "22000.194.0.22"
7878
END
7979
END
8080
BLOCK "VarFileInfo"

ExplorerPatcher/dllmain.c

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
#include "StartMenu.h"
3030
#include "GUI.h"
3131

32+
#define WINX_ADJUST_X 5
33+
#define WINX_ADJUST_Y 5
34+
3235
#define SB_MICA_EFFECT_SUBCLASS_OFFSET 0x5C70
3336
#define SB_INIT1 0x26070
3437
#define SB_INIT2 0x252C0
@@ -356,6 +359,51 @@ INT64 CLauncherTipContextMenu_ShowLauncherTipContextMenuHook(
356359
if (pt)
357360
{
358361
point = *pt;
362+
BOOL bBottom, bRight;
363+
POINT dPt = GetDefaultWinXPosition(FALSE, &bBottom, &bRight);
364+
if (bBottom)
365+
{
366+
HMONITOR hMonitor = MonitorFromPoint(point, MONITOR_DEFAULTTOPRIMARY);
367+
MONITORINFO mi;
368+
mi.cbSize = sizeof(MONITORINFO);
369+
GetMonitorInfo(hMonitor, &mi);
370+
UINT dpiX, dpiY;
371+
HRESULT hr = GetDpiForMonitor(
372+
hMonitor,
373+
MDT_DEFAULT,
374+
&dpiX,
375+
&dpiY
376+
);
377+
double dx = dpiX / 96.0, dy = dpiY / 96.0;
378+
BOOL xo = FALSE, yo = FALSE;
379+
if (point.x - WINX_ADJUST_X * dx < mi.rcMonitor.left)
380+
{
381+
xo = TRUE;
382+
}
383+
if (point.y + WINX_ADJUST_Y * dy > mi.rcMonitor.bottom)
384+
{
385+
yo = TRUE;
386+
}
387+
POINT ptCursor;
388+
GetCursorPos(&ptCursor);
389+
if (xo)
390+
{
391+
ptCursor.x += (WINX_ADJUST_X * 2) * dx;
392+
}
393+
else
394+
{
395+
point.x -= WINX_ADJUST_X * dx;
396+
}
397+
if (yo)
398+
{
399+
ptCursor.y -= (WINX_ADJUST_Y * 2) * dy;
400+
}
401+
else
402+
{
403+
point.y += WINX_ADJUST_Y * dy;
404+
}
405+
SetCursorPos(ptCursor.x, ptCursor.y);
406+
}
359407
}
360408
else
361409
{

0 commit comments

Comments
 (0)