From 2301a6f578fdffc6ccc12c59d67217b37cbeac68 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Sun, 8 Feb 2015 16:07:48 -0800 Subject: [PATCH] win-capture: Clarify if statement via inline func Clears up a warning (to prevent && and || confusion), and clarifies what specifically the if statement is trying to accomplish (check to see if the capture is valid) --- plugins/win-capture/game-capture.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plugins/win-capture/game-capture.c b/plugins/win-capture/game-capture.c index 2d7e4af06..3b04a0e75 100644 --- a/plugins/win-capture/game-capture.c +++ b/plugins/win-capture/game-capture.c @@ -943,6 +943,14 @@ static bool start_capture(struct game_capture *gc) return true; } +static inline bool capture_valid(struct game_capture *gc) +{ + if (!gc->dwm_capture && !IsWindow(gc->window)) + return false; + + return !object_signalled(gc->target_process); +} + static void game_capture_tick(void *data, float seconds) { struct game_capture *gc = data; @@ -992,8 +1000,7 @@ static void game_capture_tick(void *data, float seconds) } } } else { - if (!IsWindow(gc->window) && !gc->dwm_capture || - object_signalled(gc->target_process)) { + if (!capture_valid(gc)) { info("capture window no longer exists, " "terminating capture"); stop_capture(gc);