2012-05-02 19:29:33 +00:00
|
|
|
/*
|
2003-10-15 20:48:19 +00:00
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
2011-12-14 04:07:06 +00:00
|
|
|
* PROJECT: ReactOS Win32k subsystem
|
2003-10-15 20:48:19 +00:00
|
|
|
* PURPOSE: Caret functions
|
2015-11-10 17:41:55 +00:00
|
|
|
* FILE: win32ss/user/ntuser/caret.c
|
2019-01-20 14:11:54 +00:00
|
|
|
* PROGRAMERS: Thomas Weidenmueller (w3seek@users.sourceforge.net)
|
|
|
|
* Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
|
2003-10-15 20:48:19 +00:00
|
|
|
*/
|
|
|
|
|
2010-04-26 13:58:46 +00:00
|
|
|
#include <win32k.h>
|
2011-08-21 12:38:52 +00:00
|
|
|
DBG_DEFAULT_CHANNEL(UserCaret);
|
2003-10-15 20:48:19 +00:00
|
|
|
|
2005-09-24 02:50:02 +00:00
|
|
|
/* FUNCTIONS *****************************************************************/
|
|
|
|
|
2015-02-13 13:39:57 +00:00
|
|
|
VOID FASTCALL
|
|
|
|
co_IntDrawCaret(PWND pWnd, PTHRDCARETINFO CaretInfo)
|
|
|
|
{
|
|
|
|
HDC hdc, hdcMem;
|
|
|
|
HBITMAP hbmOld;
|
2019-01-20 14:11:54 +00:00
|
|
|
RECT rcClient;
|
2015-02-13 13:39:57 +00:00
|
|
|
BOOL bDone = FALSE;
|
|
|
|
|
2015-05-23 04:43:32 +00:00
|
|
|
if (pWnd == NULL)
|
|
|
|
{
|
|
|
|
TRACE("Null Window!\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-01-20 14:11:54 +00:00
|
|
|
hdc = UserGetDCEx(pWnd, NULL, DCX_USESTYLE);
|
2015-02-13 13:39:57 +00:00
|
|
|
if (!hdc)
|
|
|
|
{
|
|
|
|
ERR("GetDC failed\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pWnd->hrgnUpdate)
|
|
|
|
{
|
|
|
|
NtGdiSaveDC(hdc);
|
|
|
|
}
|
|
|
|
|
2019-01-20 14:11:54 +00:00
|
|
|
IntGetClientRect(pWnd, &rcClient);
|
|
|
|
NtGdiIntersectClipRect(hdc,
|
|
|
|
rcClient.left,
|
|
|
|
rcClient.top,
|
|
|
|
rcClient.right,
|
|
|
|
rcClient.bottom);
|
|
|
|
|
2015-03-10 00:12:41 +00:00
|
|
|
if (CaretInfo->Bitmap)
|
2015-02-13 13:39:57 +00:00
|
|
|
{
|
2017-01-09 21:12:00 +00:00
|
|
|
if (!GreGetBitmapDimension(CaretInfo->Bitmap, &CaretInfo->Size))
|
2015-03-10 00:12:41 +00:00
|
|
|
{
|
|
|
|
ERR("Failed to get bitmap dimensions\n");
|
2017-01-09 21:12:00 +00:00
|
|
|
goto cleanup;
|
2015-03-10 00:12:41 +00:00
|
|
|
}
|
|
|
|
|
2015-02-13 13:39:57 +00:00
|
|
|
hdcMem = NtGdiCreateCompatibleDC(hdc);
|
|
|
|
if (hdcMem)
|
|
|
|
{
|
|
|
|
hbmOld = NtGdiSelectBitmap(hdcMem, CaretInfo->Bitmap);
|
|
|
|
bDone = NtGdiBitBlt(hdc,
|
|
|
|
CaretInfo->Pos.x,
|
|
|
|
CaretInfo->Pos.y,
|
|
|
|
CaretInfo->Size.cx,
|
|
|
|
CaretInfo->Size.cy,
|
|
|
|
hdcMem,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
SRCINVERT,
|
|
|
|
0,
|
|
|
|
0);
|
|
|
|
NtGdiSelectBitmap(hdcMem, hbmOld);
|
|
|
|
GreDeleteObject(hdcMem);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!bDone)
|
|
|
|
{
|
|
|
|
NtGdiPatBlt(hdc,
|
|
|
|
CaretInfo->Pos.x,
|
|
|
|
CaretInfo->Pos.y,
|
|
|
|
CaretInfo->Size.cx,
|
|
|
|
CaretInfo->Size.cy,
|
|
|
|
DSTINVERT);
|
|
|
|
}
|
|
|
|
|
2017-01-09 21:12:00 +00:00
|
|
|
cleanup:
|
2015-02-13 13:39:57 +00:00
|
|
|
if (pWnd->hrgnUpdate)
|
|
|
|
{
|
|
|
|
NtGdiRestoreDC(hdc, -1);
|
|
|
|
}
|
|
|
|
|
|
|
|
UserReleaseDC(pWnd, hdc, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
|
|
|
CALLBACK
|
|
|
|
CaretSystemTimerProc(HWND hwnd,
|
|
|
|
UINT uMsg,
|
|
|
|
UINT_PTR idEvent,
|
|
|
|
DWORD dwTime)
|
|
|
|
{
|
|
|
|
PTHREADINFO pti;
|
|
|
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
|
|
|
PWND pWnd;
|
|
|
|
|
|
|
|
pti = PsGetCurrentThreadWin32Thread();
|
|
|
|
ThreadQueue = pti->MessageQueue;
|
2015-03-10 00:12:41 +00:00
|
|
|
|
2015-10-24 15:46:34 +00:00
|
|
|
if (ThreadQueue->CaretInfo.hWnd != hwnd)
|
2015-02-13 13:39:57 +00:00
|
|
|
{
|
2015-05-23 07:19:50 +00:00
|
|
|
TRACE("Not the same caret window!\n");
|
2015-02-13 13:39:57 +00:00
|
|
|
return;
|
|
|
|
}
|
2015-03-10 00:12:41 +00:00
|
|
|
|
2015-02-13 13:39:57 +00:00
|
|
|
if (hwnd)
|
|
|
|
{
|
|
|
|
pWnd = UserGetWindowObject(hwnd);
|
|
|
|
if (!pWnd)
|
|
|
|
{
|
|
|
|
ERR("Caret System Timer Proc has invalid window handle! %p Id: %u\n", hwnd, idEvent);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
TRACE( "Windowless Caret Timer Running!\n" );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (idEvent)
|
|
|
|
{
|
|
|
|
case IDCARETTIMER:
|
|
|
|
{
|
2015-10-24 15:46:34 +00:00
|
|
|
ThreadQueue->CaretInfo.Showing = (ThreadQueue->CaretInfo.Showing ? 0 : 1);
|
|
|
|
co_IntDrawCaret(pWnd, &ThreadQueue->CaretInfo);
|
2015-02-13 13:39:57 +00:00
|
|
|
}
|
|
|
|
}
|
2015-03-10 00:12:41 +00:00
|
|
|
return;
|
2015-02-13 13:39:57 +00:00
|
|
|
}
|
|
|
|
|
2005-09-24 02:50:02 +00:00
|
|
|
static
|
2003-10-17 20:31:56 +00:00
|
|
|
BOOL FASTCALL
|
2005-09-05 21:19:23 +00:00
|
|
|
co_IntHideCaret(PTHRDCARETINFO CaretInfo)
|
2003-10-17 20:31:56 +00:00
|
|
|
{
|
2010-10-23 05:36:12 +00:00
|
|
|
PWND pWnd;
|
2005-09-07 21:25:42 +00:00
|
|
|
if(CaretInfo->hWnd && CaretInfo->Visible && CaretInfo->Showing)
|
|
|
|
{
|
2010-10-23 05:36:12 +00:00
|
|
|
pWnd = UserGetWindowObject(CaretInfo->hWnd);
|
2005-09-07 21:25:42 +00:00
|
|
|
CaretInfo->Showing = 0;
|
2015-02-13 13:39:57 +00:00
|
|
|
|
2015-03-28 17:37:44 +00:00
|
|
|
co_IntDrawCaret(pWnd, CaretInfo);
|
2010-10-23 05:36:12 +00:00
|
|
|
IntNotifyWinEvent(EVENT_OBJECT_HIDE, pWnd, OBJID_CARET, CHILDID_SELF, 0);
|
2005-09-07 21:25:42 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
2003-10-17 20:31:56 +00:00
|
|
|
}
|
|
|
|
|
2003-10-16 22:07:37 +00:00
|
|
|
BOOL FASTCALL
|
2008-10-16 17:52:38 +00:00
|
|
|
co_IntDestroyCaret(PTHREADINFO Win32Thread)
|
2003-10-16 22:07:37 +00:00
|
|
|
{
|
2005-09-07 21:25:42 +00:00
|
|
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
2010-10-23 05:36:12 +00:00
|
|
|
PWND pWnd;
|
2015-10-24 15:46:34 +00:00
|
|
|
ThreadQueue = Win32Thread->MessageQueue;
|
2005-09-07 21:25:42 +00:00
|
|
|
|
2015-10-24 15:46:34 +00:00
|
|
|
if (!ThreadQueue)
|
2005-09-07 21:25:42 +00:00
|
|
|
return FALSE;
|
|
|
|
|
2015-10-24 15:46:34 +00:00
|
|
|
pWnd = ValidateHwndNoErr(ThreadQueue->CaretInfo.hWnd);
|
|
|
|
co_IntHideCaret(&ThreadQueue->CaretInfo);
|
|
|
|
ThreadQueue->CaretInfo.Bitmap = (HBITMAP)0;
|
|
|
|
ThreadQueue->CaretInfo.hWnd = (HWND)0;
|
|
|
|
ThreadQueue->CaretInfo.Size.cx = ThreadQueue->CaretInfo.Size.cy = 0;
|
|
|
|
ThreadQueue->CaretInfo.Showing = 0;
|
|
|
|
ThreadQueue->CaretInfo.Visible = 0;
|
2012-08-21 23:25:42 +00:00
|
|
|
if (pWnd)
|
2012-08-18 21:40:49 +00:00
|
|
|
{
|
|
|
|
IntNotifyWinEvent(EVENT_OBJECT_DESTROY, pWnd, OBJID_CARET, CHILDID_SELF, 0);
|
|
|
|
}
|
2005-09-07 21:25:42 +00:00
|
|
|
return TRUE;
|
2003-10-16 22:07:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL FASTCALL
|
|
|
|
IntSetCaretBlinkTime(UINT uMSeconds)
|
|
|
|
{
|
2005-09-07 21:25:42 +00:00
|
|
|
/* Don't save the new value to the registry! */
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2010-06-29 22:13:13 +00:00
|
|
|
gpsi->dtCaretBlink = uMSeconds;
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
return TRUE;
|
2003-11-22 11:49:09 +00:00
|
|
|
}
|
|
|
|
|
2003-10-16 22:07:37 +00:00
|
|
|
BOOL FASTCALL
|
2005-09-05 21:19:23 +00:00
|
|
|
co_IntSetCaretPos(int X, int Y)
|
2003-10-16 22:07:37 +00:00
|
|
|
{
|
2008-10-16 17:52:38 +00:00
|
|
|
PTHREADINFO pti;
|
2010-10-23 05:36:12 +00:00
|
|
|
PWND pWnd;
|
2005-09-07 21:25:42 +00:00
|
|
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
2008-10-16 17:52:38 +00:00
|
|
|
|
|
|
|
pti = PsGetCurrentThreadWin32Thread();
|
|
|
|
ThreadQueue = pti->MessageQueue;
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2015-10-24 15:46:34 +00:00
|
|
|
if(ThreadQueue->CaretInfo.hWnd)
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
2015-10-24 15:46:34 +00:00
|
|
|
pWnd = UserGetWindowObject(ThreadQueue->CaretInfo.hWnd);
|
|
|
|
if(ThreadQueue->CaretInfo.Pos.x != X || ThreadQueue->CaretInfo.Pos.y != Y)
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
2015-10-24 15:46:34 +00:00
|
|
|
co_IntHideCaret(&ThreadQueue->CaretInfo);
|
|
|
|
ThreadQueue->CaretInfo.Pos.x = X;
|
|
|
|
ThreadQueue->CaretInfo.Pos.y = Y;
|
2019-12-26 10:08:01 +00:00
|
|
|
if (ThreadQueue->CaretInfo.Visible)
|
|
|
|
{
|
|
|
|
ThreadQueue->CaretInfo.Showing = 1;
|
|
|
|
co_IntDrawCaret(pWnd, &ThreadQueue->CaretInfo);
|
|
|
|
}
|
2015-02-13 13:39:57 +00:00
|
|
|
|
|
|
|
IntSetTimer(pWnd, IDCARETTIMER, gpsi->dtCaretBlink, CaretSystemTimerProc, TMRF_SYSTEM);
|
2010-10-23 05:36:12 +00:00
|
|
|
IntNotifyWinEvent(EVENT_OBJECT_LOCATIONCHANGE, pWnd, OBJID_CARET, CHILDID_SELF, 0);
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
2003-10-16 22:07:37 +00:00
|
|
|
|
2005-09-07 21:25:42 +00:00
|
|
|
return FALSE;
|
2003-10-16 22:07:37 +00:00
|
|
|
}
|
|
|
|
|
2023-02-14 01:57:25 +00:00
|
|
|
/* Win: zzzHideCaret */
|
2010-10-11 03:41:41 +00:00
|
|
|
BOOL FASTCALL co_UserHideCaret(PWND Window OPTIONAL)
|
2005-09-24 02:50:02 +00:00
|
|
|
{
|
2008-10-16 17:52:38 +00:00
|
|
|
PTHREADINFO pti;
|
2005-09-24 02:50:02 +00:00
|
|
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
|
|
|
|
|
|
|
if (Window) ASSERT_REFS_CO(Window);
|
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
if(Window && Window->head.pti->pEThread != PsGetCurrentThread())
|
2005-09-24 02:50:02 +00:00
|
|
|
{
|
2010-12-25 11:01:14 +00:00
|
|
|
EngSetLastError(ERROR_ACCESS_DENIED);
|
2005-09-24 02:50:02 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2008-10-16 17:52:38 +00:00
|
|
|
pti = PsGetCurrentThreadWin32Thread();
|
|
|
|
ThreadQueue = pti->MessageQueue;
|
2005-09-24 02:50:02 +00:00
|
|
|
|
2024-01-05 00:16:44 +00:00
|
|
|
if(Window && ThreadQueue->CaretInfo.hWnd != UserHMGetHandle(Window))
|
2005-09-24 02:50:02 +00:00
|
|
|
{
|
2010-12-25 11:01:14 +00:00
|
|
|
EngSetLastError(ERROR_ACCESS_DENIED);
|
2005-09-24 02:50:02 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2015-10-24 15:46:34 +00:00
|
|
|
if(ThreadQueue->CaretInfo.Visible)
|
2005-09-24 02:50:02 +00:00
|
|
|
{
|
2015-10-24 15:46:34 +00:00
|
|
|
PWND pwnd = UserGetWindowObject(ThreadQueue->CaretInfo.hWnd);
|
2012-05-02 19:29:33 +00:00
|
|
|
IntKillTimer(pwnd, IDCARETTIMER, TRUE);
|
2005-09-24 02:50:02 +00:00
|
|
|
|
2015-10-24 15:46:34 +00:00
|
|
|
co_IntHideCaret(&ThreadQueue->CaretInfo);
|
|
|
|
ThreadQueue->CaretInfo.Visible = 0;
|
|
|
|
ThreadQueue->CaretInfo.Showing = 0;
|
2005-09-24 02:50:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2023-02-14 01:57:25 +00:00
|
|
|
/* Win: zzzShowCaret */
|
2010-10-11 03:41:41 +00:00
|
|
|
BOOL FASTCALL co_UserShowCaret(PWND Window OPTIONAL)
|
2005-09-24 02:50:02 +00:00
|
|
|
{
|
2008-10-16 17:52:38 +00:00
|
|
|
PTHREADINFO pti;
|
2005-09-24 02:50:02 +00:00
|
|
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
2012-08-18 21:40:49 +00:00
|
|
|
PWND pWnd = NULL;
|
2005-09-24 02:50:02 +00:00
|
|
|
|
|
|
|
if (Window) ASSERT_REFS_CO(Window);
|
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
if(Window && Window->head.pti->pEThread != PsGetCurrentThread())
|
2005-09-24 02:50:02 +00:00
|
|
|
{
|
2010-12-25 11:01:14 +00:00
|
|
|
EngSetLastError(ERROR_ACCESS_DENIED);
|
2005-09-24 02:50:02 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2008-10-16 17:52:38 +00:00
|
|
|
pti = PsGetCurrentThreadWin32Thread();
|
|
|
|
ThreadQueue = pti->MessageQueue;
|
2005-09-24 02:50:02 +00:00
|
|
|
|
2024-01-05 00:16:44 +00:00
|
|
|
if(Window && ThreadQueue->CaretInfo.hWnd != UserHMGetHandle(Window))
|
2005-09-24 02:50:02 +00:00
|
|
|
{
|
2010-12-25 11:01:14 +00:00
|
|
|
EngSetLastError(ERROR_ACCESS_DENIED);
|
2005-09-24 02:50:02 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2015-10-24 15:46:34 +00:00
|
|
|
if (!ThreadQueue->CaretInfo.Visible)
|
2005-09-24 02:50:02 +00:00
|
|
|
{
|
2015-10-24 15:46:34 +00:00
|
|
|
ThreadQueue->CaretInfo.Visible = 1;
|
|
|
|
pWnd = ValidateHwndNoErr(ThreadQueue->CaretInfo.hWnd);
|
|
|
|
if (!ThreadQueue->CaretInfo.Showing && pWnd)
|
2005-09-24 02:50:02 +00:00
|
|
|
{
|
2010-10-23 05:36:12 +00:00
|
|
|
IntNotifyWinEvent(EVENT_OBJECT_SHOW, pWnd, OBJID_CARET, OBJID_CARET, 0);
|
2005-09-24 02:50:02 +00:00
|
|
|
}
|
2022-01-14 19:32:52 +00:00
|
|
|
if ((INT)gpsi->dtCaretBlink > 0)
|
|
|
|
{
|
|
|
|
IntSetTimer(pWnd, IDCARETTIMER, gpsi->dtCaretBlink, CaretSystemTimerProc, TMRF_SYSTEM);
|
|
|
|
}
|
|
|
|
else if (ThreadQueue->CaretInfo.Visible)
|
|
|
|
{
|
|
|
|
ThreadQueue->CaretInfo.Showing = 1;
|
|
|
|
co_IntDrawCaret(pWnd, &ThreadQueue->CaretInfo);
|
|
|
|
}
|
2005-09-24 02:50:02 +00:00
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
2003-10-17 20:31:56 +00:00
|
|
|
|
2005-09-24 02:50:02 +00:00
|
|
|
/* SYSCALLS *****************************************************************/
|
2003-10-16 22:07:37 +00:00
|
|
|
|
2003-10-15 20:48:19 +00:00
|
|
|
BOOL
|
2008-11-29 22:48:58 +00:00
|
|
|
APIENTRY
|
2003-10-15 20:48:19 +00:00
|
|
|
NtUserCreateCaret(
|
2005-09-07 21:25:42 +00:00
|
|
|
HWND hWnd,
|
|
|
|
HBITMAP hBitmap,
|
|
|
|
int nWidth,
|
|
|
|
int nHeight)
|
2003-10-15 20:48:19 +00:00
|
|
|
{
|
2010-10-11 03:41:41 +00:00
|
|
|
PWND Window;
|
2008-10-16 17:52:38 +00:00
|
|
|
PTHREADINFO pti;
|
2005-09-07 21:25:42 +00:00
|
|
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
2023-12-21 04:10:46 +00:00
|
|
|
BOOL Ret = FALSE;
|
2005-09-07 21:25:42 +00:00
|
|
|
|
2011-08-21 12:38:52 +00:00
|
|
|
TRACE("Enter NtUserCreateCaret\n");
|
2005-09-07 21:25:42 +00:00
|
|
|
UserEnterExclusive();
|
|
|
|
|
2005-09-08 16:18:51 +00:00
|
|
|
if(!(Window = UserGetWindowObject(hWnd)))
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
2023-12-21 04:10:46 +00:00
|
|
|
goto Exit; // Return FALSE
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
|
|
|
|
2010-10-11 03:41:41 +00:00
|
|
|
if(Window->head.pti->pEThread != PsGetCurrentThread())
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
2010-12-25 11:01:14 +00:00
|
|
|
EngSetLastError(ERROR_ACCESS_DENIED);
|
2023-12-21 04:10:46 +00:00
|
|
|
goto Exit; // Return FALSE
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
|
|
|
|
2008-10-16 17:52:38 +00:00
|
|
|
pti = PsGetCurrentThreadWin32Thread();
|
|
|
|
ThreadQueue = pti->MessageQueue;
|
2005-09-07 21:25:42 +00:00
|
|
|
|
2015-10-24 15:46:34 +00:00
|
|
|
if (ThreadQueue->CaretInfo.Visible)
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
2012-08-18 21:40:49 +00:00
|
|
|
IntKillTimer(Window, IDCARETTIMER, TRUE);
|
2015-10-24 15:46:34 +00:00
|
|
|
co_IntHideCaret(&ThreadQueue->CaretInfo);
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
|
|
|
|
2015-10-24 15:46:34 +00:00
|
|
|
ThreadQueue->CaretInfo.hWnd = hWnd;
|
2005-09-07 21:25:42 +00:00
|
|
|
if(hBitmap)
|
|
|
|
{
|
2015-10-24 15:46:34 +00:00
|
|
|
ThreadQueue->CaretInfo.Bitmap = hBitmap;
|
|
|
|
ThreadQueue->CaretInfo.Size.cx = ThreadQueue->CaretInfo.Size.cy = 0;
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-07-31 17:11:21 +00:00
|
|
|
if (nWidth == 0)
|
|
|
|
{
|
|
|
|
nWidth = UserGetSystemMetrics(SM_CXBORDER);
|
|
|
|
}
|
|
|
|
if (nHeight == 0)
|
|
|
|
{
|
|
|
|
nHeight = UserGetSystemMetrics(SM_CYBORDER);
|
|
|
|
}
|
2015-10-24 15:46:34 +00:00
|
|
|
ThreadQueue->CaretInfo.Bitmap = (HBITMAP)0;
|
|
|
|
ThreadQueue->CaretInfo.Size.cx = nWidth;
|
|
|
|
ThreadQueue->CaretInfo.Size.cy = nHeight;
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
2015-10-24 15:46:34 +00:00
|
|
|
ThreadQueue->CaretInfo.Visible = 0;
|
|
|
|
ThreadQueue->CaretInfo.Showing = 0;
|
2015-02-13 13:39:57 +00:00
|
|
|
|
2022-01-14 19:32:52 +00:00
|
|
|
IntSetTimer(Window, IDCARETTIMER, gpsi->dtCaretBlink, CaretSystemTimerProc, TMRF_SYSTEM);
|
2015-02-13 13:39:57 +00:00
|
|
|
|
2010-10-23 05:36:12 +00:00
|
|
|
IntNotifyWinEvent(EVENT_OBJECT_CREATE, Window, OBJID_CARET, CHILDID_SELF, 0);
|
2015-02-13 13:39:57 +00:00
|
|
|
|
2023-12-21 04:10:46 +00:00
|
|
|
Ret = TRUE;
|
2005-09-05 21:19:23 +00:00
|
|
|
|
2023-12-21 04:10:46 +00:00
|
|
|
Exit:
|
|
|
|
TRACE("Leave NtUserCreateCaret, ret=%i\n", Ret);
|
2005-09-07 21:25:42 +00:00
|
|
|
UserLeave();
|
2023-12-21 04:10:46 +00:00
|
|
|
return Ret;
|
2003-10-15 20:48:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
UINT
|
2008-11-29 22:48:58 +00:00
|
|
|
APIENTRY
|
2003-10-15 20:48:19 +00:00
|
|
|
NtUserGetCaretBlinkTime(VOID)
|
|
|
|
{
|
2012-02-05 20:21:22 +00:00
|
|
|
UINT ret;
|
2005-09-05 21:19:23 +00:00
|
|
|
|
2005-09-08 16:18:51 +00:00
|
|
|
UserEnterShared();
|
2005-09-07 21:25:42 +00:00
|
|
|
|
2012-02-05 20:21:22 +00:00
|
|
|
ret = gpsi->dtCaretBlink;
|
2005-09-07 21:25:42 +00:00
|
|
|
|
2005-09-05 21:19:23 +00:00
|
|
|
UserLeave();
|
2012-02-05 20:21:22 +00:00
|
|
|
|
|
|
|
return ret;
|
2003-10-15 20:48:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BOOL
|
2008-11-29 22:48:58 +00:00
|
|
|
APIENTRY
|
2003-10-15 20:48:19 +00:00
|
|
|
NtUserGetCaretPos(
|
2005-09-07 21:25:42 +00:00
|
|
|
LPPOINT lpPoint)
|
2003-10-15 20:48:19 +00:00
|
|
|
{
|
2008-10-16 17:52:38 +00:00
|
|
|
PTHREADINFO pti;
|
2005-09-07 21:25:42 +00:00
|
|
|
PUSER_MESSAGE_QUEUE ThreadQueue;
|
|
|
|
NTSTATUS Status;
|
2023-12-21 04:10:46 +00:00
|
|
|
BOOL Ret = TRUE;
|
2005-09-05 21:19:23 +00:00
|
|
|
|
2011-08-21 12:38:52 +00:00
|
|
|
TRACE("Enter NtUserGetCaretPos\n");
|
2005-09-07 21:25:42 +00:00
|
|
|
UserEnterShared();
|
|
|
|
|
2008-10-16 17:52:38 +00:00
|
|
|
pti = PsGetCurrentThreadWin32Thread();
|
|
|
|
ThreadQueue = pti->MessageQueue;
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2015-10-24 15:46:34 +00:00
|
|
|
Status = MmCopyToCaller(lpPoint, &ThreadQueue->CaretInfo.Pos, sizeof(POINT));
|
2005-09-07 21:25:42 +00:00
|
|
|
if(!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
SetLastNtError(Status);
|
2023-12-21 04:10:46 +00:00
|
|
|
Ret = FALSE;
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2023-12-21 04:10:46 +00:00
|
|
|
TRACE("Leave NtUserGetCaretPos, ret=%i\n", Ret);
|
2005-09-07 21:25:42 +00:00
|
|
|
UserLeave();
|
2023-12-21 04:10:46 +00:00
|
|
|
return Ret;
|
2003-10-15 20:48:19 +00:00
|
|
|
}
|
|
|
|
|
2005-09-05 21:19:23 +00:00
|
|
|
BOOL
|
2008-11-29 22:48:58 +00:00
|
|
|
APIENTRY
|
2007-07-30 15:08:14 +00:00
|
|
|
NtUserShowCaret(HWND hWnd OPTIONAL)
|
2005-09-05 21:19:23 +00:00
|
|
|
{
|
2010-10-11 03:41:41 +00:00
|
|
|
PWND Window = NULL;
|
2005-10-15 13:22:13 +00:00
|
|
|
USER_REFERENCE_ENTRY Ref;
|
2023-12-21 04:10:46 +00:00
|
|
|
BOOL ret = FALSE;
|
2005-09-07 21:25:42 +00:00
|
|
|
|
2011-08-21 12:38:52 +00:00
|
|
|
TRACE("Enter NtUserShowCaret\n");
|
2005-09-07 21:25:42 +00:00
|
|
|
UserEnterExclusive();
|
|
|
|
|
2005-09-09 00:25:52 +00:00
|
|
|
if(hWnd && !(Window = UserGetWindowObject(hWnd)))
|
2005-09-07 21:25:42 +00:00
|
|
|
{
|
2023-12-21 04:10:46 +00:00
|
|
|
goto Exit; // Return FALSE
|
2005-09-07 21:25:42 +00:00
|
|
|
}
|
|
|
|
|
2005-10-15 13:22:13 +00:00
|
|
|
if (Window) UserRefObjectCo(Window, &Ref);
|
2007-07-30 15:08:14 +00:00
|
|
|
|
|
|
|
ret = co_UserShowCaret(Window);
|
|
|
|
|
2005-09-09 00:25:52 +00:00
|
|
|
if (Window) UserDerefObjectCo(Window);
|
2005-09-08 16:18:51 +00:00
|
|
|
|
2023-12-21 04:10:46 +00:00
|
|
|
Exit:
|
|
|
|
TRACE("Leave NtUserShowCaret, ret=%i\n", ret);
|
2005-09-07 21:25:42 +00:00
|
|
|
UserLeave();
|
2023-12-21 04:10:46 +00:00
|
|
|
return ret;
|
2003-10-15 20:48:19 +00:00
|
|
|
}
|
2007-07-30 15:08:14 +00:00
|
|
|
|
|
|
|
BOOL
|
2008-11-29 22:48:58 +00:00
|
|
|
APIENTRY
|
2007-07-30 15:08:14 +00:00
|
|
|
NtUserHideCaret(HWND hWnd OPTIONAL)
|
|
|
|
{
|
2010-10-11 03:41:41 +00:00
|
|
|
PWND Window = NULL;
|
2007-07-30 15:08:14 +00:00
|
|
|
USER_REFERENCE_ENTRY Ref;
|
2023-12-21 04:10:46 +00:00
|
|
|
BOOL ret = FALSE;
|
2007-07-30 15:08:14 +00:00
|
|
|
|
2011-08-21 12:38:52 +00:00
|
|
|
TRACE("Enter NtUserHideCaret\n");
|
2007-07-30 15:08:14 +00:00
|
|
|
UserEnterExclusive();
|
|
|
|
|
|
|
|
if(hWnd && !(Window = UserGetWindowObject(hWnd)))
|
|
|
|
{
|
2023-12-21 04:10:46 +00:00
|
|
|
goto Exit; // Return FALSE
|
2007-07-30 15:08:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (Window) UserRefObjectCo(Window, &Ref);
|
|
|
|
|
|
|
|
ret = co_UserHideCaret(Window);
|
|
|
|
|
|
|
|
if (Window) UserDerefObjectCo(Window);
|
|
|
|
|
2023-12-21 04:10:46 +00:00
|
|
|
Exit:
|
|
|
|
TRACE("Leave NtUserHideCaret, ret=%i\n", ret);
|
2007-07-30 15:08:14 +00:00
|
|
|
UserLeave();
|
2023-12-21 04:10:46 +00:00
|
|
|
return ret;
|
2007-07-30 15:08:14 +00:00
|
|
|
}
|