refactor: conform PortalInputCapture to coding standards

This commit is contained in:
sithlord48 2025-06-19 20:49:53 -04:00 committed by Nick Bolton
parent b8124107aa
commit a973d4277c
2 changed files with 130 additions and 137 deletions

View file

@ -27,58 +27,56 @@ enum signals
}; };
PortalInputCapture::PortalInputCapture(EiScreen *screen, IEventQueue *events) PortalInputCapture::PortalInputCapture(EiScreen *screen, IEventQueue *events)
: screen_(screen), : m_screen{screen},
events_(events), m_events{events},
portal_(xdp_portal_new()), m_portal{xdp_portal_new()},
signals_(_N_SIGNALS) m_signals{_N_SIGNALS}
{ {
glib_main_loop_ = g_main_loop_new(nullptr, true); m_glibMainLoop = g_main_loop_new(nullptr, true);
glib_thread_ = new Thread(new TMethodJob<PortalInputCapture>(this, &PortalInputCapture::glib_thread)); m_glibThread = new Thread(new TMethodJob<PortalInputCapture>(this, &PortalInputCapture::glibThread));
auto init_capture_cb = [](gpointer data) -> gboolean { auto init_capture_cb = [](gpointer data) { return static_cast<PortalInputCapture *>(data)->initSession(); };
return static_cast<PortalInputCapture *>(data)->init_input_capture_session();
};
g_idle_add(init_capture_cb, this); g_idle_add(init_capture_cb, this);
} }
PortalInputCapture::~PortalInputCapture() PortalInputCapture::~PortalInputCapture()
{ {
if (g_main_loop_is_running(glib_main_loop_)) if (g_main_loop_is_running(m_glibMainLoop))
g_main_loop_quit(glib_main_loop_); g_main_loop_quit(m_glibMainLoop);
if (glib_thread_) { if (m_glibThread) {
glib_thread_->cancel(); m_glibThread->cancel();
glib_thread_->wait(); m_glibThread->wait();
glib_thread_ = nullptr; m_glibThread = nullptr;
g_main_loop_unref(glib_main_loop_); g_main_loop_unref(m_glibMainLoop);
glib_main_loop_ = nullptr; m_glibMainLoop = nullptr;
} }
if (session_) { if (m_session) {
XdpSession *parent_session = xdp_input_capture_session_get_session(session_); XdpSession *parent_session = xdp_input_capture_session_get_session(m_session);
g_signal_handler_disconnect(G_OBJECT(parent_session), signals_[SESSION_CLOSED]); g_signal_handler_disconnect(G_OBJECT(parent_session), m_signals[SESSION_CLOSED]);
g_signal_handler_disconnect(session_, signals_[DISABLED]); g_signal_handler_disconnect(m_session, m_signals[DISABLED]);
g_signal_handler_disconnect(session_, signals_[ACTIVATED]); g_signal_handler_disconnect(m_session, m_signals[ACTIVATED]);
g_signal_handler_disconnect(session_, signals_[DEACTIVATED]); g_signal_handler_disconnect(m_session, m_signals[DEACTIVATED]);
g_signal_handler_disconnect(session_, signals_[ZONES_CHANGED]); g_signal_handler_disconnect(m_session, m_signals[ZONES_CHANGED]);
g_object_unref(session_); g_object_unref(m_session);
} }
for (auto b : barriers_) { for (auto b : m_barriers) {
g_object_unref(b); g_object_unref(b);
} }
barriers_.clear(); m_barriers.clear();
g_object_unref(portal_); g_object_unref(m_portal);
} }
gboolean PortalInputCapture::timeout_handler() const gboolean PortalInputCapture::timeoutHandler() const
{ {
return true; // keep re-triggering return true; // keep re-triggering
} }
int PortalInputCapture::fake_eis_fd() const int PortalInputCapture::fakeEisFd() const
{ {
auto path = std::getenv("LIBEI_SOCKET"); auto path = std::getenv("LIBEI_SOCKET");
@ -105,17 +103,17 @@ int PortalInputCapture::fake_eis_fd() const
return sock; return sock;
} }
void PortalInputCapture::cb_session_closed(XdpSession *session) void PortalInputCapture::handleSessionClosed(XdpSession *session)
{ {
LOG_ERR("portal input capture session was closed, exiting"); LOG_ERR("portal input capture session was closed, exiting");
g_main_loop_quit(glib_main_loop_); g_main_loop_quit(m_glibMainLoop);
events_->addEvent(EventTypes::Quit); m_events->addEvent(EventTypes::Quit);
g_signal_handler_disconnect(session, signals_[SESSION_CLOSED]); g_signal_handler_disconnect(session, m_signals[SESSION_CLOSED]);
signals_[SESSION_CLOSED] = 0; m_signals[SESSION_CLOSED] = 0;
} }
void PortalInputCapture::cb_init_input_capture_session(GObject *object, GAsyncResult *res) void PortalInputCapture::handleInitSession(GObject *object, GAsyncResult *res)
{ {
LOG_DEBUG("portal input capture session initialized"); LOG_DEBUG("portal input capture session initialized");
g_autoptr(GError) error = nullptr; g_autoptr(GError) error = nullptr;
@ -123,12 +121,12 @@ void PortalInputCapture::cb_init_input_capture_session(GObject *object, GAsyncRe
auto session = xdp_portal_create_input_capture_session_finish(XDP_PORTAL(object), res, &error); auto session = xdp_portal_create_input_capture_session_finish(XDP_PORTAL(object), res, &error);
if (!session) { if (!session) {
LOG_ERR("failed to initialize input capture session, quitting: %s", error->message); LOG_ERR("failed to initialize input capture session, quitting: %s", error->message);
g_main_loop_quit(glib_main_loop_); g_main_loop_quit(m_glibMainLoop);
events_->addEvent(EventTypes::Quit); m_events->addEvent(EventTypes::Quit);
return; return;
} }
session_ = session; m_session = session;
auto fd = xdp_input_capture_session_connect_to_eis(session, &error); auto fd = xdp_input_capture_session_connect_to_eis(session, &error);
if (fd < 0) { if (fd < 0) {
@ -136,43 +134,40 @@ void PortalInputCapture::cb_init_input_capture_session(GObject *object, GAsyncRe
// FIXME: Development hack to avoid having to assemble all parts just for // FIXME: Development hack to avoid having to assemble all parts just for
// testing this code. // testing this code.
fd = fake_eis_fd(); fd = fakeEisFd();
if (fd < 0) { if (fd < 0) {
g_main_loop_quit(glib_main_loop_); g_main_loop_quit(m_glibMainLoop);
events_->addEvent(EventTypes::Quit); m_events->addEvent(EventTypes::Quit);
return; return;
} }
} }
// Socket ownership is transferred to the EiScreen // Socket ownership is transferred to the EiScreen
events_->addEvent(Event(EventTypes::EIConnected, screen_->getEventTarget(), EiScreen::EiConnectInfo::alloc(fd))); m_events->addEvent(Event(EventTypes::EIConnected, m_screen->getEventTarget(), EiScreen::EiConnectInfo::alloc(fd)));
// FIXME: the lambda trick doesn't work here for unknown reasons, we need // FIXME: the lambda trick doesn't work here for unknown reasons, we need
// the static function // the static function
signals_[DISABLED] = g_signal_connect(G_OBJECT(session), "disabled", G_CALLBACK(cb_disabled_cb), this); m_signals[DISABLED] = g_signal_connect(G_OBJECT(session), "disabled", G_CALLBACK(disabled), this);
signals_[ACTIVATED] = g_signal_connect(G_OBJECT(session_), "activated", G_CALLBACK(cb_activated_cb), this); m_signals[ACTIVATED] = g_signal_connect(G_OBJECT(m_session), "activated", G_CALLBACK(activated), this);
signals_[DEACTIVATED] = g_signal_connect(G_OBJECT(session_), "deactivated", G_CALLBACK(cb_deactivated_cb), this); m_signals[DEACTIVATED] = g_signal_connect(G_OBJECT(m_session), "deactivated", G_CALLBACK(deactivated), this);
signals_[ZONES_CHANGED] = m_signals[ZONES_CHANGED] = g_signal_connect(G_OBJECT(m_session), "zones-changed", G_CALLBACK(zonesChanged), this);
g_signal_connect(G_OBJECT(session_), "zones-changed", G_CALLBACK(cb_zones_changed_cb), this);
XdpSession *parent_session = xdp_input_capture_session_get_session(session); XdpSession *parent_session = xdp_input_capture_session_get_session(session);
signals_[SESSION_CLOSED] = m_signals[SESSION_CLOSED] = g_signal_connect(G_OBJECT(parent_session), "closed", G_CALLBACK(sessionClosed), this);
g_signal_connect(G_OBJECT(parent_session), "closed", G_CALLBACK(cb_session_closed_cb), this);
cb_zones_changed(session_, nullptr); handleZonesChanged(m_session, nullptr);
} }
void PortalInputCapture::cb_set_pointer_barriers(const GObject *object, GAsyncResult *res) void PortalInputCapture::handleSetPointerBarriers(const GObject *object, GAsyncResult *res)
{ {
g_autoptr(GError) error = nullptr; g_autoptr(GError) error = nullptr;
auto failed_list = xdp_input_capture_session_set_pointer_barriers_finish(session_, res, &error); auto failed_list = xdp_input_capture_session_set_pointer_barriers_finish(m_session, res, &error);
if (failed_list) { if (failed_list) {
auto it = failed_list; auto it = failed_list;
while (it) { while (it) {
guint id; guint id;
g_object_get(it->data, "id", &id, nullptr); g_object_get(it->data, "id", &id, nullptr);
for (auto elem = m_barriers.begin(); elem != m_barriers.end(); elem++) {
for (auto elem = barriers_.begin(); elem != barriers_.end(); elem++) {
if (*elem == it->data) { if (*elem == it->data) {
int x1; int x1;
int x2; int x2;
@ -183,7 +178,7 @@ void PortalInputCapture::cb_set_pointer_barriers(const GObject *object, GAsyncRe
LOG_WARN("failed to apply barrier %d (%d/%d-%d/%d)", id, x1, y1, x2, y2); LOG_WARN("failed to apply barrier %d (%d/%d-%d/%d)", id, x1, y1, x2, y2);
g_object_unref(*elem); g_object_unref(*elem);
barriers_.erase(elem); m_barriers.erase(elem);
break; break;
} }
} }
@ -195,16 +190,16 @@ void PortalInputCapture::cb_set_pointer_barriers(const GObject *object, GAsyncRe
enable(); enable();
} }
gboolean PortalInputCapture::init_input_capture_session() gboolean PortalInputCapture::initSession()
{ {
LOG_DEBUG("setting up input capture session"); LOG_DEBUG("setting up input capture session");
xdp_portal_create_input_capture_session( xdp_portal_create_input_capture_session(
portal_, m_portal,
nullptr, // parent nullptr, // parent
static_cast<XdpInputCapability>(XDP_INPUT_CAPABILITY_KEYBOARD | XDP_INPUT_CAPABILITY_POINTER), static_cast<XdpInputCapability>(XDP_INPUT_CAPABILITY_KEYBOARD | XDP_INPUT_CAPABILITY_POINTER),
nullptr, // cancellable nullptr, // cancellable
[](GObject *obj, GAsyncResult *res, gpointer data) { [](GObject *obj, GAsyncResult *res, gpointer data) {
static_cast<PortalInputCapture *>(data)->cb_init_input_capture_session(obj, res); static_cast<PortalInputCapture *>(data)->handleInitSession(obj, res);
}, },
this this
); );
@ -214,45 +209,45 @@ gboolean PortalInputCapture::init_input_capture_session()
void PortalInputCapture::enable() void PortalInputCapture::enable()
{ {
if (!enabled_) { if (!m_enabled) {
LOG_DEBUG("enabling the portal input capture session"); LOG_DEBUG("enabling the portal input capture session");
xdp_input_capture_session_enable(session_); xdp_input_capture_session_enable(m_session);
enabled_ = true; m_enabled = true;
} }
} }
void PortalInputCapture::disable() void PortalInputCapture::disable()
{ {
if (enabled_) { if (m_enabled) {
LOG_DEBUG("disabling the portal input capture session"); LOG_DEBUG("disabling the portal input capture session");
xdp_input_capture_session_disable(session_); xdp_input_capture_session_disable(m_session);
enabled_ = false; m_enabled = false;
} }
} }
void PortalInputCapture::release() void PortalInputCapture::release()
{ {
LOG_DEBUG("releasing input capture session, id=%d", activation_id_); LOG_DEBUG("releasing input capture session, id=%d", m_activationId);
xdp_input_capture_session_release(session_, activation_id_); xdp_input_capture_session_release(m_session, m_activationId);
is_active_ = false; m_isActive = false;
} }
void PortalInputCapture::release(double x, double y) void PortalInputCapture::release(double x, double y)
{ {
LOG_DEBUG("releasing input capture session, id=%d x=%.1f y=%.1f", activation_id_, x, y); LOG_DEBUG("releasing input capture session, id=%d x=%.1f y=%.1f", m_activationId, x, y);
xdp_input_capture_session_release_at(session_, activation_id_, x, y); xdp_input_capture_session_release_at(m_session, m_activationId, x, y);
is_active_ = false; m_isActive = false;
} }
void PortalInputCapture::cb_disabled(const XdpInputCaptureSession *session, const GVariant *option) void PortalInputCapture::handleDisabled(const XdpInputCaptureSession *session, const GVariant *option)
{ {
LOG_DEBUG("portal cb disabled"); LOG_DEBUG("portal cb disabled");
if (!enabled_) if (!m_enabled)
return; // Nothing to do return; // Nothing to do
enabled_ = false; m_enabled = false;
is_active_ = false; m_isActive = false;
// FIXME: need some better heuristics here of when we want to enable again // FIXME: need some better heuristics here of when we want to enable again
// But we don't know *why* we got disabled (and it's doubtfull we ever // But we don't know *why* we got disabled (and it's doubtfull we ever
@ -269,40 +264,40 @@ void PortalInputCapture::cb_disabled(const XdpInputCaptureSession *session, cons
); );
} }
void PortalInputCapture::cb_activated( void PortalInputCapture::handleActivated(
const XdpInputCaptureSession *session, std::uint32_t activation_id, GVariant *options const XdpInputCaptureSession *session, std::uint32_t activationId, GVariant *options
) )
{ {
LOG_DEBUG("portal cb activated, id=%d", activation_id); LOG_DEBUG("portal cb activated, id=%d", activationId);
if (options) { if (options) {
gdouble x; gdouble x;
gdouble y; gdouble y;
if (g_variant_lookup(options, "cursor_position", "(dd)", &x, &y)) { if (g_variant_lookup(options, "cursor_position", "(dd)", &x, &y)) {
screen_->warpCursor((int)x, (int)y); m_screen->warpCursor((int)x, (int)y);
} else { } else {
LOG_WARN("failed to get cursor position"); LOG_WARN("failed to get cursor position");
} }
} else { } else {
LOG_WARN("activation has no options"); LOG_WARN("activation has no options");
} }
activation_id_ = activation_id; m_activationId = activationId;
is_active_ = true; m_isActive = true;
} }
void PortalInputCapture::cb_deactivated( void PortalInputCapture::handleDeactivated(
const XdpInputCaptureSession *session, std::uint32_t activation_id, const GVariant *options const XdpInputCaptureSession *session, std::uint32_t activationId, const GVariant *options
) )
{ {
LOG_DEBUG("cb deactivated, id=%i", activation_id); LOG_DEBUG("cb deactivated, id=%i", activationId);
is_active_ = false; m_isActive = false;
} }
void PortalInputCapture::cb_zones_changed(XdpInputCaptureSession *session, GVariant *options) void PortalInputCapture::handleZonesChanged(XdpInputCaptureSession *session, GVariant *options)
{ {
for (auto b : barriers_) for (auto b : m_barriers)
g_object_unref(b); g_object_unref(b);
barriers_.clear(); m_barriers.clear();
auto zones = xdp_input_capture_session_get_zones(session); auto zones = xdp_input_capture_session_get_zones(session);
while (zones != nullptr) { while (zones != nullptr) {
@ -324,67 +319,67 @@ void PortalInputCapture::cb_zones_changed(XdpInputCaptureSession *session, GVari
// the wrong place, we can just install barriers everywhere and let EIS // the wrong place, we can just install barriers everywhere and let EIS
// figure it out. Also a lot easier to implement for now though it doesn't // figure it out. Also a lot easier to implement for now though it doesn't
// cover differently-sized screens... // cover differently-sized screens...
auto id = barriers_.size() + 1; auto id = m_barriers.size() + 1;
x1 = x; x1 = x;
y1 = y; y1 = y;
x2 = x + w - 1; x2 = x + w - 1;
y2 = y; y2 = y;
LOG_DEBUG("barrier (top) %zd at %d,%d-%d,%d", id, x1, y1, x2, y2); LOG_DEBUG("barrier (top) %zd at %d,%d-%d,%d", id, x1, y1, x2, y2);
barriers_.push_back(XDP_INPUT_CAPTURE_POINTER_BARRIER( m_barriers.push_back(XDP_INPUT_CAPTURE_POINTER_BARRIER(
g_object_new(XDP_TYPE_INPUT_CAPTURE_POINTER_BARRIER, "id", id, "x1", x1, "y1", y1, "x2", x2, "y2", y2, nullptr) g_object_new(XDP_TYPE_INPUT_CAPTURE_POINTER_BARRIER, "id", id, "x1", x1, "y1", y1, "x2", x2, "y2", y2, nullptr)
)); ));
id = barriers_.size() + 1; id = m_barriers.size() + 1;
x1 = x + w; x1 = x + w;
y1 = y; y1 = y;
x2 = x + w; x2 = x + w;
y2 = y + h - 1; y2 = y + h - 1;
LOG_DEBUG("barrier (right) %zd at %d,%d-%d,%d", id, x1, y1, x2, y2); LOG_DEBUG("barrier (right) %zd at %d,%d-%d,%d", id, x1, y1, x2, y2);
barriers_.push_back(XDP_INPUT_CAPTURE_POINTER_BARRIER( m_barriers.push_back(XDP_INPUT_CAPTURE_POINTER_BARRIER(
g_object_new(XDP_TYPE_INPUT_CAPTURE_POINTER_BARRIER, "id", id, "x1", x1, "y1", y1, "x2", x2, "y2", y2, nullptr) g_object_new(XDP_TYPE_INPUT_CAPTURE_POINTER_BARRIER, "id", id, "x1", x1, "y1", y1, "x2", x2, "y2", y2, nullptr)
)); ));
id = barriers_.size() + 1; id = m_barriers.size() + 1;
x1 = x; x1 = x;
y1 = y; y1 = y;
x2 = x; x2 = x;
y2 = y + h - 1; y2 = y + h - 1;
LOG_DEBUG("barrier (left) %zd at %d,%d-%d,%d", id, x1, y1, x2, y2); LOG_DEBUG("barrier (left) %zd at %d,%d-%d,%d", id, x1, y1, x2, y2);
barriers_.push_back(XDP_INPUT_CAPTURE_POINTER_BARRIER( m_barriers.push_back(XDP_INPUT_CAPTURE_POINTER_BARRIER(
g_object_new(XDP_TYPE_INPUT_CAPTURE_POINTER_BARRIER, "id", id, "x1", x1, "y1", y1, "x2", x2, "y2", y2, nullptr) g_object_new(XDP_TYPE_INPUT_CAPTURE_POINTER_BARRIER, "id", id, "x1", x1, "y1", y1, "x2", x2, "y2", y2, nullptr)
)); ));
id = barriers_.size() + 1; id = m_barriers.size() + 1;
x1 = x; x1 = x;
y1 = y + h; y1 = y + h;
x2 = x + w - 1; x2 = x + w - 1;
y2 = y + h; y2 = y + h;
LOG_DEBUG("barrier (bottom) %zd at %d,%d-%d,%d", id, x1, y1, x2, y2); LOG_DEBUG("barrier (bottom) %zd at %d,%d-%d,%d", id, x1, y1, x2, y2);
barriers_.push_back(XDP_INPUT_CAPTURE_POINTER_BARRIER( m_barriers.push_back(XDP_INPUT_CAPTURE_POINTER_BARRIER(
g_object_new(XDP_TYPE_INPUT_CAPTURE_POINTER_BARRIER, "id", id, "x1", x1, "y1", y1, "x2", x2, "y2", y2, nullptr) g_object_new(XDP_TYPE_INPUT_CAPTURE_POINTER_BARRIER, "id", id, "x1", x1, "y1", y1, "x2", x2, "y2", y2, nullptr)
)); ));
zones = zones->next; zones = zones->next;
} }
GList *list = nullptr; GList *list = nullptr;
for (auto const &b : barriers_) { for (auto const &b : m_barriers) {
list = g_list_append(list, b); list = g_list_append(list, b);
} }
xdp_input_capture_session_set_pointer_barriers( xdp_input_capture_session_set_pointer_barriers(
session_, list, m_session, list,
nullptr, // cancellable nullptr, // cancellable
[](GObject *obj, GAsyncResult *res, gpointer data) { [](GObject *obj, GAsyncResult *res, gpointer data) {
static_cast<PortalInputCapture *>(data)->cb_set_pointer_barriers(obj, res); static_cast<PortalInputCapture *>(data)->handleSetPointerBarriers(obj, res);
}, },
this this
); );
} }
void PortalInputCapture::glib_thread(void *) void PortalInputCapture::glibThread(void *)
{ {
auto context = g_main_loop_get_context(glib_main_loop_); auto context = g_main_loop_get_context(m_glibMainLoop);
LOG_DEBUG("glib thread running"); LOG_DEBUG("glib thread running");
while (g_main_loop_is_running(glib_main_loop_)) { while (g_main_loop_is_running(m_glibMainLoop)) {
Thread::testCancel(); Thread::testCancel();
g_main_context_iteration(context, true); g_main_context_iteration(context, true);
} }

View file

@ -29,64 +29,62 @@ public:
void release(double x, double y); void release(double x, double y);
bool is_active() const bool is_active() const
{ {
return is_active_; return m_isActive;
} }
private: private:
void glib_thread(void *); void glibThread(void *);
gboolean timeout_handler() const; gboolean timeoutHandler() const;
gboolean init_input_capture_session(); gboolean initSession();
void cb_init_input_capture_session(GObject *object, GAsyncResult *res); void handleInitSession(GObject *object, GAsyncResult *res);
void cb_set_pointer_barriers(const GObject *object, GAsyncResult *res); void handleSetPointerBarriers(const GObject *object, GAsyncResult *res);
void cb_session_closed(XdpSession *session); void handleSessionClosed(XdpSession *session);
void cb_disabled(const XdpInputCaptureSession *session, const GVariant *option); void handleDisabled(const XdpInputCaptureSession *session, const GVariant *option);
void cb_activated(const XdpInputCaptureSession *session, std::uint32_t activation_id, GVariant *options); void handleActivated(const XdpInputCaptureSession *session, std::uint32_t activationId, GVariant *options);
void cb_deactivated(const XdpInputCaptureSession *session, std::uint32_t activation_id, const GVariant *options); void handleDeactivated(const XdpInputCaptureSession *session, std::uint32_t activationId, const GVariant *options);
void cb_zones_changed(XdpInputCaptureSession *session, GVariant *options); void handleZonesChanged(XdpInputCaptureSession *session, GVariant *options);
/// g_signal_connect callback wrapper /// g_signal_connect callback wrapper
static void cb_session_closed_cb(XdpSession *session, gpointer data) static void sessionClosed(XdpSession *session, gpointer data)
{ {
static_cast<PortalInputCapture *>(data)->cb_session_closed(session); static_cast<PortalInputCapture *>(data)->handleSessionClosed(session);
} }
static void cb_disabled_cb(XdpInputCaptureSession *session, GVariant *options, gpointer data) static void disabled(XdpInputCaptureSession *session, GVariant *options, gpointer data)
{ {
static_cast<PortalInputCapture *>(data)->cb_disabled(session, options); static_cast<PortalInputCapture *>(data)->handleDisabled(session, options);
} }
static void static void activated(XdpInputCaptureSession *session, std::uint32_t activationId, GVariant *options, gpointer data)
cb_activated_cb(XdpInputCaptureSession *session, std::uint32_t activation_id, GVariant *options, gpointer data)
{ {
static_cast<PortalInputCapture *>(data)->cb_activated(session, activation_id, options); static_cast<PortalInputCapture *>(data)->handleActivated(session, activationId, options);
} }
static void static void deactivated(XdpInputCaptureSession *session, std::uint32_t activationId, GVariant *options, gpointer data)
cb_deactivated_cb(XdpInputCaptureSession *session, std::uint32_t activation_id, GVariant *options, gpointer data)
{ {
static_cast<PortalInputCapture *>(data)->cb_deactivated(session, activation_id, options); static_cast<PortalInputCapture *>(data)->handleDeactivated(session, activationId, options);
} }
static void cb_zones_changed_cb(XdpInputCaptureSession *session, GVariant *options, gpointer data) static void zonesChanged(XdpInputCaptureSession *session, GVariant *options, gpointer data)
{ {
static_cast<PortalInputCapture *>(data)->cb_zones_changed(session, options); static_cast<PortalInputCapture *>(data)->handleZonesChanged(session, options);
} }
int fake_eis_fd() const; int fakeEisFd() const;
private: private:
EiScreen *screen_ = nullptr; EiScreen *m_screen = nullptr;
IEventQueue *events_ = nullptr; IEventQueue *m_events = nullptr;
Thread *glib_thread_; Thread *m_glibThread;
GMainLoop *glib_main_loop_ = nullptr; GMainLoop *m_glibMainLoop = nullptr;
XdpPortal *portal_ = nullptr; XdpPortal *m_portal = nullptr;
XdpInputCaptureSession *session_ = nullptr; XdpInputCaptureSession *m_session = nullptr;
std::vector<guint> signals_; std::vector<guint> m_signals;
bool enabled_ = false; bool m_enabled = false;
bool is_active_ = false; bool m_isActive = false;
std::uint32_t activation_id_ = 0; std::uint32_t m_activationId = 0;
std::vector<XdpInputCapturePointerBarrier *> barriers_; std::vector<XdpInputCapturePointerBarrier *> m_barriers;
}; };
} // namespace deskflow } // namespace deskflow