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

Disable while fullscreen app is focused #29

Merged
merged 1 commit into from
Oct 31, 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
13 changes: 13 additions & 0 deletions hotcorner.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#define WIN32_LEAN_AND_MEAN
#include <stdlib.h>
#include <windows.h>
#include <shellapi.h>

#pragma comment(lib, "USER32")
#pragma comment(linker, "/SUBSYSTEM:WINDOWS")
Expand Down Expand Up @@ -90,6 +91,7 @@ static DWORD WINAPI CornerHotFunc(LPVOID lpParameter)
static LRESULT CALLBACK MouseHookCallback(int nCode, WPARAM wParam, LPARAM lParam)
{
MSLLHOOKSTRUCT *evt = (MSLLHOOKSTRUCT *) lParam;
QUERY_USER_NOTIFICATION_STATE pquns;

// If the mouse hasn't moved, we're done.
if (wParam != WM_MOUSEMOVE)
Expand Down Expand Up @@ -123,6 +125,17 @@ static LRESULT CALLBACK MouseHookCallback(int nCode, WPARAM wParam, LPARAM lPara
goto finish;
}

// Check if an app is currently fullscreen.
SHQueryUserNotificationState(&pquns);

switch (pquns) {
case QUNS_BUSY:
case QUNS_RUNNING_D3D_FULL_SCREEN:
case QUNS_PRESENTATION_MODE:
goto finish;
default:
}

// The corner is hot, and was previously cold. Here we start a thread to
// monitor if the mouse lingers.
CornerThread = CreateThread(NULL, 0, CornerHotFunc, NULL, 0, NULL);
Expand Down