From 8a49d742e39e278c68fb0486e722358219df88de Mon Sep 17 00:00:00 2001 From: "Serge A. Zaitsev" Date: Mon, 9 Jan 2017 15:51:06 +0200 Subject: [PATCH] added nonblocking mode for windows imeplementation --- tray.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tray.h b/tray.h index f7fbb78..7f8fc23 100644 --- a/tray.h +++ b/tray.h @@ -236,12 +236,17 @@ static int tray_init(struct tray *tray) { static int tray_loop(int blocking) { MSG msg; - if (GetMessage(&msg, NULL, 0, 0)) { - TranslateMessage(&msg); - DispatchMessage(&msg); - return 0; + if (blocking) { + GetMessage(&msg, NULL, 0, 0); + } else { + PeekMessage(&msg, NULL, 0, 0, PM_REMOVE); } - return -1; + if (msg.message == WM_QUIT) { + return -1; + } + TranslateMessage(&msg); + DispatchMessage(&msg); + return 0; } static void tray_update(struct tray *tray) {