ReactOS  0.4.14-dev-998-g623dd26
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)
 

Variables

PUSER_MESSAGE_QUEUE gpqForeground
 
PUSER_MESSAGE_QUEUE gpqForegroundPrev
 
PTHREADINFO ptiLastInput
 

Function Documentation

◆ co_IntMouseActivateWindow()

BOOL FASTCALL co_IntMouseActivateWindow ( PWND  Window)

Definition at line 1136 of file focus.c.

1137 {
1138  TRACE("Mouse Active\n");
1140 }
#define TRUE
Definition: types.h:120
static BOOL FASTCALL co_IntSetForegroundAndFocusWindow(_In_opt_ PWND Wnd, _In_ BOOL MouseActivate, _In_ BOOL bFlash)
Definition: focus.c:812
#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 1432 of file focus.c.

1433 {
1435 
1437 }
#define TRUE
Definition: types.h:120
#define ASSERT_REFS_CO(_obj_)
Definition: userfuncs.h:13
Definition: window.c:28
static BOOL FASTCALL co_IntSetForegroundAndFocusWindow(_In_opt_ PWND Wnd, _In_ BOOL MouseActivate, _In_ BOOL bFlash)
Definition: focus.c:812

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

◆ co_IntSetForegroundWindowMouse()

BOOL FASTCALL co_IntSetForegroundWindowMouse ( PWND  Window)

Definition at line 1443 of file focus.c.

1444 {
1446 
1448 }
#define TRUE
Definition: types.h:120
#define ASSERT_REFS_CO(_obj_)
Definition: userfuncs.h:13
Definition: window.c:28
static BOOL FASTCALL co_IntSetForegroundAndFocusWindow(_In_opt_ PWND Wnd, _In_ BOOL MouseActivate, _In_ BOOL bFlash)
Definition: focus.c:812

Referenced by NC_HandleNCLButtonDown(), and NtUserCallHwndLock().

◆ co_UserSetCapture()

HWND FASTCALL co_UserSetCapture ( HWND  hWnd)

These are HACKS!

Definition at line 1340 of file focus.c.

1341 {
1342  PTHREADINFO pti;
1343  PUSER_MESSAGE_QUEUE ThreadQueue;
1344  PWND pWnd, Window = NULL;
1345  HWND hWndPrev;
1346 
1348  ThreadQueue = pti->MessageQueue;
1349 
1350  if (ThreadQueue->QF_flags & QF_CAPTURELOCKED)
1351  return NULL;
1352 
1353  if (hWnd && (Window = UserGetWindowObject(hWnd)))
1354  {
1355  if (Window->head.pti->MessageQueue != ThreadQueue)
1356  {
1357  ERR("Window Thread does not match Current!\n");
1358  return NULL;
1359  }
1360  }
1361 
1362  hWndPrev = MsqSetStateWindow(pti, MSQ_STATE_CAPTURE, hWnd);
1363 
1364  if (hWndPrev)
1365  {
1366  pWnd = UserGetWindowObject(hWndPrev);
1367  if (pWnd)
1368  IntNotifyWinEvent(EVENT_SYSTEM_CAPTUREEND, pWnd, OBJID_WINDOW, CHILDID_SELF, WEF_SETBYWNDPTI);
1369  }
1370 
1371  if (Window)
1372  IntNotifyWinEvent(EVENT_SYSTEM_CAPTURESTART, Window, OBJID_WINDOW, CHILDID_SELF, WEF_SETBYWNDPTI);
1373 
1374  //
1375  // Only send the message if we have a previous Window!
1376  // Fix msg_menu tracking popup menu and win test_capture_4!!!!
1377  //
1378  if (hWndPrev)
1379  {
1380  if (ThreadQueue->MenuOwner && Window) ThreadQueue->QF_flags |= QF_CAPTURELOCKED;
1381 
1383 
1384  ThreadQueue->QF_flags &= ~QF_CAPTURELOCKED;
1385  }
1386 
1387  if (hWnd == NULL) // Release mode.
1388  {
1389  MOUSEINPUT mi;
1391  /* Also remove other windows if not capturing anymore */
1395  /* Somebody may have missed some mouse movements */
1396  mi.dx = 0;
1397  mi.dy = 0;
1398  mi.mouseData = 0;
1400  mi.time = 0;
1401  mi.dwExtraInfo = 0;
1403  }
1404  return hWndPrev;
1405 }
#define MSQ_STATE_MOVESIZE
Definition: ntuser.h:3548
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:1790
#define OBJID_WINDOW
Definition: winable.h:15
HWND hWnd
Definition: settings.c:17
static MONITORINFO mi
Definition: win.c:7339
Definition: window.c:28
#define QF_CAPTURELOCKED
Definition: msgqueue.h:111
#define CHILDID_SELF
Definition: winable.h:14
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define WEF_SETBYWNDPTI
Definition: ntuser.h:213
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
HWND FASTCALL MsqSetStateWindow(PTHREADINFO pti, ULONG Type, HWND hWnd)
Definition: msgqueue.c:2552
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1284
#define ERR(fmt,...)
Definition: debug.h:109
Definition: ntuser.h:657
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:88
#define MSQ_STATE_CAPTURE
Definition: ntuser.h:3544
#define MOUSEEVENTF_MOVE
Definition: winuser.h:1169
DWORD dwFlags
Definition: winuser.h:3762
#define MSQ_STATE_MENUOWNER
Definition: ntuser.h:3547

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 268 of file focus.c.

