Skip to content

Commit 6b9a77e

Browse files
committed
Added process_pending_events() in the tk::Display class for handling pending events at the main loop start and at the main loop end.
1 parent f6d530c commit 6b9a77e

3 files changed

Lines changed: 28 additions & 9 deletions

File tree

CHANGELOG

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
*******************************************************************************
44

55
=== 1.0.34 ===
6-
6+
* Added process_pending_events() in the tk::Display class for handling pending
7+
events at the main loop start and at the main loop end.
78

89
=== 1.0.33 ===
910
* Fixed widget redrawing atrifacts for some use cases.

include/lsp-plug.in/tk/sys/Display.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Copyright (C) 2025 Linux Studio Plugins Project <https://lsp-plug.in/>
3-
* (C) 2025 Vladimir Sadovnikov <sadko4u@gmail.com>
2+
* Copyright (C) 2026 Linux Studio Plugins Project <https://lsp-plug.in/>
3+
* (C) 2026 Vladimir Sadovnikov <sadko4u@gmail.com>
44
*
55
* This file is part of lsp-tk-lib
66
* Created on: 19 июн. 2017 г.
@@ -126,6 +126,12 @@ namespace lsp
126126
*/
127127
status_t main();
128128

129+
/**
130+
* Process pending events if there are any
131+
* @return status of operation
132+
*/
133+
status_t process_pending_events();
134+
129135
/** Execute one main loop iteration
130136
*
131137
* @return status of operation

src/main/sys/Display.cpp

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Copyright (C) 2025 Linux Studio Plugins Project <https://lsp-plug.in/>
3-
* (C) 2025 Vladimir Sadovnikov <sadko4u@gmail.com>
2+
* Copyright (C) 2026 Linux Studio Plugins Project <https://lsp-plug.in/>
3+
* (C) 2026 Vladimir Sadovnikov <sadko4u@gmail.com>
44
*
55
* This file is part of lsp-tk-lib
66
* Created on: 19 июн. 2017 г.
@@ -278,16 +278,28 @@ namespace lsp
278278
return (pDisplay != NULL) ? pDisplay->wait_events(millis) : STATUS_BAD_STATE;
279279
}
280280

281-
status_t Display::main_iteration()
281+
status_t Display::process_pending_events()
282282
{
283283
if (pDisplay == NULL)
284284
return STATUS_BAD_STATE;
285+
285286
if (!sLock.lock())
286287
return STATUS_UNKNOWN_ERR;
287-
status_t res = pDisplay->main_iteration();
288-
if (!sLock.unlock())
288+
lsp_finally { sLock.unlock(); };
289+
290+
return pDisplay->process_pending_events();
291+
}
292+
293+
status_t Display::main_iteration()
294+
{
295+
if (pDisplay == NULL)
296+
return STATUS_BAD_STATE;
297+
298+
if (!sLock.lock())
289299
return STATUS_UNKNOWN_ERR;
290-
return res;
300+
lsp_finally { sLock.unlock(); };
301+
302+
return pDisplay->main_iteration();
291303
}
292304

293305
void Display::quit_main()

0 commit comments

Comments
 (0)