From 2824238b4d072fb7f97ef602cc409e79220bbcaa Mon Sep 17 00:00:00 2001 From: vmfortress Date: Sat, 30 Oct 2021 14:14:18 -0400 Subject: [PATCH] xcb: added xcb_stop and xcb_initOptions support Added basic functions and the necessary variables for the `.initOptions` and `.stop` items in the capture interface. --- AUTHORS | 1 + host/platform/Linux/capture/XCB/src/xcb.c | 26 +++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/AUTHORS b/AUTHORS index 3e32a293..bab52d79 100644 --- a/AUTHORS +++ b/AUTHORS @@ -55,3 +55,4 @@ vroad <396351+vroad@users.noreply.github.com> (vroad) williamvds (williamvds) SytheZN (SytheZN) RTXUX (RTXUX) +Vincent LaRocca (VMFortress) \ No newline at end of file diff --git a/host/platform/Linux/capture/XCB/src/xcb.c b/host/platform/Linux/capture/XCB/src/xcb.c index e4504892..fd25ced2 100644 --- a/host/platform/Linux/capture/XCB/src/xcb.c +++ b/host/platform/Linux/capture/XCB/src/xcb.c @@ -20,6 +20,7 @@ #include "interface/capture.h" #include "interface/platform.h" +#include "common/option.h" #include "common/debug.h" #include "common/event.h" #include @@ -33,6 +34,7 @@ struct xcb { bool initialized; + bool stop; xcb_connection_t * xcb; xcb_screen_t * xcbScreen; uint32_t seg; @@ -61,6 +63,16 @@ static const char * xcb_getName(void) return "XCB"; } +static void xcb_initOptions(void) +{ + struct Option options[] = + { + {0} + }; + + option_register(options); +} + static bool xcb_create(CaptureGetPointerBuffer getPointerBufferFn, CapturePostPointerBuffer postPointerBufferFn) { DEBUG_ASSERT(!this); @@ -86,6 +98,7 @@ static bool xcb_init(void) lgResetEvent(this->frameEvent); + this->stop = false; this->xcb = xcb_connect(NULL, NULL); if (!this->xcb || xcb_connection_has_error(this->xcb)) { @@ -131,6 +144,17 @@ fail: return false; } +static void xcb_stop(void) +{ + this->stop = true; + + if(this->pointerThread) + { + lgJoinThread(this->pointerThread, NULL); + this->pointerThread = NULL; + } +} + static bool xcb_deinit(void) { DEBUG_ASSERT(this); @@ -232,9 +256,11 @@ struct CaptureInterface Capture_XCB = { .shortName = "XCB", .asyncCapture = true, + .initOptions = xcb_initOptions, .getName = xcb_getName, .create = xcb_create, .init = xcb_init, + .stop = xcb_stop, .deinit = xcb_deinit, .free = xcb_free, .capture = xcb_capture,