ReactOS  0.4.15-dev-5126-g3bb451b
focus.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

HWND FASTCALL IntGetCaptureWindow (VOID)
 
HWND FASTCALL co_UserSetCapture (HWND hWnd)
 
BOOL FASTCALL IntReleaseCapture (VOID)
 
HWND FASTCALL IntGetThreadFocusWindow (VOID)
 
HWND APIENTRY IntGetCapture (VOID)
 
HWND FASTCALL UserGetActiveWindow (VOID)
 
BOOL FASTCALL co_IntMouseActivateWindow (PWND Window)
 
BOOL FASTCALL co_IntSetForegroundWindow (PWND Window)
 
BOOL FASTCALL co_IntSetForegroundWindowMouse (PWND Window)
 
BOOL FASTCALL co_IntSetActiveWindow (PWND, BOOL, BOOL, BOOL)
 
BOOL FASTCALL IntUserSetActiveWindow (PWND, BOOL, BOOL, BOOL)
 
BOOL FASTCALL UserSetActiveWindow (PWND Wnd)
 
BOOL FASTCALL IntLockSetForegroundWindow (UINT uLockCode)
 
BOOL FASTCALL IntAllowSetForegroundWindow (DWORD dwProcessId)
 
VOID FASTCALL IntActivateWindow (PWND, PTHREADINFO, HANDLE, DWORD)
 
BOOL FASTCALL IntDeactivateWindow (PTHREADINFO, HANDLE)
 
BOOL FASTCALL co_IntSetForegroundMessageQueue (PWND, PTHREADINFO, BOOL, DWORD)
 
VOID FASTCALL UpdateShellHook (PWND)
 
BOOL FASTCALL IntCheckFullscreen (PWND Window)
 

Variables

PUSER_MESSAGE_QUEUE gpqForeground
 
PUSER_MESSAGE_QUEUE gpqForegroundPrev
 
PTHREADINFO ptiLastInput
 

Function Documentation

◆ co_IntMouseActivateWindow()

BOOL FASTCALL co_IntMouseActivateWindow ( PWND  Window)

Definition at line 1248 of file focus.c.

1249 {
1250  TRACE("Mouse Active\n");
1252 }
#define TRUE
Definition: types.h:120
static BOOL FASTCALL co_IntSetForegroundAndFocusWindow(_In_opt_ PWND Wnd, _In_ BOOL MouseActivate, _In_ BOOL bFlash)
Definition: focus.c:924
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by co_IntProcessMouseMessage().

◆ co_IntSetActiveWindow()

BOOL FASTCALL co_IntSetActiveWindow ( PWND  ,
BOOL  ,
BOOL  ,
BOOL   
)

◆ co_IntSetForegroundMessageQueue()

BOOL FASTCALL co_IntSetForegroundMessageQueue ( PWND  ,
PTHREADINFO  ,
BOOL  ,
DWORD   
)

◆ co_IntSetForegroundWindow()

BOOL FASTCALL co_IntSetForegroundWindow ( PWND  Window)

Definition at line 1545 of file focus.c.

1546 {
1548 
1550 }
#define TRUE
Definition: types.h:120
#define ASSERT_REFS_CO(_obj_)
Definition: userfuncs.h:14
Definition: window.c:28
#define FALSE
Definition: types.h:117
static BOOL FASTCALL co_IntSetForegroundAndFocusWindow(_In_opt_ PWND Wnd, _In_ BOOL MouseActivate, _In_ BOOL bFlash)
Definition: focus.c:924

Referenced by ActivateOtherWindowMin(), co_WinPosActivateOtherWindow(), co_WinPosSetWindowPos(), co_WinPosShowWindow(), DefWndHandleSetCursor(), DefWndHandleSysCommand(), and NtUserCallHwndLock().

◆ co_IntSetForegroundWindowMouse()

BOOL FASTCALL co_IntSetForegroundWindowMouse ( PWND  Window)