269 {
271  PUSER_MESSAGE_QUEUE pmq = pti->MessageQueue;
272 
273  if (Wnd)
274  {
275  Wnd = VerifyWnd(Wnd);
276 
277  if (!Wnd) return;
278 
279  UserRefObjectCo(Wnd, &Ref);
280 
281  if (!gpqForeground)
282  {
283  // No foreground queue set.
284  co_IntSetForegroundMessageQueue( Wnd, pti, (BOOL)Type, 0);
285  }
286  else
287  {
288  // Same Active and Wnd.
289  if ( pmq->spwndActive == Wnd )
290  {
291  WPARAM wParam = (Wnd->head.pti->MessageQueue == gpqForeground);
292 
294 
295  if (wParam)
296  {
297  UpdateShellHook(Wnd);
298 
300  }
301  }
302  else // Not the same, set the active Wnd.
303  {
305  }
306  }
307  UserDerefObjectCo(Wnd);
308  }
309  else // Handle no Wnd!
310  {
311  if ( tid && // TID,
312  pmq->spwndActive && // Active WND not zero,
313  gpqForeground == pmq ) // Same message queues.
314  {
315  Wnd = pmq->spwndActive; // Use active window from current queue.
316 
317  UserRefObjectCo(Wnd, &Ref);
318 
320 
321  UpdateShellHook(Wnd);
322 
324 
325  UserDerefObjectCo(Wnd);
326  }
327  else if (gpqForeground != pmq)
328  {
329  // Not the same message queue so clear flags for foreground switching.
330  pti->TIF_flags &= ~TIF_ALLOWFOREGROUNDACTIVATE;
331  pti->ppi->W32PF_flags &= ~W32PF_ALLOWFOREGROUNDACTIVATE;
332  }
333  }
334 }
PUSER_MESSAGE_QUEUE gpqForeground
Definition: focus.c:12
#define TRUE
Definition: types.h:120
BOOL FASTCALL co_IntSetActiveWindow(_In_ PWND Wnd, _In_ BOOL bMouse, _In_ BOOL bFocus, _In_ BOOL Async)
Definition: focus.c:912
Type
Definition: Type.h:6
BOOLEAN FASTCALL co_WinPosSetWindowPos(PWND Window, HWND WndInsertAfter, INT x, INT y, INT cx, INT cy, UINT flags)
Definition: winpos.c:1720
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:25
#define HWND_TOP
Definition: winuser.h:1193
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:1670
unsigned int BOOL
Definition: ntddk_ex.h:94
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:38
Definition: object.h:3
#define TIF_ALLOWFOREGROUNDACTIVATE
Definition: ntuser.h:245
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
BOOL FASTCALL co_IntSetForegroundMessageQueue(_In_opt_ PWND Wnd, _In_ PTHREADINFO pti, _In_ BOOL MouseActivate, _In_ DWORD Type)
Definition: focus.c:655
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1284
#define SWP_NOSIZE
Definition: winuser.h:1230
#define SWP_NOMOVE
Definition: winuser.h:1229
PWND FASTCALL VerifyWnd(PWND pWnd)
Definition: window.c:64
static TfClientId tid
VOID FASTCALL UpdateShellHook(PWND Window)
Definition: focus.c:52

