Author: mjmartin
Date: Sat Jul 3 12:37:51 2010
New Revision: 47929
URL:
http://svn.reactos.org/svn/reactos?rev=47929&view=rev
Log:
[win32k]
- Remove old win32k timer code.
Modified:
trunk/reactos/subsystems/win32/win32k/include/msgqueue.h
trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c
Modified: trunk/reactos/subsystems/win32/win32k/include/msgqueue.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/msgqueue.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/msgqueue.h [iso-8859-1] Sat Jul 3
12:37:51 2010
@@ -42,16 +42,6 @@
LIST_ENTRY ListEntry;
} USER_SENT_MESSAGE_NOTIFY, *PUSER_SENT_MESSAGE_NOTIFY;
-typedef struct _TIMER_ENTRY{
- LIST_ENTRY ListEntry;
- LARGE_INTEGER ExpiryTime;
- HWND Wnd;
- UINT_PTR IDEvent;
- UINT Period;
- TIMERPROC TimerFunc;
- UINT Msg;
-} TIMER_ENTRY, *PTIMER_ENTRY;
-
typedef struct _USER_MESSAGE_QUEUE
{
/* Reference counter, only access this variable with interlocked functions! */
@@ -67,8 +57,6 @@
LIST_ENTRY NotifyMessagesListHead;
/* Queue for hardware messages for the queue. */
LIST_ENTRY HardwareMessagesListHead;
- /* List of timers, sorted on expiry time (earliest first) */
- LIST_ENTRY TimerListHead;
/* Lock for the hardware message list. */
KMUTEX HardwareLock;
/* Pointer to the current WM_MOUSEMOVE message */
@@ -280,24 +268,6 @@
BOOL FASTCALL
IntMsqClearWakeMask(VOID);
-BOOLEAN FASTCALL
-MsqSetTimer(PUSER_MESSAGE_QUEUE MessageQueue, HWND Wnd,
- UINT_PTR IDEvent, UINT Period, TIMERPROC TimerFunc,
- UINT Msg);
-BOOLEAN FASTCALL
-MsqKillTimer(PUSER_MESSAGE_QUEUE MessageQueue, HWND Wnd,
- UINT_PTR IDEvent, UINT Msg);
-BOOLEAN FASTCALL
-MsqGetTimerMessage(PUSER_MESSAGE_QUEUE MessageQueue,
- PWINDOW_OBJECT WindowFilter, UINT MsgFilterMin, UINT MsgFilterMax,
- MSG *Msg, BOOLEAN Restart);
-BOOLEAN FASTCALL
-MsqGetFirstTimerExpiry(PUSER_MESSAGE_QUEUE MessageQueue,
- PWINDOW_OBJECT WndFilter, UINT MsgFilterMin, UINT MsgFilterMax,
- PLARGE_INTEGER FirstTimerExpiry);
-VOID FASTCALL
-MsqRemoveTimersWindow(PUSER_MESSAGE_QUEUE MessageQueue, HWND Wnd);
-
static __inline LONG
MsqCalculateMessageTime(IN PLARGE_INTEGER TickCount)
{
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] Sat Jul 3
12:37:51 2010
@@ -50,7 +50,6 @@
static KEVENT HardwareMessageEvent;
static PAGED_LOOKASIDE_LIST MessageLookasideList;
-static PAGED_LOOKASIDE_LIST TimerLookasideList;
#define IntLockSystemMessageQueue(OldIrql) \
KeAcquireSpinLock(&SystemMessageQueueLock, &OldIrql)
@@ -157,13 +156,6 @@
sizeof(USER_MESSAGE),
TAG_USRMSG,
256);
- ExInitializePagedLookasideList(&TimerLookasideList,
- NULL,
- NULL,
- 0,
- sizeof(TIMER_ENTRY),
- TAG_TIMER,
- 64);
return(STATUS_SUCCESS);
}
@@ -1427,7 +1419,6 @@
InitializeListHead(&MessageQueue->PostedMessagesListHead);
InitializeListHead(&MessageQueue->SentMessagesListHead);
InitializeListHead(&MessageQueue->HardwareMessagesListHead);
- InitializeListHead(&MessageQueue->TimerListHead);
InitializeListHead(&MessageQueue->DispatchingMessagesHead);
InitializeListHead(&MessageQueue->LocalDispatchingMessagesHead);
KeInitializeMutex(&MessageQueue->HardwareLock, 0);
@@ -1466,7 +1457,6 @@
{
PLIST_ENTRY CurrentEntry;
PUSER_MESSAGE CurrentMessage;
- PTIMER_ENTRY CurrentTimer;
PUSER_SENT_MESSAGE CurrentSentMessage;
/* cleanup posted messages */
@@ -1516,14 +1506,6 @@
/* free the message */
ExFreePool(CurrentSentMessage);
- }
-
- /* cleanup timers */
- while (! IsListEmpty(&MessageQueue->TimerListHead))
- {
- CurrentEntry = RemoveHeadList(&MessageQueue->TimerListHead);
- CurrentTimer = CONTAINING_RECORD(CurrentEntry, TIMER_ENTRY, ListEntry);
- ExFreeToPagedLookasideList(&TimerLookasideList, CurrentTimer);
}
/* notify senders of dispatching messages. This needs to be cleaned up if e.g.
@@ -1712,290 +1694,4 @@
return NULL;
}
-#ifndef NDEBUG
-static VOID FASTCALL
-DumpTimerList(PUSER_MESSAGE_QUEUE MessageQueue)
-{
- PLIST_ENTRY Current;
- PTIMER_ENTRY Timer;
-
- Current = MessageQueue->TimerListHead.Flink;
- if (Current == &MessageQueue->TimerListHead)
- {
- DPRINT("timer list is empty for queue %p\n", MessageQueue);
- }
- while (Current != &MessageQueue->TimerListHead)
- {
- Timer = CONTAINING_RECORD(Current, TIMER_ENTRY, ListEntry);
- DPRINT("queue %p timer %p expiry %I64d wnd %x id %p period %u timerproc %p msg
%u\n",
- MessageQueue, Timer, Timer->ExpiryTime.QuadPart, Timer->Wnd,
Timer->IDEvent,
- Timer->Period, Timer->TimerFunc, Timer->Msg);
- Current = Current->Flink;
- }
-}
-#endif /* ! defined(NDEBUG) */
-
-/* Must have the message queue locked while calling this */
-static VOID FASTCALL
-InsertTimer(PUSER_MESSAGE_QUEUE MessageQueue, PTIMER_ENTRY NewTimer)
-{
- PLIST_ENTRY Current;
-
- Current = MessageQueue->TimerListHead.Flink;
- while (Current != &MessageQueue->TimerListHead)
- {
- if (NewTimer->ExpiryTime.QuadPart <
- CONTAINING_RECORD(Current, TIMER_ENTRY, ListEntry)->ExpiryTime.QuadPart)
- {
- break;
- }
- Current = Current->Flink;
- }
-
- InsertTailList(Current, &NewTimer->ListEntry);
-}
-
-/* Must have the message queue locked while calling this */
-static PTIMER_ENTRY FASTCALL
-RemoveTimer(PUSER_MESSAGE_QUEUE MessageQueue, HWND Wnd, UINT_PTR IDEvent, UINT Msg)
-{
- PTIMER_ENTRY Timer;
- PLIST_ENTRY EnumEntry;
-
- /* Remove timer if already in the queue */
- EnumEntry = MessageQueue->TimerListHead.Flink;
- while (EnumEntry != &MessageQueue->TimerListHead)
- {
- Timer = CONTAINING_RECORD(EnumEntry, TIMER_ENTRY, ListEntry);
- EnumEntry = EnumEntry->Flink;
-
- if (Timer->Wnd == Wnd &&
- Timer->IDEvent == IDEvent &&
- Timer->Msg == Msg)
- {
- RemoveEntryList(&Timer->ListEntry);
- return Timer;
- }
- }
-
- return NULL;
-}
-
-BOOLEAN FASTCALL
-MsqSetTimer(PUSER_MESSAGE_QUEUE MessageQueue, HWND Wnd,
- UINT_PTR IDEvent, UINT Period, TIMERPROC TimerFunc,
- UINT Msg)
-{
- PTIMER_ENTRY Timer;
- LARGE_INTEGER CurrentTime;
-
- DPRINT("MsqSetTimer queue %p wnd %x id %p period %u timerproc %p msg %d\n",
- MessageQueue, Wnd, IDEvent, Period, TimerFunc, Msg);
-
- Timer = RemoveTimer(MessageQueue, Wnd, IDEvent, Msg);
- if (NULL == Timer)
- {
- Timer = ExAllocateFromPagedLookasideList(&TimerLookasideList);
- if (NULL == Timer)
- {
- DPRINT1("Failed to allocate timer entry\n");
- return FALSE;
- }
- DPRINT("Allocated new timer entry %p\n", Timer);
- Timer->Wnd = Wnd;
- Timer->IDEvent = IDEvent;
- Timer->Msg = Msg;
- }
- else
- {
- DPRINT("Updating existing timer entry %p\n", Timer);
- }
-
- KeQuerySystemTime(&CurrentTime);
- Timer->ExpiryTime.QuadPart = CurrentTime.QuadPart +
- (ULONGLONG) Period * (ULONGLONG) 10000;
- Timer->Period = Period;
- Timer->TimerFunc = TimerFunc;
- DPRINT("Insert timer now %I64d expiry %I64d\n", CurrentTime.QuadPart,
- Timer->ExpiryTime.QuadPart);
-
- InsertTimer(MessageQueue, Timer);
-
-#ifndef NDEBUG
-
- DumpTimerList(MessageQueue);
-#endif /* ! defined(NDEBUG) */
-
- return TRUE;
-}
-
-BOOLEAN FASTCALL
-MsqKillTimer(PUSER_MESSAGE_QUEUE MessageQueue, HWND Wnd,
- UINT_PTR IDEvent, UINT Msg)
-{
- PTIMER_ENTRY Timer;
-
- DPRINT("MsqKillTimer queue %p wnd %x id %p msg %d\n",
- MessageQueue, Wnd, IDEvent, Msg);
-
- Timer = RemoveTimer(MessageQueue, Wnd, IDEvent, Msg);
-
- if (NULL == Timer)
- {
- DPRINT("Failed to remove timer from list, not found\n");
- }
- else
- {
- ExFreeToPagedLookasideList(&TimerLookasideList, Timer);
- }
-
-#ifndef NDEBUG
- DumpTimerList(MessageQueue);
-#endif /* ! defined(NDEBUG) */
-
- return NULL != Timer;
-}
-
-BOOLEAN FASTCALL
-MsqGetTimerMessage(PUSER_MESSAGE_QUEUE MessageQueue,
- PWINDOW_OBJECT WindowFilter, UINT MsgFilterMin, UINT MsgFilterMax,
- MSG *Msg, BOOLEAN Restart)
-{
- PTIMER_ENTRY Timer;
- LARGE_INTEGER CurrentTime;
- LARGE_INTEGER LargeTickCount;
- PLIST_ENTRY EnumEntry;
- BOOLEAN GotMessage;
-
- DPRINT("MsqGetTimerMessage queue %p msg %p restart %s\n",
- MessageQueue, Msg, Restart ? "TRUE" : "FALSE");
-
- KeQuerySystemTime(&CurrentTime);
- DPRINT("Current time %I64d\n", CurrentTime.QuadPart);
- EnumEntry = MessageQueue->TimerListHead.Flink;
- GotMessage = FALSE;
- while (EnumEntry != &MessageQueue->TimerListHead)
- {
- Timer = CONTAINING_RECORD(MessageQueue->TimerListHead.Flink,
- TIMER_ENTRY, ListEntry);
- DPRINT("Checking timer %p wnd %x expiry %I64d\n", Timer, Timer->Wnd,
- Timer->ExpiryTime.QuadPart);
- EnumEntry = EnumEntry->Flink;
- if ((NULL == WindowFilter || Timer->Wnd == WindowFilter->hSelf) &&
- ((MsgFilterMin == 0 && MsgFilterMax == 0) ||
- (MsgFilterMin <= Timer->Msg &&
- Timer->Msg <= MsgFilterMax)))
- {
- if (Timer->ExpiryTime.QuadPart <= CurrentTime.QuadPart)
- {
- DPRINT("Timer is expired\n");
- GotMessage = TRUE;
- break;
- }
- else
- {
- DPRINT("No need to check later timers\n");
- break;
- }
- }
- else
- {
- DPRINT("timer %p (wnd %x msg %d) failed filter wnd %x msgmin %d msgmax
%d\n",
- Timer, Timer->Wnd, Timer->Msg, WindowFilter->hSelf,
MsgFilterMin, MsgFilterMax);
- }
- }
-
- if (! GotMessage)
- {
- DPRINT("No timer pending\n");
- return FALSE;
- }
-
- Msg->hwnd = Timer->Wnd;
- Msg->message = Timer->Msg;
- Msg->wParam = (WPARAM) Timer->IDEvent;
- Msg->lParam = (LPARAM) Timer->TimerFunc;
- KeQueryTickCount(&LargeTickCount);
- Msg->time = MsqCalculateMessageTime(&LargeTickCount);
- Msg->pt = gpsi->ptCursor;
-
- if (Restart)
- {
- RemoveEntryList(&Timer->ListEntry);
- Timer->ExpiryTime.QuadPart = CurrentTime.QuadPart +
- (ULONGLONG) Timer->Period * (ULONGLONG) 10000;
- DPRINT("Restarting timer %p expires %I64d\n", Timer,
Timer->ExpiryTime.QuadPart);
- InsertTimer(MessageQueue, Timer);
-
-#ifndef NDEBUG
-
- DumpTimerList(MessageQueue);
-#endif /* ! defined(NDEBUG) */
-
- }
-
- DPRINT("Created message wnd %x msg %d wParam %u lParam %u\n", Msg->hwnd,
Msg->message,
- Msg->wParam, Msg->lParam);
-
- return TRUE;
-}
-
-VOID FASTCALL
-MsqRemoveTimersWindow(PUSER_MESSAGE_QUEUE MessageQueue, HWND Wnd)
-{
- PTIMER_ENTRY Timer;
- PLIST_ENTRY EnumEntry;
-
- DPRINT("MsqRemoveTimersWindow queue %p wnd %x\n", MessageQueue, Wnd);
-
- EnumEntry = MessageQueue->TimerListHead.Flink;
- while (EnumEntry != &MessageQueue->TimerListHead)
- {
- Timer = CONTAINING_RECORD(EnumEntry, TIMER_ENTRY, ListEntry);
- EnumEntry = EnumEntry->Flink;
- if (Timer->Wnd == Wnd)
- {
- DPRINT("Removing timer %p because its window is going away\n",
Timer);
- RemoveEntryList(&Timer->ListEntry);
- ExFreeToPagedLookasideList(&TimerLookasideList, Timer);
- }
- }
-
-#ifndef NDEBUG
- DumpTimerList(MessageQueue);
-#endif /* ! defined(NDEBUG) */
-
-}
-
-BOOLEAN FASTCALL
-MsqGetFirstTimerExpiry(PUSER_MESSAGE_QUEUE MessageQueue,
- PWINDOW_OBJECT WndFilter, UINT MsgFilterMin, UINT MsgFilterMax,
- PLARGE_INTEGER FirstTimerExpiry)
-{
- PTIMER_ENTRY Timer;
- PLIST_ENTRY EnumEntry;
-
- DPRINT("MsqGetFirstTimerExpiry queue %p wndfilter %x msgfiltermin %d msgfiltermax
%d expiry %p\n",
- MessageQueue, WndFilter, MsgFilterMin, MsgFilterMax, FirstTimerExpiry);
-
- EnumEntry = MessageQueue->TimerListHead.Flink;
- while (EnumEntry != &MessageQueue->TimerListHead)
- {
- Timer = CONTAINING_RECORD(MessageQueue->TimerListHead.Flink,
- TIMER_ENTRY, ListEntry);
- EnumEntry = EnumEntry->Flink;
- if ((NULL == WndFilter || PtrToInt(WndFilter) == 1 || Timer->Wnd ==
WndFilter->hSelf) &&
- ((MsgFilterMin == 0 && MsgFilterMax == 0) ||
- (MsgFilterMin <= Timer->Msg &&
- Timer->Msg <= MsgFilterMax)))
- {
- *FirstTimerExpiry = Timer->ExpiryTime;
- DPRINT("First timer expires %I64d\n", Timer->ExpiryTime);
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
/* EOF */