Definition at line 1556 of file focus.c.

1557 {
1559 
1561 }
#define TRUE
Definition: types.h:120
#define ASSERT_REFS_CO(_obj_)
Definition: userfuncs.h:14
Definition: window.c:28
#define FALSE
Definition: types.h:117
static BOOL FASTCALL co_IntSetForegroundAndFocusWindow(_In_opt_ PWND Wnd, _In_ BOOL MouseActivate, _In_ BOOL bFlash)
Definition: focus.c:924

Referenced by NC_HandleNCLButtonDown(), NtUserCallHwndLock(), and NtUserCallTwoParam().

◆ co_UserSetCapture()

HWND FASTCALL co_UserSetCapture ( HWND  hWnd)

These are HACKS!

Definition at line 1453 of file focus.c.

1454 {
1455  PTHREADINFO pti;
1456  PUSER_MESSAGE_QUEUE ThreadQueue;
1457  PWND pWnd, Window = NULL;
1458  HWND hWndPrev;
1459 
1461  ThreadQueue = pti->MessageQueue;
1462 
1463  if (ThreadQueue->QF_flags & QF_CAPTURELOCKED)
1464  return NULL;
1465 
1466  if (hWnd && (Window = UserGetWindowObject(hWnd)))
1467  {
1468  if (Window->head.pti->MessageQueue != ThreadQueue)
1469  {
1470  ERR("Window Thread does not match Current!\n");
1471  return NULL;
1472  }
1473  }
1474 
1475  hWndPrev = MsqSetStateWindow(pti, MSQ_STATE_CAPTURE, hWnd);
1476 
1477  if (hWndPrev)
1478  {
1479  pWnd = UserGetWindowObject(hWndPrev);
1480  if (pWnd)
1481  IntNotifyWinEvent(EVENT_SYSTEM_CAPTUREEND, pWnd, OBJID_WINDOW, CHILDID_SELF, WEF_SETBYWNDPTI);
1482  }
1483 
1484  if (Window)
1485  IntNotifyWinEvent(EVENT_SYSTEM_CAPTURESTART, Window, OBJID_WINDOW, CHILDID_SELF, WEF_SETBYWNDPTI);
1486 
1487  //
1488  // Only send the message if we have a previous Window!
1489  // Fix msg_menu tracking popup menu and win test_capture_4!!!!
1490  //
1491  if (hWndPrev)
1492  {
1493  if (ThreadQueue->MenuOwner && Window) ThreadQueue->QF_flags |= QF_CAPTURELOCKED;
1494 
1496 
1497  ThreadQueue->QF_flags &= ~QF_CAPTURELOCKED;
1498  }
1499 
1500  if (hWnd == NULL) // Release mode.
1501  {
1502  MOUSEINPUT mi;
1504  /* Also remove other windows if not capturing anymore */
1508  /* Somebody may have missed some mouse movements */
1509  mi.dx = 0;
1510  mi.dy = 0;
1511  mi.mouseData = 0;
1513  mi.time = 0;
1514  mi.dwExtraInfo = 0;
1516  }
1517  return hWndPrev;
1518 }
#define MSQ_STATE_MOVESIZE
Definition: ntuser.h:3675
BOOL NTAPI UserSendMouseInput(MOUSEINPUT *pMouseInput, BOOL bInjected)
Definition: mouse.c:168
VOID FASTCALL IntNotifyWinEvent(DWORD Event, PWND pWnd, LONG idObject, LONG idChild, DWORD flags)
Definition: event.c:179
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
#define WM_CAPTURECHANGED
Definition: winuser.h:1798
#define OBJID_WINDOW
Definition: winable.h:15
HWND hWnd
Definition: settings.c:17
static MONITORINFO mi
Definition: win.c:7338
Definition: window.c:28
#define FALSE
Definition: types.h:117
#define QF_CAPTURELOCKED
Definition: msgqueue.h:111
#define CHILDID_SELF
Definition: winable.h:14
LONG_PTR LPARAM
Definition: windef.h:208
#define WEF_SETBYWNDPTI
Definition: ntuser.h:227
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:126
HWND FASTCALL MsqSetStateWindow(PTHREADINFO pti, ULONG Type, HWND hWnd)
Definition: msgqueue.c:2551
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1446
#define ERR(fmt,...)
Definition: debug.h:110
Definition: ntuser.h:672
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:85
#define MSQ_STATE_CAPTURE
Definition: ntuser.h:3671
#define MOUSEEVENTF_MOVE
Definition: winuser.h:1173
#define NULL
Definition: types.h:112
DWORD dwFlags
Definition: winuser.h:3777
#define MSQ_STATE_MENUOWNER
Definition: ntuser.h:3674

