LCL-GTK2: Filter the messages in function PeekMessage. Issue #41407, patch by Artem Izmaylov.

This commit is contained in:
Juha 2025-02-06 18:12:19 +02:00
parent efe7efbc39
commit 4a8f31afdb

View File

@ -6844,10 +6844,18 @@ function TGtk2WidgetSet.PeekMessage(var lpMsg: TMsg; Handle : HWND;
var
vlItem : TGtkMessageQueueItem;
begin
//TODO Filtering
fMessageQueue.Lock;
try
vlItem := fMessageQueue.FirstMessageItem;
// filtering
while (vlItem <> nil) and (
((Handle <> 0) and (vlItem.Msg^.hwnd <> Handle)) or // filter by handle
((wMsgFilterMin <> 0) and (wMsgFilterMax <> 0) and // filter by message-range
not InRange(vlItem.Msg^.message, wMsgFilterMin, wMsgFilterMax)))
do
vlItem := TGtkMessageQueueItem(vlItem.Next);
Result := vlItem <> nil;
if Result then begin
lpMsg := vlItem.Msg^;