Skip to content

Commit 6a6ed54

Browse files
committed
[NTUSER] Some lifting for the Int/UserGet[Active|Capture|Foreground|ThreadFocus]Window() functions
1 parent 999502c commit 6a6ed54

File tree

2 files changed

+24
-29
lines changed

2 files changed

+24
-29
lines changed

win32ss/user/ntuser/desktop.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,7 +1403,6 @@ HWND FASTCALL IntGetDesktopWindow(VOID)
14031403
PWND FASTCALL UserGetDesktopWindow(VOID)
14041404
{
14051405
PDESKTOP pdo = IntGetActiveDesktop();
1406-
14071406
if (!pdo)
14081407
{
14091408
TRACE("No active desktop\n");
@@ -1416,7 +1415,6 @@ PWND FASTCALL UserGetDesktopWindow(VOID)
14161415
HWND FASTCALL IntGetMessageWindow(VOID)
14171416
{
14181417
PDESKTOP pdo = IntGetActiveDesktop();
1419-
14201418
if (!pdo)
14211419
{
14221420
TRACE("No active desktop\n");
@@ -1429,7 +1427,6 @@ HWND FASTCALL IntGetMessageWindow(VOID)
14291427
PWND FASTCALL UserGetMessageWindow(VOID)
14301428
{
14311429
PDESKTOP pdo = IntGetActiveDesktop();
1432-
14331430
if (!pdo)
14341431
{
14351432
TRACE("No active desktop\n");
@@ -1442,7 +1439,7 @@ HWND FASTCALL IntGetCurrentThreadDesktopWindow(VOID)
14421439
{
14431440
PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
14441441
PDESKTOP pdo = pti->rpdesk;
1445-
if (NULL == pdo)
1442+
if (!pdo)
14461443
{
14471444
ERR("Thread doesn't have a desktop\n");
14481445
return NULL;

win32ss/user/ntuser/focus.c

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,35 +19,34 @@ PTHREADINFO ptiLastInput = NULL;
1919
HWND ghwndOldFullscreen = NULL;
2020

2121
/*
22-
Check locking of a process or one or more menus are active.
23-
*/
22+
* Check locking of a process or one or more menus are active.
23+
*/
2424
BOOL FASTCALL
2525
IsFGLocked(VOID)
2626
{
27-
return (gppiLockSFW || guSFWLockCount);
27+
return (gppiLockSFW || guSFWLockCount);
2828
}
2929

3030
/*
31-
Get capture window via foreground Queue.
32-
*/
31+
* Get capture window via foreground Queue.
32+
*/
3333
HWND FASTCALL
3434
IntGetCaptureWindow(VOID)
3535
{
36-
PUSER_MESSAGE_QUEUE ForegroundQueue = IntGetFocusMessageQueue();
37-
return ( ForegroundQueue ? (ForegroundQueue->spwndCapture ? UserHMGetHandle(ForegroundQueue->spwndCapture) : 0) : 0);
36+
PUSER_MESSAGE_QUEUE ForegroundQueue = IntGetFocusMessageQueue();
37+
if (!ForegroundQueue)
38+
return NULL;
39+
return (ForegroundQueue->spwndCapture ? UserHMGetHandle(ForegroundQueue->spwndCapture) : NULL);
3840
}
3941

4042
HWND FASTCALL
4143
IntGetThreadFocusWindow(VOID)
4244
{
43-
PTHREADINFO pti;
44-
PUSER_MESSAGE_QUEUE ThreadQueue;
45-
46-
pti = PsGetCurrentThreadWin32Thread();
47-
ThreadQueue = pti->MessageQueue;
48-
if (!ThreadQueue)
49-
return NULL;
50-
return ThreadQueue->spwndFocus ? UserHMGetHandle(ThreadQueue->spwndFocus) : 0;
45+
PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
46+
PUSER_MESSAGE_QUEUE ThreadQueue = pti->MessageQueue;
47+
if (!ThreadQueue)
48+
return NULL;
49+
return (ThreadQueue->spwndFocus ? UserHMGetHandle(ThreadQueue->spwndFocus) : NULL);
5150
}
5251

5352
BOOL FASTCALL IntIsWindowFullscreen(PWND Window)
@@ -1423,20 +1422,19 @@ co_UserSetFocus(PWND Window)
14231422
HWND FASTCALL
14241423
UserGetForegroundWindow(VOID)
14251424
{
1426-
PUSER_MESSAGE_QUEUE ForegroundQueue;
1427-
1428-
ForegroundQueue = IntGetFocusMessageQueue();
1429-
return( ForegroundQueue ? (ForegroundQueue->spwndActive ? UserHMGetHandle(ForegroundQueue->spwndActive) : 0) : 0);
1425+
PUSER_MESSAGE_QUEUE ForegroundQueue = IntGetFocusMessageQueue();
1426+
if (!ForegroundQueue)
1427+
return NULL;
1428+
return (ForegroundQueue->spwndActive ? UserHMGetHandle(ForegroundQueue->spwndActive) : NULL);
14301429
}
14311430

14321431
HWND FASTCALL UserGetActiveWindow(VOID)
14331432
{
1434-
PTHREADINFO pti;
1435-
PUSER_MESSAGE_QUEUE ThreadQueue;
1436-
1437-
pti = PsGetCurrentThreadWin32Thread();
1438-
ThreadQueue = pti->MessageQueue;
1439-
return( ThreadQueue ? (ThreadQueue->spwndActive ? UserHMGetHandle(ThreadQueue->spwndActive) : 0) : 0);
1433+
PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
1434+
PUSER_MESSAGE_QUEUE ThreadQueue = pti->MessageQueue;
1435+
if (!ThreadQueue)
1436+
return NULL;
1437+
return (ThreadQueue->spwndActive ? UserHMGetHandle(ThreadQueue->spwndActive) : NULL);
14401438
}
14411439

14421440
HWND APIENTRY

0 commit comments

Comments
 (0)