Referenced by DefWndDoSizeMove(), IntReleaseCapture(), IntTrackPopupMenuEx(), MENU_DoNextMenu(), MENU_InitTracking(), MENU_TrackMenu(), NC_DoButton(), NC_HandleNCRButtonDown(), NtUserDragDetect(), and NtUserSetCapture().

◆ IntActivateWindow()

VOID FASTCALL IntActivateWindow ( PWND  ,
PTHREADINFO  ,
HANDLE  ,
DWORD   
)

Definition at line 357 of file focus.c.

358 {
360  PUSER_MESSAGE_QUEUE pmq = pti->MessageQueue;
361 
362  if (Wnd)
363  {
364  Wnd = VerifyWnd(Wnd);
365 
366  if (!Wnd) return;
367 
368  UserRefObjectCo(Wnd, &Ref);
369 
370  if (!gpqForeground)
371  {
372  // No foreground queue set.
373  co_IntSetForegroundMessageQueue( Wnd, pti, (BOOL)Type, 0);
374  }
375  else
376  {
377  // Same Active and Wnd.
378  if ( pmq->spwndActive == Wnd )
379  {
380  WPARAM wParam = (Wnd->head.pti->MessageQueue == gpqForeground);
381 
383 
384  if (wParam)
385  {
386  UpdateShellHook(Wnd);
387 
389  }
390  }
391  else // Not the same, set the active Wnd.
392  {
394  }
395  }
396  UserDerefObjectCo(Wnd);
397  }
398  else // Handle no Wnd!
399  {
400  if ( tid && // TID,
401  pmq->spwndActive && // Active WND not zero,
402  gpqForeground == pmq ) // Same message queues.
403  {
404  Wnd = pmq->spwndActive; // Use active window from current queue.
405 
406  UserRefObjectCo(Wnd, &Ref);
407 
409 
410  UpdateShellHook(Wnd);
411 
413 
414  UserDerefObjectCo(Wnd);
415  }
416  else if (gpqForeground != pmq)
417  {
418  // Not the same message queue so clear flags for foreground switching.
419  pti->TIF_flags &= ~TIF_ALLOWFOREGROUNDACTIVATE;
420  pti->ppi->W32PF_flags &= ~W32PF_ALLOWFOREGROUNDACTIVATE;
421  }
422  }
423 }
PUSER_MESSAGE_QUEUE gpqForeground
Definition: focus.c:13
BOOL FASTCALL co_IntSetActiveWindow(_In_ PWND Wnd, _In_ BOOL bMouse, _In_ BOOL bFocus, _In_ BOOL Async)
Definition: focus.c:1024
#define TRUE
Definition: types.h:120
BOOLEAN FASTCALL co_WinPosSetWindowPos(PWND Window, HWND WndInsertAfter, INT x, INT y, INT cx, INT cy, UINT flags)
Definition: winpos.c:1721
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:27
#define HWND_TOP
Definition: winuser.h:1197
UINT_PTR WPARAM
Definition: windef.h:207
WPARAM wParam
Definition: combotst.c:138
#define W32PF_ALLOWFOREGROUNDACTIVATE
Definition: win32.h:12
#define WM_NCACTIVATE
Definition: winuser.h:1678
unsigned int BOOL
Definition: ntddk_ex.h:94
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:40
Definition: object.h:3
#define TIF_ALLOWFOREGROUNDACTIVATE
Definition: ntuser.h:259
#define UserHMGetHandle(obj)
Definition: ntuser.h:222
Type
Definition: Type.h:6
BOOL FASTCALL co_IntSetForegroundMessageQueue(_In_opt_ PWND Wnd, _In_ PTHREADINFO pti, _In_ BOOL MouseActivate, _In_ DWORD Type)
Definition: focus.c:767
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1446
#define SWP_NOSIZE
Definition: winuser.h:1235
#define SWP_NOMOVE
Definition: winuser.h:1234
PWND FASTCALL VerifyWnd(PWND pWnd)
Definition: window.c:86
static TfClientId tid
VOID FASTCALL UpdateShellHook(PWND Window)
Definition: focus.c:99