Referenced by handle_internal_events().

◆ IntAllowSetForegroundWindow()

BOOL FASTCALL IntAllowSetForegroundWindow ( DWORD  dwProcessId)

Definition at line 1485 of file focus.c.

1486 {
1487  PPROCESSINFO ppi, ppiCur;
1489 
1490  ppi = NULL;
1491  if (dwProcessId != ASFW_ANY)
1492  {
1494  {
1496  return FALSE;
1497  }
1499  if (!ppi)
1500  {
1502  return FALSE;
1503  }
1504  }
1506  if (!CanForceFG(ppiCur))
1507  {
1510  return FALSE;
1511  }
1512  if (dwProcessId == ASFW_ANY)
1513  { // All processes will be enabled to set the foreground window.
1514  //ERR("ptiLastInput is CLEARED!!\n");
1515  ptiLastInput = NULL;
1516  }
1517  else
1518  { // Rule #3, last input event in force.
1519  ERR("ptiLastInput is SET!!\n");
1520  //ptiLastInput = ppi->ptiList; // See CORE-6384 & CORE-7030.
1522  }
1523  return TRUE;
1524 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
PVOID NTAPI PsGetProcessWin32Process(PEPROCESS Process)
Definition: process.c:1193
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
#define ERROR_ACCESS_DENIED
Definition: compat.h:87
smooth NULL
Definition: ftsmooth.c:416
PTHREADINFO ptiLastInput
Definition: focus.c:17
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define UlongToHandle(ul)
Definition: basetsd.h:97
NTSTATUS NTAPI PsLookupProcessByProcessId(IN HANDLE ProcessId, OUT PEPROCESS *Process)
Definition: process.c:919
#define ERR(fmt,...)
Definition: debug.h:109
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:637
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

Referenced by NtUserCallOneParam().

◆ IntDeactivateWindow()

BOOL FASTCALL IntDeactivateWindow ( PTHREADINFO  ,
HANDLE   
)

Definition at line 106 of file focus.c.

107 {
109  PTHREADINFO ptiPrev;
110  PWND pwndPrev;
111  BOOL InAAPM = FALSE;
113 
114  if ( !pti->MessageQueue->spwndActive )
115  {
116  TRACE("IDAW E : Nothing to do, Active is NULL! pti 0x%p tid 0x%p\n",pti,tid);
117  return TRUE;
118  }
119 
120  TRACE("IDAW : pti 0x%p tid 0x%p\n",pti,tid);
121 
122  if (ptiCurrent != pti)
123  {
125  IntReferenceThreadInfo(ptiCurrent);
126  }
127 
128  if (!(pti->TIF_flags & TIF_INACTIVATEAPPMSG) )
129  {
130  pti->TIF_flags |= TIF_INACTIVATEAPPMSG;
131  InAAPM = TRUE;
132  }
133 
134  //
135  // Check for Capture and release it.
136  //
137  if ( pti->MessageQueue->spwndCapture )
138  {
139  MSG msg;
140  PWND pwndCapture = pti->MessageQueue->spwndCapture;
141 
142  UserRefObjectCo(pwndCapture, &Ref);
143  co_IntSendMessage(UserHMGetHandle(pwndCapture), WM_CANCELMODE, 0, 0);
144  UserDerefObjectCo(pwndCapture);
145 
146  /* Generate mouse move message */
147  msg.message = WM_MOUSEMOVE;
148  msg.wParam = UserGetMouseButtonsState();
149  msg.lParam = MAKELPARAM(gpsi->ptCursor.x, gpsi->ptCursor.y);
150  msg.pt = gpsi->ptCursor;
152  }
153 
154  //
155  // Check for Active and release it.
156  //
157  if ( pti->MessageQueue->spwndActive )
158  {
159  pwndPrev = pti->MessageQueue->spwndActive;
160  ptiPrev = pwndPrev->head.pti;
161 
163  {
164  if (InAAPM) pti->TIF_flags &= ~TIF_INACTIVATEAPPMSG;
165  if (ptiCurrent != pti)
166  {
168  IntDereferenceThreadInfo(ptiCurrent);
169  }
170  return FALSE;
171  }
172 
173  if ( pti->MessageQueue->spwndActive == pwndPrev )
174  {
175  pti->MessageQueue->spwndActivePrev = pwndPrev;
176  pti->MessageQueue->spwndActive = NULL;
177  }
178 
179  if (ptiPrev->TIF_flags & TIF_INCLEANUP) ptiPrev = NULL;
180  }
181  else
182  {
183  ptiPrev = pti;
184  pwndPrev = (PWND)-1; // Avoid zero Active window.
185  }
186 
187  if ( ptiPrev )
188  {
189  HANDLE OldTID = PsGetThreadId(ptiPrev->pEThread);
190  PWND cWindow;
191  HWND *List, *phWnd;
192 
194  if ( List )
195  {
196  if ( OldTID )
197  {
198  for (phWnd = List; *phWnd; ++phWnd)
199  {
200  cWindow = ValidateHwndNoErr(*phWnd);
201  if ( cWindow && cWindow->head.pti == ptiPrev )
202  { // FALSE if the window is being deactivated,
203  // ThreadId that owns the window being activated.
204  //ERR("IDW : WM_ACTIVATEAPP(0) hwnd %p tid Old %p New %p\n",UserHMGetHandle(cWindow),OldTID,tid);
205  UserRefObjectCo(cWindow, &Ref);
207  UserDerefObjectCo(cWindow);
208  }
209  }
210  }
212  }
213  }
214 
215  //
216  // Now check for a change (Bounce), if Active same as previous window, release it too.
217  //
218  if ( pti->MessageQueue->spwndActive == pwndPrev )
219  {
221  {
222  if (InAAPM) pti->TIF_flags &= ~TIF_INACTIVATEAPPMSG;
223  if (ptiCurrent != pti)
224  {
226  IntDereferenceThreadInfo(ptiCurrent);
227  }
228  return FALSE;
229  }
230 
231  if ( pti->MessageQueue->spwndActive == pwndPrev )
232  {
233  pti->MessageQueue->spwndActivePrev = pwndPrev;
234  pti->MessageQueue->spwndActive = NULL;
235  }
236  }
237 
238  //
239  // Check for Focus and release it.
240  //
241  if ( pti->MessageQueue->spwndFocus )
242  {
243  PWND pwndFocus = pti->MessageQueue->spwndFocus;
244 
245  //
246  // Fix win.c:test_SetForegroundWindow:SetActiveWindow(0)!
247  //
248  pti->MessageQueue->spwndFocus = NULL; // Null out Focus.
249 
250  UserRefObjectCo(pwndFocus, &Ref);
252  UserDerefObjectCo(pwndFocus);
253  }
254 
255  if (InAAPM) pti->TIF_flags &= ~TIF_INACTIVATEAPPMSG;
256  if (ptiCurrent != pti)
257  {
259  IntDereferenceThreadInfo(ptiCurrent);
260  }
261  return TRUE;
262 }
#define TRUE
Definition: types.h:120
VOID FASTCALL co_MsqInsertMouseMessage(MSG *Msg, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook)
Definition: msgqueue.c:580
PWND FASTCALL ValidateHwndNoErr(HWND hWnd)
Definition: window.c:96
FLONG TIF_flags
Definition: win32.h:94
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define MAKELPARAM(l, h)
Definition: winuser.h:3983
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:25
PSERVERINFO gpsi
Definition: main.c:27
WORD FASTCALL UserGetMouseButtonsState(VOID)
Definition: mouse.c:22
unsigned int BOOL
Definition: ntddk_ex.h:94
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:38
THRDESKHEAD head
Definition: ntuser.h:659
Definition: object.h:3
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define IntReferenceThreadInfo(pti)
Definition: win32.h:163
BOOL FASTCALL co_IntSendDeactivateMessages(HWND hWndPrev, HWND hWnd, BOOL Clear)
Definition: focus.c:69
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
#define TRACE(s)
Definition: solgame.cpp:4
#define WM_KILLFOCUS
Definition: winuser.h:1596
LIST_ENTRY List
Definition: psmgr.c:57
#define TIF_INACTIVATEAPPMSG
Definition: ntuser.h:249
PWND FASTCALL UserGetDesktopWindow(VOID)
Definition: desktop.c:1349
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1284
#define WM_CANCELMODE
Definition: winuser.h:1617
HWND *FASTCALL IntWinListChildren(PWND Window)
Definition: window.c:255
HANDLE NTAPI PsGetThreadId(IN PETHREAD Thread)
Definition: thread.c:705
Definition: ntuser.h:657
struct _WND * PWND
#define WM_ACTIVATEAPP
Definition: winuser.h:1614
#define WM_MOUSEMOVE
Definition: winuser.h:1757
#define msg(x)
Definition: auth_time.c:54
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define USERTAG_WINDOWLIST
Definition: tags.h:297
#define IntDereferenceThreadInfo(pti)
Definition: win32.h:168
static TfClientId tid
#define TIF_INCLEANUP
Definition: ntuser.h:240

Referenced by co_IntSetForegroundMessageQueue(), and handle_internal_events().

◆ IntGetCapture()

HWND APIENTRY IntGetCapture ( VOID  )

Definition at line 1322 of file focus.c.

1323 {
1324  PTHREADINFO pti;
1325  PUSER_MESSAGE_QUEUE ThreadQueue;
1327 
1328  TRACE("Enter IntGetCapture\n");
1329 
1331  ThreadQueue = pti->MessageQueue;
1332  RETURN( ThreadQueue ? (ThreadQueue->spwndCapture ? UserHMGetHandle(ThreadQueue->spwndCapture) : 0) : 0);
1333 
1334 CLEANUP:
1335  TRACE("Leave IntGetCapture, ret=%p\n", _ret_);
1336  END_CLEANUP;
1337 }
#define CLEANUP
Definition: ntuser.h:5
#define RETURN(value)
Definition: ntuser.h:4
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
#define TRACE(s)
Definition: solgame.cpp:4
#define DECLARE_RETURN(type)
Definition: ntuser.h:3
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:88
#define END_CLEANUP
Definition: ntuser.h:6

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

◆ IntGetCaptureWindow()

HWND FASTCALL IntGetCaptureWindow ( VOID  )

Definition at line 32 of file focus.c.

33 {
34  PUSER_MESSAGE_QUEUE ForegroundQueue = IntGetFocusMessageQueue();
35  return ( ForegroundQueue ? (ForegroundQueue->spwndCapture ? UserHMGetHandle(ForegroundQueue->spwndCapture) : 0) : 0);
36 }
PUSER_MESSAGE_QUEUE FASTCALL IntGetFocusMessageQueue(VOID)
Definition: desktop.c:1271
#define UserHMGetHandle(obj)
Definition: ntuser.h:208

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

◆ IntGetThreadFocusWindow()

HWND FASTCALL IntGetThreadFocusWindow ( VOID  )

Definition at line 39 of file focus.c.

40 {
41  PTHREADINFO pti;
42  PUSER_MESSAGE_QUEUE ThreadQueue;
43 
45  ThreadQueue = pti->MessageQueue;
46  if (!ThreadQueue)
47  return NULL;
48  return ThreadQueue->spwndFocus ? UserHMGetHandle(ThreadQueue->spwndFocus) : 0;
49 }
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
smooth NULL
Definition: ftsmooth.c:416
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:88

Referenced by IntEnableWindow(), and NtUserGetThreadState().

◆ IntLockSetForegroundWindow()

BOOL FASTCALL IntLockSetForegroundWindow ( UINT  uLockCode)

Definition at line 1454 of file focus.c.

1455 {
1456  ULONG Err = ERROR_ACCESS_DENIED;
1458  switch (uLockCode)
1459  {
1460  case LSFW_LOCK:
1461  if ( CanForceFG(ppi) && !gppiLockSFW )
1462  {
1463  gppiLockSFW = ppi;
1464  return TRUE;
1465  }
1466  break;
1467  case LSFW_UNLOCK:
1468  if ( gppiLockSFW == ppi)
1469  {
1470  gppiLockSFW = NULL;
1471  return TRUE;
1472  }
1473  break;
1474  default:
1476  }
1477  EngSetLastError(Err);
1478  return FALSE;
1479 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
PPROCESSINFO gppiLockSFW
Definition: focus.c:15
#define ERROR_ACCESS_DENIED
Definition: compat.h:87
smooth NULL
Definition: ftsmooth.c:416
PVOID NTAPI PsGetCurrentProcessWin32Process(VOID)
Definition: process.c:1183
BOOL FASTCALL CanForceFG(PPROCESSINFO ppi)
Definition: focus.c:637
unsigned int ULONG
Definition: retypes.h:1
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

Referenced by NtUserCallOneParam().

◆ IntReleaseCapture()

BOOL FASTCALL IntReleaseCapture ( VOID  )

Definition at line 1412 of file focus.c.

1413 {
1414  PTHREADINFO pti;
1415  PUSER_MESSAGE_QUEUE ThreadQueue;
1416 
1418  ThreadQueue = pti->MessageQueue;
1419 
1420  // Can not release inside WM_CAPTURECHANGED!!
1421  if (ThreadQueue->QF_flags & QF_CAPTURELOCKED) return FALSE;
1422 
1424 
1425  return TRUE;
1426 }
#define TRUE
Definition: types.h:120
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
#define QF_CAPTURELOCKED
Definition: msgqueue.h:111
smooth NULL
Definition: ftsmooth.c:416
HWND FASTCALL co_UserSetCapture(HWND hWnd)
Definition: focus.c:1340
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:88

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 52 of file focus.c.

53 {
54  if ( Window->spwndParent == UserGetDesktopWindow() &&
55  Window->spwndOwner == NULL &&
56  (!(Window->ExStyle & WS_EX_TOOLWINDOW) ||
57  (Window->ExStyle & WS_EX_APPWINDOW)))
58  {
59  // FIXME lParam; The value is TRUE if the window is in full-screen mode, or FALSE otherwise.
60  co_IntShellHookNotify(HSHELL_WINDOWACTIVATED, (WPARAM) UserHMGetHandle(Window), FALSE);
61  }
62  else
63  {
64  co_IntShellHookNotify(HSHELL_WINDOWACTIVATED, 0, FALSE);
65  }
66 }
UINT_PTR WPARAM
Definition: windef.h:207
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
Definition: window.c:28
smooth NULL
Definition: ftsmooth.c:416
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
PWND FASTCALL UserGetDesktopWindow(VOID)
Definition: desktop.c:1349
VOID co_IntShellHookNotify(WPARAM Message, WPARAM wParam, LPARAM lParam)
Definition: desktop.c:1656
#define WS_EX_APPWINDOW
Definition: winuser.h:383

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

◆ UserGetActiveWindow()

HWND FASTCALL UserGetActiveWindow ( VOID  )

Definition at line 1311 of file focus.c.

1312 {
1313  PTHREADINFO pti;
1314  PUSER_MESSAGE_QUEUE ThreadQueue;
1315 
1317  ThreadQueue = pti->MessageQueue;
1318  return( ThreadQueue ? (ThreadQueue->spwndActive ? UserHMGetHandle(ThreadQueue->spwndActive) : 0) : 0);
1319 }
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:88

◆ UserSetActiveWindow()

BOOL FASTCALL UserSetActiveWindow ( PWND  Wnd)

Variable Documentation

◆ gpqForeground

◆ gpqForegroundPrev

◆ ptiLastInput