Referenced by handle_internal_events().

◆ IntAllowSetForegroundWindow()

BOOL FASTCALL IntAllowSetForegroundWindow ( DWORD  dwProcessId)

Definition at line 1598 of file focus.c.

1599 {
1600  PPROCESSINFO ppi, ppiCur;
1602 
1603  ppi = NULL;
1604  if (dwProcessId != ASFW_ANY)
1605  {
1607  {
1609  return FALSE;
1610  }
1612  if (!ppi)
1613  {
1615  return FALSE;
1616  }
1617  }
1619  if (!CanForceFG(ppiCur))
1620  {
1623  return FALSE;
1624  }
1625  if (dwProcessId == ASFW_ANY)
1626  { // All processes will be enabled to set the foreground window.
1627  //ERR("ptiLastInput is CLEARED!!\n");
1628  ptiLastInput = NULL;
1629  }
1630  else
1631  { // Rule #3, last input event in force.
1632  ERR("ptiLastInput is SET!!\n");
1633  //ptiLastInput = ppi->ptiList; // See CORE-6384 & CORE-7030.
1635  }
1636  return TRUE;
1637 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define TRUE
Definition: types.h:120
PVOID NTAPI PsGetProcessWin32Process(PEPROCESS Process)
Definition: process.c:1193
#define FALSE
Definition: types.h:117
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
PTHREADINFO ptiLastInput
Definition: focus.c:18
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define UlongToHandle(ul)
Definition: basetsd.h:97
#define ObDereferenceObject
Definition: obfuncs.h:203
NTSTATUS NTAPI PsLookupProcessByProcessId(IN HANDLE ProcessId, OUT PEPROCESS *Process)
Definition: process.c:919
#define ERR(fmt,...)
Definition: debug.h:110
#define NULL
Definition: types.h:112
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
BOOL FASTCALL CanForceFG(PPROCESSINFO ppi)
Definition: focus.c:749
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28

Referenced by NtUserCallOneParam().

◆ IntCheckFullscreen()

BOOL FASTCALL IntCheckFullscreen ( PWND  Window)

Definition at line 79 of file focus.c.

80 {
81  HWND hWnd;
82 
85 
87  return FALSE;
88 
90  if (ghwndOldFullscreen != hWnd)
91  {
94  }
95  return TRUE;
96 }
#define TRUE
Definition: types.h:120
HWND hWnd
Definition: settings.c:17
HWND ghwndOldFullscreen
Definition: focus.c:19
BOOL FASTCALL IntIsWindowFullscreen(PWND Window)
Definition: focus.c:53
UINT_PTR WPARAM
Definition: windef.h:207
Definition: window.c:28
#define FALSE
Definition: types.h:117
#define UserHMGetHandle(obj)
Definition: ntuser.h:222
#define ValidateHwndNoErr(hwnd)
Definition: precomp.h:84
#define NULL
Definition: types.h:112
VOID co_IntShellHookNotify(WPARAM Message, WPARAM wParam, LPARAM lParam)
Definition: desktop.c:1692
#define HSHELL_RUDEAPPACTIVATED
Definition: winuser.h:1271

Referenced by co_WinPosSetWindowPos(), and UpdateShellHook().

◆ IntDeactivateWindow()

BOOL FASTCALL IntDeactivateWindow ( PTHREADINFO  ,
HANDLE   
)

Definition at line 191 of file focus.c.

192 {
194  PTHREADINFO ptiPrev;
195  PWND pwndPrev;
196  BOOL InAAPM = FALSE;
198 
199  if ( !pti->MessageQueue->spwndActive )
200  {
201  TRACE("IDAW E : Nothing to do, Active is NULL! pti 0x%p tid 0x%p\n",pti,tid);
202  return TRUE;
203  }
204 
205  TRACE("IDAW : pti 0x%p tid 0x%p\n",pti,tid);
206 
207  if (ptiCurrent != pti)
208  {
210  IntReferenceThreadInfo(ptiCurrent);
211  }
212 
213  if (!(pti->TIF_flags & TIF_INACTIVATEAPPMSG) )
214  {
215  pti->TIF_flags |= TIF_INACTIVATEAPPMSG;
216  InAAPM = TRUE;
217  }
218 
219  //
220  // Check for Capture and release it.
221  //
222  if ( pti->MessageQueue->spwndCapture )
223  {
224  MSG msg;
225  PWND pwndCapture = pti->MessageQueue->spwndCapture;
226 
227  UserRefObjectCo(pwndCapture, &Ref);
228  co_IntSendMessage(UserHMGetHandle(pwndCapture), WM_CANCELMODE, 0, 0);
229  UserDerefObjectCo(pwndCapture);
230 
231  /* Generate mouse move message */
232  msg.message = WM_MOUSEMOVE;
233  msg.wParam = UserGetMouseButtonsState();
234  msg.lParam = MAKELPARAM(gpsi->ptCursor.x, gpsi->ptCursor.y);
235  msg.pt = gpsi->ptCursor;
237  }
238 
239  //
240  // Check for Active and release it.
241  //
242  if ( pti->MessageQueue->spwndActive )
243  {
244  pwndPrev = pti->MessageQueue->spwndActive;
245  ptiPrev = pwndPrev->head.pti;
246 
248  {
249  if (InAAPM) pti->TIF_flags &= ~TIF_INACTIVATEAPPMSG;
250  if (ptiCurrent != pti)
251  {
253  IntDereferenceThreadInfo(ptiCurrent);
254  }
255  return FALSE;
256  }
257 
258  if ( pti->MessageQueue->spwndActive == pwndPrev )
259  {
260  pti->MessageQueue->spwndActivePrev = pwndPrev;
261  pti->MessageQueue->spwndActive = NULL;
262  }
263 
264  if (ptiPrev->TIF_flags & TIF_INCLEANUP) ptiPrev = NULL;
265  }
266  else
267  {
268  ptiPrev = pti;
269  pwndPrev = (PWND)-1; // Avoid zero Active window.
270  }
271 
272  if ( ptiPrev )
273  {
274  HANDLE OldTID = PsGetThreadId(ptiPrev->pEThread);
275  PWND cWindow;
276  HWND *List, *phWnd;
277 
279  if ( List )
280  {
281  if ( OldTID )
282  {
283  for (phWnd = List; *phWnd; ++phWnd)
284  {
285  cWindow = ValidateHwndNoErr(*phWnd);
286  if ( cWindow && cWindow->head.pti == ptiPrev )
287  { // FALSE if the window is being deactivated,
288  // ThreadId that owns the window being activated.
289  //ERR("IDW : WM_ACTIVATEAPP(0) hwnd %p tid Old %p New %p\n",UserHMGetHandle(cWindow),OldTID,tid);
290  UserRefObjectCo(cWindow, &Ref);
292  UserDerefObjectCo(cWindow);
293  }
294  }
295  }
297  }
298  }
299 
300  //
301  // Now check for a change (Bounce), if Active same as previous window, release it too.
302  //
303  if ( pti->MessageQueue->spwndActive == pwndPrev )
304  {
306  {
307  if (InAAPM) pti->TIF_flags &= ~TIF_INACTIVATEAPPMSG;
308  if (ptiCurrent != pti)
309  {
311  IntDereferenceThreadInfo(ptiCurrent);
312  }
313  return FALSE;
314  }
315 
316  if ( pti->MessageQueue->spwndActive == pwndPrev )
317  {
318  pti->MessageQueue->spwndActivePrev = pwndPrev;
319  pti->MessageQueue->spwndActive = NULL;
320  }
321  }
322 
323  //
324  // Check for Focus and release it.
325  //
326  if ( pti->MessageQueue->spwndFocus )
327  {
328  PWND pwndFocus = pti->MessageQueue->spwndFocus;
329 
330  //
331  // Fix win.c:test_SetForegroundWindow:SetActiveWindow(0)!
332  //
333  pti->MessageQueue->spwndFocus = NULL; // Null out Focus.
334 
335  UserRefObjectCo(pwndFocus, &Ref);
337  if (IS_IMM_MODE())
338  {
339  IntFocusSetInputContext(pwndFocus, FALSE, FALSE);
340  }
341  UserDerefObjectCo(pwndFocus);
342  }
343 
344  if (InAAPM) pti->TIF_flags &= ~TIF_INACTIVATEAPPMSG;
345  if (ptiCurrent != pti)
346  {
348  IntDereferenceThreadInfo(ptiCurrent);
349  }
350  return TRUE;
351 }
VOID FASTCALL co_MsqInsertMouseMessage(MSG *Msg, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook)
Definition: msgqueue.c:580
VOID IntFocusSetInputContext(PWND pWnd, BOOL bActivate, BOOL bCallback)
Definition: focus.c:150
#define TRUE
Definition: types.h:120
#define IS_IMM_MODE()
Definition: ntuser.h:1204
FLONG TIF_flags
Definition: win32.h:91
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define MAKELPARAM(l, h)
Definition: winuser.h:3998
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
PSERVERINFO gpsi
Definition: imm.c:17
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:27
WORD FASTCALL UserGetMouseButtonsState(VOID)
Definition: mouse.c:22
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:40
THRDESKHEAD head
Definition: ntuser.h:674
Definition: object.h:3
LONG_PTR LPARAM
Definition: windef.h:208
#define IntReferenceThreadInfo(pti)
Definition: win32.h:162
BOOL FASTCALL co_IntSendDeactivateMessages(HWND hWndPrev, HWND hWnd, BOOL Clear)
Definition: focus.c:118
#define UserHMGetHandle(obj)
Definition: ntuser.h:222
#define TRACE(s)
Definition: solgame.cpp:4
#define WM_KILLFOCUS
Definition: winuser.h:1604
#define TIF_INACTIVATEAPPMSG
Definition: ntuser.h:263
#define ValidateHwndNoErr(hwnd)
Definition: precomp.h:84
PWND FASTCALL UserGetDesktopWindow(VOID)
Definition: desktop.c:1386
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1446
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
#define WM_CANCELMODE
Definition: winuser.h:1625
HWND *FASTCALL IntWinListChildren(PWND Window)
Definition: window.c:278
HANDLE NTAPI PsGetThreadId(IN PETHREAD Thread)
Definition: thread.c:705
Definition: ntuser.h:672
struct _WND * PWND
#define WM_ACTIVATEAPP
Definition: winuser.h:1622
#define WM_MOUSEMOVE
Definition: winuser.h:1765
#define NULL
Definition: types.h:112
#define msg(x)
Definition: auth_time.c:54
#define USERTAG_WINDOWLIST
Definition: tags.h:298
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define IntDereferenceThreadInfo(pti)
Definition: win32.h:167
static TfClientId tid
#define TIF_INCLEANUP
Definition: ntuser.h:254

Referenced by co_IntSetForegroundMessageQueue(), and handle_internal_events().

◆ IntGetCapture()

HWND APIENTRY IntGetCapture ( VOID  )

Definition at line 1435 of file focus.c.

1436 {
1437  PTHREADINFO pti;
1438  PUSER_MESSAGE_QUEUE ThreadQueue;
1440 
1441  TRACE("Enter IntGetCapture\n");
1442 
1444  ThreadQueue = pti->MessageQueue;
1445  RETURN( ThreadQueue ? (ThreadQueue->spwndCapture ? UserHMGetHandle(ThreadQueue->spwndCapture) : 0) : 0);
1446 
1447 CLEANUP:
1448  TRACE("Leave IntGetCapture, ret=%p\n", _ret_);
1449  END_CLEANUP;
1450 }
#define CLEANUP
Definition: ntuser.h:5
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
#define RETURN(x)
#define UserHMGetHandle(obj)
Definition: ntuser.h:222
#define TRACE(s)
Definition: solgame.cpp:4
#define DECLARE_RETURN(type)
Definition: ntuser.h:3
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:85
#define END_CLEANUP
Definition: ntuser.h:6

Referenced by DefWndDoSizeMove(), MENU_TrackMenu(), NC_HandleNCRButtonDown(), and NtUserGetThreadState().

◆ IntGetCaptureWindow()

HWND FASTCALL IntGetCaptureWindow ( VOID  )

Definition at line 34 of file focus.c.

35 {
36  PUSER_MESSAGE_QUEUE ForegroundQueue = IntGetFocusMessageQueue();
37  return ( ForegroundQueue ? (ForegroundQueue->spwndCapture ? UserHMGetHandle(ForegroundQueue->spwndCapture) : 0) : 0);
38 }
PUSER_MESSAGE_QUEUE FASTCALL IntGetFocusMessageQueue(VOID)
Definition: desktop.c:1307
#define UserHMGetHandle(obj)
Definition: ntuser.h:222

Referenced by co_IntTranslateAccelerator(), co_MsqInsertMouseMessage(), and IntDefWindowProc().

◆ IntGetThreadFocusWindow()

HWND FASTCALL IntGetThreadFocusWindow ( VOID  )

Definition at line 41 of file focus.c.

42 {
43  PTHREADINFO pti;
44  PUSER_MESSAGE_QUEUE ThreadQueue;
45 
47  ThreadQueue = pti->MessageQueue;
48  if (!ThreadQueue)
49  return NULL;
50  return ThreadQueue->spwndFocus ? UserHMGetHandle(ThreadQueue->spwndFocus) : 0;
51 }
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
#define UserHMGetHandle(obj)
Definition: ntuser.h:222
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:85
#define NULL
Definition: types.h:112

Referenced by IntEnableWindow(), and NtUserGetThreadState().

◆ IntLockSetForegroundWindow()

BOOL FASTCALL IntLockSetForegroundWindow ( UINT  uLockCode)

Definition at line 1567 of file focus.c.

1568 {
1569  ULONG Err = ERROR_ACCESS_DENIED;
1571  switch (uLockCode)
1572  {
1573  case LSFW_LOCK:
1574  if ( CanForceFG(ppi) && !gppiLockSFW )
1575  {
1576  gppiLockSFW = ppi;
1577  return TRUE;
1578  }
1579  break;
1580  case LSFW_UNLOCK:
1581  if ( gppiLockSFW == ppi)
1582  {
1583  gppiLockSFW = NULL;
1584  return TRUE;
1585  }
1586  break;
1587  default:
1589  }
1590  EngSetLastError(Err);
1591  return FALSE;
1592 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define TRUE
Definition: types.h:120
PPROCESSINFO gppiLockSFW
Definition: focus.c:16
#define FALSE
Definition: types.h:117
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
#define NULL
Definition: types.h:112
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
BOOL FASTCALL CanForceFG(PPROCESSINFO ppi)
Definition: focus.c:749
unsigned int ULONG
Definition: retypes.h:1
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28

Referenced by NtUserCallOneParam().

◆ IntReleaseCapture()

BOOL FASTCALL IntReleaseCapture ( VOID  )

Definition at line 1525 of file focus.c.

1526 {
1527  PTHREADINFO pti;
1528  PUSER_MESSAGE_QUEUE ThreadQueue;
1529 
1531  ThreadQueue = pti->MessageQueue;
1532 
1533  // Can not release inside WM_CAPTURECHANGED!!
1534  if (ThreadQueue->QF_flags & QF_CAPTURELOCKED) return FALSE;
1535 
1537 
1538  return TRUE;
1539 }
#define TRUE
Definition: types.h:120
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
#define FALSE
Definition: types.h:117
#define QF_CAPTURELOCKED
Definition: msgqueue.h:111
HWND FASTCALL co_UserSetCapture(HWND hWnd)
Definition: focus.c:1453
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:85
#define NULL
Definition: types.h:112

Referenced by co_UserFreeWindow(), DefWndDoSizeMove(), IntDefWindowProc(), NC_DoButton(), NC_HandleNCRButtonDown(), and NtUserCallNoParam().

◆ IntUserSetActiveWindow()

BOOL FASTCALL IntUserSetActiveWindow ( PWND  ,
BOOL  ,
BOOL  ,
BOOL   
)

◆ UpdateShellHook()

VOID FASTCALL UpdateShellHook ( PWND  )

Definition at line 99 of file focus.c.

100 {
102  return;
103 
104  if ( Window->spwndParent == UserGetDesktopWindow() &&
105  (!(Window->ExStyle & WS_EX_TOOLWINDOW) ||
106  (Window->ExStyle & WS_EX_APPWINDOW)))
107  {
108  // FIXME lParam; The value is TRUE if the window is in full-screen mode, or FALSE otherwise.
109  co_IntShellHookNotify(HSHELL_WINDOWACTIVATED, (WPARAM) UserHMGetHandle(Window), FALSE);
110  }
111  else
112  {
113  co_IntShellHookNotify(HSHELL_WINDOWACTIVATED, 0, FALSE);
114  }
115 }
UINT_PTR WPARAM
Definition: windef.h:207
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
Definition: window.c:28
#define FALSE
Definition: types.h:117
BOOL FASTCALL IntCheckFullscreen(PWND Window)
Definition: focus.c:79
#define UserHMGetHandle(obj)
Definition: ntuser.h:222
PWND FASTCALL UserGetDesktopWindow(VOID)
Definition: desktop.c:1386
VOID co_IntShellHookNotify(WPARAM Message, WPARAM wParam, LPARAM lParam)
Definition: desktop.c:1692
#define WS_EX_APPWINDOW
Definition: winuser.h:383

Referenced by co_IntSendActivateMessages(), co_IntSetForegroundMessageQueue(), co_WinPosSetWindowPos(), and IntActivateWindow().

◆ UserGetActiveWindow()

HWND FASTCALL UserGetActiveWindow ( VOID  )

Definition at line 1424 of file focus.c.

1425 {
1426  PTHREADINFO pti;
1427  PUSER_MESSAGE_QUEUE ThreadQueue;
1428 
1430  ThreadQueue = pti->MessageQueue;
1431  return( ThreadQueue ? (ThreadQueue->spwndActive ? UserHMGetHandle(ThreadQueue->spwndActive) : 0) : 0);
1432 }
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
#define UserHMGetHandle(obj)
Definition: ntuser.h:222
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:85

◆ UserSetActiveWindow()

BOOL FASTCALL UserSetActiveWindow ( PWND  Wnd)

Variable Documentation

◆ gpqForeground

◆ gpqForegroundPrev

◆ ptiLastInput